Tuesday, 3 May 2016

Android Push Notification Server Code In Python



I was create Push Notification server code in python. Its successfully working My android app receives push notification from python code.


Requirements :

                                   1. python2.7

                                   2. pip2.7  install python-gcm

                                   3. Create New Project From Google Developer Console https://console.developers.google.com/




                                   4. Project Number == Sender ID (Android App Use this code)
https://console.cloud.google.com/home/dashboard

Select Your Project  Project Number is SenderID

                                   5. Android Server Key (This Api key used for our python)

Create Credentials ServerKey





                                   6. Once Android Project is Ready Device Id Stored in Google and Google gives Registration Id (Reg id is Used  for Our Python)



Python Code :

from gcm import *

gcm = GCM("AIzaSyAU94l_PxyhJaiKsocFHWtS3mKcI5eUg")#ServerKey from google

data = {'message': 'Hiiii Android', 'param2': 'value2'}

reg_id = "APA91bHrQ1bfhrceoZ4X_kKVOJxlPGdUDjZyUl8zC_6rIeRCQiE9XT3fpJobWb-AIOHKlR4-C6iAMTwGgddbJlxMcVqESZnKIeVFl756dfg8HI1ju5cburZ43icTK_biGiLadmkY79OfklLPaXDfqylXF5HvZ5WFKcpb7oQ"

gcm.plaintext_request(registration_id=reg_id, data=data)




Message is key : Hiii Android is value
this message sends to android phone.

Above Server side Code is success fully working I got Push.













  Android App Receives Push :





Wednesday, 24 February 2016

HP Vertica


Introduction of Vertica
        
        * Vertica was founded in 2005 by database researcher Michael Stonebraker, and Andrew Palmer. 

        * Vertica was acquired by Hewlett Packard on March 22, 2011

        * It's supports only linux  systems and support jdbc and odbc connections

        * It's Column-oriented database
                Store data to optimize for access.it can dramatically reduce disk I/O process.

        * It's store database for Compression format
                Store more data in less physical storage, HP Vertica stores more data, provides more views, and uses less hardware than other databases. Compression rates of 50-90% are possible.

        * It's Cluster Based Database 
                Scale your database easily, whether you need three nodes or 300 but hp provides free on 3 nodes only .

Installation of Vertica

                  Pre-Installation Steps
                                     
                                             1. su root

                                             2. yum install mcelog

                                             3. yum install ntp

                                             4. yum install sysstat
 
                                             5. yum install pstack

                                             6. service iptables save

                                             7. service iptables stop

                                             8. chkconfig iptables off

                                             9. /sbin/service ntpd restart
                                           
                                            10. /sbin/chkconfig ntpd on
          
                                            11. cat /etc/selinux/config

                                                         set       SELINUX=disabled

                                            12. df -h (Check your disk name - /dev/sda1 or  /dev/sda2  or  /dev/sda3)

                                            13. vi /etc/rc.local

                                                          /sbin/blockdev --setra 2048 /dev/sda1
                                                          /sbin/blockdev --setra 2048 /dev/sda3

                                                   if test -f /sys/kernel/mm/redhat_transparent_hugepage/enabled; then
                                                   echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled
                                                   fi
                                                   echo deadline > /sys/block/sda/queue/scheduler
                                                   echo never > /sys/kernel/mm/transparent_hugepage/enabled
                               echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor


                                             14. init 6


                      Installation Steps

                                           1. su

                                           2. rpm -Uvh vertica-7.0.1-0.x86_64.RHEL5.rpm    ->replace your package

                                           3. /opt/vertica/sbin/install_vertica -s 10.10.40.65 -r vertica-7.0.1-0.x86_64.RHEL5.rpm -u dbadmin

                                                  10.10.40.65 - My ip address
                                                   vertica-7.1.1-0.x86_64.RHEL5.rpm - my vertica packages

                                            4. vi /home/dbadmin/.bashrc
                                                                              
                                                           export TZ='Asia/Kolkata'

                        
                          Post-Installation Steps

                                             1. $su dbadmin

                                             2. $cd

                                             3. $adminTools

