Preparation environment:
- Hadoop fully distributed cluster environment
- HBase installation package: https://archive.apache.org/dist/hbase/
1. Unzip HBase installation package
Upload local installation package:
Unzip and rename:
2. System environment variable configuration
Configure the environment variables at all nodes and add the following contents:
[root@Each node download]# vi /etc/profile # set hbase environment export HBASE_HOME=/usr/local/src/hbase export PATH=$HBASE_HOME/bin:$PATH
After the configuration is completed, source makes it effective!
3. Configure HBase env sh
Enter / usr/local/src/hbase/conf / directory for HBase env SH configuration:
#Java installation location export JAVA_HOME=/usr/local/src/java #If the value is true, use the ZooKeeper provided by HBase; if the value is false, use the ZooKeeper installed on Hadoop export HBASE_MANAGES_ZK=false #HBase classpath export HBASE_CLASSPATH=/usr/local/src/hadoop/etc/hadoop/
4. Configure HBase site xml
-
hbase.rootdir: this item configures the directory where data is written. The default is HBase Rootdir refers to / tmp/hbase-${user.name}, which means you will lose data after restart (the operating system will clean up the / tmp directory when restarting).
-
hbase.zookeeper.property.clientPort: Specifies zk the connection port
-
zookeeper.session.timeout: timeout of connection between RegionServer and ZooKeeper. When the timeout expires, the ReigonServer will be removed from the RS cluster list by ZooKeeper. After receiving the removal notice, HMaster will re balance the regions in charge of this server and let other surviving regional servers take over.
-
hbase.zookeeper.quorum: the default value is localhost, and the servers in zookeepr ensemble s are listed.
-
hbase.master.info.port: the access port of the browser
Insert content in < configuration > >
<property> <name>hbase.rootdir</name> <value>hdfs://Server: 9000 / HBase < / value > # use 9000 port <description>The directory shared by region servers</description> </property> <property> <name>hbase.master.info.port</name> <value>60010</value> # Use master node 60010 port </property> <property> <name>hbase.zookeeper.property.clientPort</name> <value>2181</value> # Use master node 2181 port <description>Property from ZooKeeper's config zoo.cfg. The port at which the clients will connect.</description> </property> <property> <name>zookeeper.session.timeout</name> <value>120000</value> # ZooKeeper timeout </property> <property> <name>hbase.zookeeper.quorum</name> <value>server,agent1,agent2</value> # ZooKeeper management node </property> <property> <name>hbase.tmp.dir</name> <value>/usr/local/src/hbase/tmp</value> # HBase temporary file path </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> # Using distributed HBase </property>
5. Modify the regionservers file
Delete localhost and write an agent node host machine name in each line:
[root@server conf]# vi regionservers [root@server conf]# cat regionservers agent1 agent2
6. Create HBase tmp. Dir directory
[root@server conf]# mkdir /usr/local/src/hbase/tmp [root@server conf]# ll /usr/local/src/hbase/ Total consumption 292 drwxr-xr-x. 4 root root 4096 1 June 29, 2016 bin -rw-r--r--. 1 root root 105820 2 June 19, 2016 CHANGES.txt drwxr-xr-x. 2 root root 178 2 June 25-17:11 conf drwxr-xr-x. 12 root root 4096 2 June 19, 2016 docs drwxr-xr-x. 7 root root 80 2 June 19, 2016 hbase-webapps -rw-rw-r--. 1 root root 261 2 June 19, 2016 LEGAL drwxr-xr-x. 3 root root 8192 2 June 25-16:28 lib -rw-rw-r--. 1 root root 131265 2 June 19, 2016 LICENSE.txt -rw-rw-r--. 1 root root 27636 2 June 19, 2016 NOTICE.txt -rw-r--r--. 1 root root 1477 12 July 27, 2015 README.txt drwxr-xr-x. 2 root root 6 2 June 25-17:12 tmp
7. Synchronize hbase installation files to the slave
[root@server conf]# scp -r /usr/local/src/hbase/root@agent1:/usr/local/src/ [root@server conf]# scp -r /usr/local/src/hbase/root@agent2:/usr/local/src/
8. Start HBase
Start Hadoop first and then ZooKeeper:
# Start Hadoop first [root@server sbin]# ./start-all.sh # Then start ZooKeeper [root@server conf]# zkServer.sh status [root@agent1 conf]# zkServer.sh status [root@agent2 conf]# zkServer.sh status
Finally, start HBase:
# Finally, start HBase [root@server bin]# ./start-hbase.sh agent1: starting zookeeper, logging to /usr/local/src/hbase/bin/../logs/hbase-root zookeeper-agent1.out agent2: starting zookeeper, logging to /usr/local/src/hbase/bin/../logs/hbase-root-zookeeper-agent2.out server: starting zookeeper, logging to /usr/local/src/hbase/bin/../logs/hbase-root-zookeeper-server.out starting master, logging to /usr/local/src/hbase/logs/hbase-root-master-server.out Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0 Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0 agent2: starting regionserver, logging to /usr/local/src/hbase/bin/../logs/hbase-root-regionserver-agent2.out agent1: starting regionserver, logging to /usr/local/src/hbase/bin/../logs/hbase-root-regionserver-agent1.out agent2: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0 agent2: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0 agent1: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0 agent1: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
jsp to view the processes of all machines (as shown in the figure):
Enter server:60010 in the browser, and the interface shown in the following figure appears:
Back to top
9. Turn off HBase
Close HBase on the server node:
[root@server~]$ stop-hbase.sh
Close ZooKeeper on all nodes:
[root@server ~]$ zkServer.sh stop [root@agent1 ~]$ zkServer.sh stop [root@agent2 ~]$ zkServer.sh stop
Close Hadoop on the server node:
[root@server ~]$ stop-all.sh
Note: the time between nodes must be synchronized, otherwise HBase cannot be started.
Execute the date command on each node to check whether the time of each node is synchronized. If not, execute the date command on each node to check the time of each node.