Hbase is an open-source nosql Scalable Distributed Database. It is column-oriented and suitable for storing very large volumes of loose data. Hbase is suitable for real-time business environments that perform random read/write operations on big data. For more information about hbase, see the hbase project website.
The environment in this article is consistent with that in the previous section-completely distributed hadoop cluster configuration. OS is Ubuntu server 10.04 and hbase is 0.20.6.
Hregionserver & hquorumpeer: DM1, IP: 192.168.0.17;
Hregionserver & hquorumpeer: dm2, IP: 192.168.0.18;
Hregionserver & hquorumpeer: dm3, IP: 192.168.0.9;
Hmaster & namenode: dm4, IP: 192.168.0.10; (secondarynamenode)
Although it is unreasonable to put secondarynamenode and namenode on the same machine. However, considering that this is only a small experiment cluster (hardware environment is not allowed), and the timing snapshot of xenserver is guaranteed, secondarynamenode will not be deployed on other machines.
The main thing is still configuration work, still put hbase under/home, edit/home/hbase/conf under the hbase-site.xml, hbase-default.xml, hbase-env.sh these files. The procedure is as follows:
1. EditAll machinesThe command is as follows:
vi /home/hbase/conf/hbase-site.xml
Edit the file as shown in the following code. Note:
1. First, pay attention to HDFS: // dm4: 9000/hbase,Must be associated with your hadoop cluster'sCore-site.xml file configuration stay exactly consistentIf your hadoop HDFS uses other ports, modify them here. In addition, hbaseThe Host IP address is not recognized. Only the host hostname can be used.That is, if the IP address of dm4 (192.168.0.10) is used, a Java error will be thrown. As for the specific error, due to a long time, I am too lazy to review the large number of logs.
2.Hbase. zookeeper. Quorum must be an odd number.
<configuration><property> <name>hbase.rootdir</name> <value>hdfs://dm4:9000/hbase</value></property><property> <name>hbase.cluster.distributed</name> <value>true</value></property><property><name>hbase.master</name><value>192.168.0.10:60000</value></property><property> <name>hbase.zookeeper.quorum</name> <value>192.168.0.9,192.168.0.17,192.168.0.18</value></property></configuration>
2. Edit the hbase-default.xml for all machines. The command is as follows:
vi /home/hbase/conf/hbase-default.xml
You only need to modify hbase. rootdir and hbase. Cluster. distributed. The code below shows how to modify:
Hbase data is erased after restart. If data persistence is required, modify the rootdir item and write your HDFS directory.
For the meaning and modification of other items in default, refer to the official website.
<configuration> <property> <name>hbase.rootdir</name><value>hdfs://dm4:9000/hbase_rootdir</value> <description>The directory shared by region servers. Should be fully-qualified to include the filesystem to use. E.g: hdfs://NAMENODE_SERVER:PORT/HBASE_ROOTDIR </description> </property> <property> <name>hbase.master.port</name> <value>60000</value> <description>The port master should bind to.</description> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> <description>The mode the cluster will be in. Possible values are false: standalone and pseudo-distributed setups with managed Zookeeper true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh) </description> </property>
3. EditAll machinesThe hbase-env.sh, command is as follows:
vi /home/hbase/conf/hbase-env.sh
The modification code is as follows:
export HBASE_OPTS="$HBASE_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode" export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.22export HBASE_MANAGES_ZK=trueexport HBASE_HOME=/home/hbaseexport HADOOP_HOME=/home/hadoop
4. Edit hmasters and hregionservers of hbase on all machines. Modify the regionservers file in the/home/hbase/conf folder
. Add the IP address of datanode. The Code is as follows:
192.168.0.9192.168.0.17192.168.0.18
Now, the hbase cluster configuration has been completed. Start and test.
5. Start and test the hbase database.
Start hbase database in hmaster (namenode (dm4) (hadoop cluster must have been started ). Start command:
/home/hbase/bin/start-hbase.sh
Shows how to start hbase:
Run the JPS command to test your current hbase cluster process. For example:
Enter the following command to go to The hbase command line management interface:
/home/hbase/bin/hbase shell
Enter list in hbase shell, as shown below, to list the name of your current database, as shown in. If your hbase is not configured successfully, a Java error is thrown.
You can also manage and view hbase databases on the web page.
Hmaster: http: /// 192.168.0.10: 60010/master. jsp
My hbase database:
For hbase commands, see hadoop wiki.
Hbase database development and application, including database read/write and conditional query. For more information, see my future articles ......
Vi. References
1. hbase: bigtable-like structured storage for hadoop HDFS
Http://wiki.apache.org/hadoop/Hbase
2. hbase testing tutorial
Http://wiki.apache.org/hadoop/Hbase/HowToTest