Once its completed automatically open vertica admin menu.

Same procedure for add another host

example 
  
        above commands working on 10.10.40.65 now i want to add another node 10.10.10.40.66


10.10.40.66 :

                        1.Complete All the Pre-Installation Steps
                        
                         2. Set Passwordless login both systems

Goto 10.10.40.65

                         
                                            1. su

                                            2. /opt/vertica/sbin/install_vertica -s 10.10.40.66 -r vertica-7.0.1-0.x86_64.RHEL5.rpm -u dbadmin

                                            3. vi /home/dbadmin/.bashrc
                                                                              
                                                           export TZ='Asia/Kolkata'


10.10.40.66

          Post-Installation Steps

                                             1. $su dbadmin

                                             2. $cd

                                             3. $adminTools


Successfully added Two nodes. with K-safety value =0

                           

Saturday, 6 February 2016

Hbase Installation


1.Download the latest version of Hbase

                           HBASE-DOWNLOAD


2.Download the latest version of ZooKeeper

                           ZOOKEEPER-DOWNLOAD

              Single node we don't need zookeeper

HBase uses ZooKeeper as a distributed coordination service to maintain server state in the cluster. Zookeeper maintains which servers are alive and available, and provides server failure notification.


 3.Extract the Hbase and Zookeeper files and set the Environment is bashrc file

vi .bashrc

export HBASE_HOME='/opt/Hbase/hbase-1.1.3'
export PATH=$PATH:$HBASE_HOME/bin

export ZOOKEEPER_HOME='/opt/zookeeper/zookeeper-3.5.1-alpha'
export PATH=$PATH:$ZOOKEEPER_HOME=/bin


4. cd $HBASE_HOME/conf

5. vi hbase-site.xml(Standalone)

set your system path

 <configuration>
    <property>
         <name>hbase.rootdir</name>
         <value>file:///home/hadooptest/Desktop/hbase</value>
    </property>
    <property>
                 <name>hbase.zookeeper.property.dataDir</name>
                  <value>/home/hadooptest/Desktop/zookeeper</value>
    </property>
 </configuration>




6. vi hbase-env.sh

i.set your java path
ii.set hbase class path

export HBASE_OPTS="-XX:+UseConcMarkSweepGC"
export JAVA_HOME=/opt/jdk/jdk1.8.0_05
export HBASE_CLASSPATH=/opt/hbase/hbase-1.1.3/lib



              ****     HBASE CONFIGURATION OVER     ***
hbase Standalone Configuration completed and start the hbase

       $HBASE_HOME/bin/start-hbase.sh

        jps


Hadoop:
                      NameNode
                   DataNode
                   JobTracker
                  TaskTracker

Zookeeper

                  HQuorumPeer
 HBase

                   HMaster
                HRegionServer

Once hbase started check these process. HQuorumPeer Zookeeper process is automatically started.

 webconsole :

                 http://10.10.110.75:16010

                    (Portnumber based on hbase versions)



Distributed Mode (Connected with hadoop)


1. vi hbase-site.xml(Multinode using Hadoop)

I'm using single node hadoop

10.10.110.75 - server - first
10.10.110.75 - client - second
And set Zookeeper local path

<configuration>
    <property>
        <name>hbase.rootdir</name>
        <value>hdfs://10.10.110.75:9000/hbase1</value>
    </property>
    <property>
        <name>hbase.cluster.distributed</name>
        <value>true</value>
    </property>
     <property>
         <name>hbase.zookeeper.quorum</name>
         <value>10.10.110.75</value>
     </property>
    <property>
        <name>dfs.replication</name>
        <value>1</value>
    </property>
    <property>
        <name>hbase.zookeeper.property.clientPort</name>
        <value>2181</value>
    </property>
    <property>
        <name>hbase.zookeeper.property.dataDir</name>
        <value>/home/hadooptest/hbase/zookeeper</value>
    </property>
</configuration>


2.vi regionservers

set your client ip's or hostname

         namenode(My hostname-because i'm a server and i'm a client)

3. cd $ZOOKEEPER_HOME/conf

