通过前面两篇介绍的内容:
现在基本上一个Hadoop的高可用集群已经搭建好了,那么Hbase的集群需要在Hadoop集群的基础上搭建,那么HBASE的官方文档也有如何搭建,我就直接复制粘贴过来稍作整理,Hbase在国内用的还是比较多的,也有一个低版本的中文文档,推荐的书籍呢是《Hbase权威指南》,想要深入了解的呢可以买本书自己看或者直接官方文档走起~毕竟我也是初学者。OK那么下面介绍如何搭建Hbase的集群:
export HBASE_HOME=/root/hbase-0.98
export PATH=$PATH:$HBASE_HOME/bin
node-a
, generate a key pair.
While logged in as the user who will run HBase, generate a SSH key pair, using the following command:
$ ssh-keygen -t rsa
If the command succeeds, the location of the key pair is printed to standard output. The default name of the public key is id_rsa.pub.
Create the directory that will hold the shared keys on the other nodes.
On node-b
and node-c
, log in as the HBase user and create a .ssh/ directory in the user’s home directory, if it does not already exist. If it already exists, be aware that it may already contain other keys.
Copy the public key to the other nodes.
Securely copy the public key from node-a
to each of the nodes, by using the scp
or some other secure means. On each of the other nodes, create a new file called .ssh/authorized_keys if it does not already exist, and append the contents of the id_rsa.pub file to the end of it. Note that you also need to do this for node-a
itself.
$ cat id_rsa.pub >> ~/.ssh/authorized_keys
Test password-less login.
If you performed the procedure correctly, if you SSH from node-a
to either of the other nodes, using the same username, you should not be prompted for a password.
node-b
will run a backup Master, repeat the procedure above, substituting node-b
everywhere you see node-a
. Be sure not to overwrite your existing .ssh/authorized_keys files, but concatenate the new key onto the existing file using the >>
operator rather than the >
operator.
Edit conf/regionservers and remove the line which contains localhost
. Add lines with the hostnames or IP addresses for node-b
and node-c
.
node-a
, you should refer to it by the hostname the other servers would use to communicate with it. In this case, that would be node-a.example.com
. This enables you to distribute the configuration to each node of your cluster any hostname conflicts. Save the file.node4
node2
node3
node-b
. In this demonstration, the hostname is node-b.example.com
.<configuration> <property> <name>hbase.rootdir</name> <value>hdfs://codelee/hbase</value> </property> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/opt/zookeeper</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <name>hbase.zookeeper.quorum</name> <value>node1,node2,node3</value> </property> </configuration>
未经允许不得转载:李阳博客 » 如何搭建一个Hbase集群