Apache HBase is an open source, non-relational, distributed
database modeled after Google's BigTable and is written in Java. It is
developed as part of Apache Software Foundation's Apache Hadoop project
and runs on top of HDFS (Hadoop Distributed File System), providing
BigTable-like capabilities for Hadoop. That is, it provides a
fault-tolerant way of storing large quantities of sparse data (small
amounts of information caught within a large collection of empty or
unimportant data, such as finding the 50 largest items in a group of 2
billion records, or finding the non-zero items representing less than
0.1% of a huge collection).
Pre Requirements
1) Machines with Ubuntu 14.04 LTS operating system.
2) Apache Hadoop pre installed (How to install Hadoop on Ubuntu 14.04)
3) Apache HBase 1.2.3 Software (Download Here)
HBase Fully Distributed Mode Installation on Ubuntu
For running a fully-distributed operation on more than one host, make the following configurations. (see, Pseudo Distributed Mode Setup)
HBase Installation Steps
On All machines - (masterhbase, regionserver1, regionserver2)
Step 1 - Update. Open a terminal (CTRL + ALT + T) and type the following sudo command. It is advisable to run this before installing any package, and necessary to run it to install the latest updates, even if you have not added or removed any Software Sources.
Step 2 - Installing Java 7.
Step 3 - Install open-ssh server.
It is a cryptographic network protocol for operating network services
securely over an unsecured network. The best known example application
is for remote login to computer systems by users.
Step 4 - Edit /etc/hosts file.
/etc/hosts file. Add all machines IP address and hostname. Save and close.
Step 5 - Creating /usr/local/hbase directory.
Step 6 - Change the ownership and permissions of the directory /usr/local/hbase. Here 'hduser' is an Ubuntu username.
Step 7 - Creating /var/hbase/pids directory.
Step 8 - Change the ownership and permissions of the directory /var/hbase/pids. Here 'hduser' is an Ubuntu username.
Step 9 - Generating a new SSH public and private key pair
on your local computer is the first step towards authenticating with a
remote server without a password. Unless there is a good reason not to,
you should always authenticate using SSH keys.
Step 10 - Now you can add the public key to the authorized_keys
Step 11 - Adding hostname to list of known hosts.
A quick way of making sure that 'hostname' is added to the list of
known hosts so that a script execution doesn't get interrupted by a
question about trusting computer's authenticity.
Only on masterhbase Machine
Step 16 - ssh-copy-id is a small script which copy your ssh public-key to a remote host; appending it to your remote authorized_keys.
Step 17 - ssh is a program for logging into a remote machine and for executing commands on a remote machine. Check remote login works or not.
Step 18 - Exit from remote login.
Same steps 16, 17 and 18 for other machines (regionserver2).
Step 19 - Change the directory to /home/hduser/Desktop , In my case the downloaded hbase-1.2.3-bin.tar.gz file is in /home/hduser/Desktop folder. For you it might be in /downloads folder check it.
Step 20 - Untar the hbase-1.2.3-bin.tar.gz file.
Step 21 - Move the contents of hbase-1.2.3 folder to /usr/local/hbase
Step 22 - Edit $HOME/.bashrc file by adding the java and hadoop path.
$HOME/.bashrc file. Add the following lines
Step 23 - Reload your changed $HOME/.bashrc settings
Step 24 - Change the directory to /usr/local/hbase/conf
Step 25 - Edit hbase-env.sh file.
Step 26 - Add the below lines to hadoop-env.sh file. Save and Close.
Step 27 - Edit regionservers file.
Step 28 - Add the below lines to regionservers file. Save and Close.
Step 29 - Edit backup-masters file.
Step 30 - Add the below lines to backup-masters file. Save and Close.
Step 31 - Make a new /user/hduser/hbase directory in HDFS.
Step 32 - Make a new /user/hduser/zookeeper directory in HDFS.
Step 33 - Edit hbase-site.xml file.
Add the below lines to hbase-site.xml file. Save and Close.
Step 34 - Secure copy or SCP
is a means of securely transferring computer files between a local host
and a remote host or between two remote hosts. Here we are transferring
configured hadoop files from master to slave nodes.
Step 35 - Here we are transferring configured .bashrc file from master to slave nodes.
Step 36 - Change the directory to /usr/local/hbase/bin
Step 37 - Start all hbase daemons.
Step 38 - The JPS (Java Virtual Machine Process Status Tool) tool is limited to reporting information on JVMs for which it has the access permissions.
Once the HBase is up and running check the web-ui of the components as described below
First master
Secondary master
Region server1
Region server2
Only on regionserver1 machine
Only on regionserver2 machine
Only on hbasemaster machine
Step 39 - Stop all hbase daemons.
Pre Requirements
1) Machines with Ubuntu 14.04 LTS operating system.
2) Apache Hadoop pre installed (How to install Hadoop on Ubuntu 14.04)
3) Apache HBase 1.2.3 Software (Download Here)
HBase Fully Distributed Mode Installation on Ubuntu
For running a fully-distributed operation on more than one host, make the following configurations. (see, Pseudo Distributed Mode Setup)
HBase Installation Steps
On All machines - (masterhbase, regionserver1, regionserver2)
Step 1 - Update. Open a terminal (CTRL + ALT + T) and type the following sudo command. It is advisable to run this before installing any package, and necessary to run it to install the latest updates, even if you have not added or removed any Software Sources.
$ sudo apt-get update
$ sudo apt-get install openjdk-7-jdk
$ sudo apt-get install openssh-server
$ sudo gedit /etc/hosts
10.10.10.1 masterhbase 10.10.10.2 regionserver1 10.10.10.3 regionserver2
$ sudo mkdir /usr/local/hbase
$ sudo chown -R hduser /usr/local/hbase
$ sudo chmod -R 755 /usr/local/hbase
$ sudo mkdir /var/hbase/pids
$ sudo chown -R hduser /var/hbase/pids
$ sudo chmod -R 755 /var/hbase/pids
$ ssh-keygen -t rsa -P ""
$ cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
$ ssh hostname
Step 16 - ssh-copy-id is a small script which copy your ssh public-key to a remote host; appending it to your remote authorized_keys.
$ ssh-copy-id -i $HOME/.ssh/id_rsa.pub hduser@10.10.10.2
$ ssh 10.10.10.2
$ exit
$ ssh-copy-id -i $HOME/.ssh/id_rsa.pub hduser@10.10.10.3
$ ssh 10.10.10.3
$ exit
$ cd /home/hduser/Desktop/
$ tar xzf hbase-1.2.3-bin.tar.gz
$ mv hbase-1.2.3/* /usr/local/hbase
$ sudo gedit $HOME/.bashrc
export HBASE_HOME=/usr/local/hbase PATH=$PATH:$HBASE_HOME/bin export CLASSPATH=$CLASSPATH:/usr/local/hbase/lib/*
$ source $HOME/.bashrc
$ cd /usr/local/hbase/conf
$ gedit hbase-env.sh
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 export HBASE_REGIONSERVERS=/conf/regionservers export HBASE_MANAGES_ZK=true export HBASE_PID_DIR=/var/hbase/pids
$ gedit regionservers
10.10.10.2 10.10.10.3
$ gedit backup-masters
10.10.10.2
$ hdfs dfs -mkdir /user/hduser/hbase
$ hdfs dfs -mkdir /user/hduser/zookeeper
$ gedit hbase-site.xml
<property> <name>hbase.rootdir</name> <value>hdfs://namenode:9000/user/hduser/hbase</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <name>hbase.zookeeper.quorum</name> <value>10.10.10.1,10.10.10.2,10.10.10.3</value> </property> <property> <name>hbase.master</name> <value>10.10.10.1:60010</value> </property> <property> <name>hbase.zookeeper.property.clientPort</name> <value>2181</value> </property> <property> <name>hbase.zookeeper.property.dataDir</name> <value>hdfs://namenode:9000/user/hduser/zookeeper</value> </property>
$ scp -r /usr/local/hbase/* hduser@10.10.10.2:/usr/local/hbase
$ scp -r /usr/local/hbase/* hduser@10.10.10.3:/usr/local/hbase
$ scp -r $HOME/.bashrc hduser@10.10.10.2:$HOME/.bashrc
$ scp -r $HOME/.bashrc hduser@10.10.10.2:$HOME/.bashrc
$ cd /usr/local/hbase/bin
$ ./start-hbase.sh
$ jps
20355 Jps 20071 HQuorumPeer 20137 HMaster
First master
http://masterhbase:16010
http://regionserver1:16010
http://regionserver1:16030
http://regionserver2:16030
$ jps
15930 HRegionServer 16194 Jps 15838 HQuorumPeer 16010 HMaster
$ jps
13901 Jps 13639 HQuorumPeer 13737 HRegionServer
$ cd /usr/local/hbase/bin
$ ./stop-hbase.sh
Comments
Post a Comment