Hbase安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hbase安装相关的知识,希望对你有一定的参考价值。
一、获取hbase的官方安装文件 网址:http://mirrors.cnnic.cn/apache/hbase/
[[email protected] ~]$ wget http://mirrors.cnnic.cn/apache/hbase/0.98.18/hbase-0.98.18-hadoop2-bin.tar.gz
[[email protected] ~]$ ls
file hbase-0.98.18-hadoop2-bin.tar.gz id_dsa.pub
二、切换到root用户,拷贝解压该文件,并赋予hadoop用户权限
[[email protected] ~]$ sudo su -
[sudo] password for hadoop:
[[email protected] ~]# cp /home/hadoop/hbase-0.98.18-hadoop2-bin.tar.gz /usr/local/
[[email protected] local]# cd /usr/local/
[[email protected] local]# tar -zxvf hbase-0.98.18-hadoop2-bin.tar.gz
[[email protected] local]# ls
hbase-0.98.18-hadoop2
[[email protected] local]# chown -R hadoop:hadoop hbase-0.98.18-hadoop2
三、编辑hbase配置文件
[[email protected] conf]# pwd
/usr/local/hbase-0.98.18-hadoop2/conf
[[email protected] conf]# vim hbase-env.sh
export JAVA_HOME=/usr/local/jdk1.8.0_20
export HBASE_MANAGES_ZK=true
export HBASE_CLASSPATH=/usr/local/hadoop-2.6.0
四、编辑hbase-site.xml
[[email protected] conf]# pwd
/usr/local/hbase-0.98.18-hadoop2/conf
[[email protected] conf]# ls
hadoop-metrics2-hbase.properties hbase-policy.xml regionservers
hbase-env.cmd hbase-site.xml
hbase-env.sh log4j.properties
[[email protected] conf]# vim hbase-site.xml
<property>
<name>hbase.master</name>
<value>master.hadoop:60000</value>
</property>
<property>
<name>hbase.master.maxclockskew</name>
<value>180000</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>slave1,slave2</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/home/ ${user.name} /tmp/zookeeper</value>
</property>
五、配置 regionservers
该文件“regionservers”位于“/usr/local/hbase-0.98.18-hadoop2/conf/”目录下
[[email protected] conf]# vim /usr/local/hbase-0.98.18-hadoop2/conf/regionservers
slave1
slave2
六、添加 HBase 环境变量
在“/etc/profile”文件的尾部添加以下内容,并使其有效(source /etc/profile)
[[email protected] conf]# vim /etc/profile
export HBASE_HOME=/usr/local/hadoop-2.6.0/
export PATH=$PATH:$HBASE_HOME/bin
[[email protected] conf]# source /etc/profile
七、复制 HBase 到其他节点
将 Master 上配置好的 hadoop 所在文件夹“/usr/local/hbase-0.98.18-hadoop2”复制到所有的 Slave 的“/usr” 目录下,用下面命令格式进行
[[email protected] local]# scp -r /usr/local/hbase-0.98.18-hadoop2 [email protected]:/usr/local/
[[email protected] local]# ssh slave1
[email protected]‘s password:
Last login: Mon Apr 4 07:11:21 2016 from master
[[email protected] ~]# cd /usr/local/
[[email protected] local]# chown -R hadoop:hadoop hbase-0.98.18-hadoop2
[[email protected] local]# exit
logout
Connection to slave1 closed.
[[email protected] local]# ssh slave2
[email protected]‘s password:
Last login: Sat Apr 2 16:39:20 2016
[[email protected] ~]# cd /usr/local/
[[email protected] local]# chown -R hadoop:hadoop hbase-0.98.18-hadoop2
八、启动 HBase
“Master”机器上,使用用户“hadoop”执行下面命令启动 HBase 数据库
[[email protected] hbase-0.98.18-hadoop2]$ bin/start-hbase.sh
slave1: starting zookeeper, logging to /usr/local/hbase-0.98.18-hadoop2/bin/../logs/hbase-hadoop-zookeeper-slave1.out
slave3: ssh: connect to host slave3 port 22: Connection timed out
slavep: ssh: connect to host slavep port 22: Connection timed out
starting master, logging to /usr/local/hbase-0.98.18-hadoop2/bin/../logs/hbase-hadoop-master-master.out
slave2: starting regionserver, logging to /usr/local/hbase-0.98.18-hadoop2/bin/../logs/hbase-hadoop-regionserver-slave2.out
slave1: starting regionserver, logging to /usr/local/hbase-0.98.18-hadoop2/bin/../logs/hbase-hadoop-regionserver-slave1.out
[[email protected] hbase-0.98.18-hadoop2]$ jps
4130 ResourceManager
3988 SecondaryNameNode
21260 HMaster
21388 Jps
3839 NameNode
[[email protected] hbase-0.98.18-hadoop2]$ ssh slave1
Last login: Mon Apr 4 22:52:40 2016 from master
[[email protected] ~]$ jps
7904 Jps
4185 NodeManager
4105 DataNode
7822 HRegionServer
本文出自 “梅花香自苦寒来!” 博客,请务必保留此出处http://daixuan.blog.51cto.com/5426657/1760258
以上是关于Hbase安装的主要内容,如果未能解决你的问题,请参考以下文章
Hbase最新官方文档中文翻译与注解1-10|hbase简介与配置信息等