欢迎光临
我们一直在努力

如何搭建一个Hbase集群

通过前面两篇介绍的内容:

1、Centos6.5编译Hadoop2.5.2-64位

2、如何搭建一个高可用的Hadoop集群

现在基本上一个Hadoop的高可用集群已经搭建好了,那么Hbase的集群需要在Hadoop集群的基础上搭建,那么HBASE的官方文档也有如何搭建,我就直接复制粘贴过来稍作整理,Hbase在国内用的还是比较多的,也有一个低版本的中文文档,推荐的书籍呢是《Hbase权威指南》,想要深入了解的呢可以买本书自己看或者直接官方文档走起~毕竟我也是初学者。OK那么下面介绍如何搭建Hbase的集群:

配置集群的基础:
四台虚拟机分别为[node1 | node2 | node3 | node4] hosts分别已经修改。
四台虚拟机已经配置好Hadoop2.x的集群。
选择其中一台机器进行配置:
首先配置环境变量:
export HBASE_HOME=/root/hbase-0.98
export PATH=$PATH:$HBASE_HOME/bin
其次按照官方文档按步骤配置:
1、配置免登录:
  • On 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:

    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.

 

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.

 

Since 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.

 

2、配置conf/regionservers


Edit conf/regionservers and remove the line which contains localhost. Add lines with the hostnames or IP addresses for node-b and node-c.

Even if you did want to run a RegionServer on 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.
最终效果
[root@node4 conf]# more regionservers 

node4
node2
node3

3、配置backup master.
Create a new file in conf/ called backup-masters, and add a new line to it with the hostname for node-b. In this demonstration, the hostname is node-b.example.com.
4、配置环境变量hbase-env.sh
只需要配置JDK即可
5、配置hbase-site.xml文件
6、将Hadoop2.x的集群配置文件hdfs-site.xml复制进来
7、将环境变量文件、Hbase配置文件都复制到其他主机,启动集群。
OK,一个Hbase的集群也搭建完毕,不过大家也看到了,我在所有hadoop、Storm相关的文章中用到的一个域名codelee实际上是我另一个域名。OK,里面的有关名字的都可以自己定义。
当然一般Hbase都是在程序中来调用API执行操作的,Hbase Shell用的比较少,那么请看下一篇
《HBase官方API的简单使用》
未经允许不得转载:李阳博客 » 如何搭建一个Hbase集群

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址