4. cp zoo_sample.cfg  zoo.cfg

5 .  vi zoo.cfg

       Change your local Data directory (My file)


tickTime=2000
initLimit=10
syncLimit=5
dataDir=/opt/zookeeper/sample 
clientPort=2181


Zookeeper configuration is completed
stop all the process

stop-all.sh   ($HADOOP_HOME/sbin/stop-all.sh)
stop.hbase.sh ($HBASE_HOME/bin/stop.hbase.sh)
zkServer.sh stop ($ZOOKEEPER_HOME/bin/zkServer.sh stop)

6. jps
001110 jps


7. start all process

$HADOOP_HOME/sbin/start-all.sh

$ZOOKEEPER_HOME/bin/zkServer.sh start


$HBASE_HOME/bin/start.hbase.sh

8. jps


3712 HMaster
32579 NameNode
26391 NodeManager
9303 Jps
5544 QuorumPeerMain
14137 SecondaryNameNode
24778 ResourceManager
5437 HRegionServer
6623 DataNode

9. Check webconsole

 http://10.10.110.75:16010


                           Distributed Mode Completed

Friday, 5 February 2016

Sqoop Installation



1.Download Your Scoop tar file in apache link

                http://www.eu.apache.org/dist/sqoop/


2.Extract the tar file and move your path

               mv sqoop2.6.1   /opt/sqoop/

3.Set the Environment in .bashrc file

my Sqoop path is :'/opt/Sqoop/sqoop-1.4.6.bin__hadoop-2.0.4-alpha'


export SQOOP_HOME='/opt/Sqoop/sqoop-1.4.6.bin__hadoop-2.0.4-alpha'
export PATH=$PATH:$SQOOP_HOME/bin


4.Check if the sqoop has been installed successfully type the command

                 sqoop version

Warning: /opt/Sqoop/sqoop-1.4.6.bin__hadoop-2.0.4-alpha/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /usr/hdp/2.2.0.0-2041/accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
2016-02-06 13:21:28,496 INFO  [main] sqoop.Sqoop: Running Sqoop version: 1.4.6
Sqoop 1.4.6

git commit id c0c5a81723759fa575844a0a1eae8f510fa32c25
Compiled by root on Mon Apr 27 14:38:36 CST 2015





5 . Finally  Type below command in  command prompt
                  
                  sqoop help

arning: /opt/Sqoop/sqoop-1.4.6.bin__hadoop-2.0.4-alpha/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /usr/hdp/2.2.0.0-2041/accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
2016-02-06 13:21:54,687 INFO  [main] sqoop.Sqoop: Running Sqoop version: 1.4.6
usage: sqoop COMMAND [ARGS]

Available commands:
  codegen            Generate code to interact with database records
  create-hive-table  Import a table definition into Hive
  eval               Evaluate a SQL statement and display the results
  export             Export an HDFS directory to a database table
  help               List available commands
  import             Import a table from a database to HDFS
  import-all-tables  Import tables from a database to HDFS
  import-mainframe   Import datasets from a mainframe server to HDFS
  job                Work with saved jobs
  list-databases     List available databases on a server
  list-tables        List available tables in a database
  merge              Merge results of incremental imports
  metastore          Run a standalone Sqoop metastore
  version            Display version information

See 'sqoop help COMMAND' for information on a specific command.



Sucessfully installed Sqoop.


My HADOOP VERSION IS :  Hadoop 2.6.0

Wednesday, 6 January 2016

Remote Desktop CentOs to centOs Only in same network


  No Need Any Softwares Already Centos have TigerVnc Viewer


1.Enable Remote desktop in your centos system Goto System-->Preference-->Remote Desktop

 

             **i.Enable allow other user to view your Desktop**

             **ii.Enable allow other user to control your Desktop**

             **iii.You must confirm each access to this machine allow or cancel**

             **iv.if you ask any password to enable and type your password**
 
 
 
 

Notification Area:

Some one connect your system its enable to shows the icon on top panel.
 
How To Access this System :
 
 


Enter Your ip address
 Type your remote password:
Enjoy..& thank you