版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/shursulei/article/details/78169301
安装HBase(本地模式和集群模式)
一、本地模式的安装
- 解压并移到指定的文件夹
[root@node1 software]# mv hbase-1.1.3 /home/
- 配置hbase-env.sh文件
export JAVA_HOME=/usr/java/jdk1.7.0_79
- 配置hbase-site.xml文件
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///opt/data/hbase</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/opt/data/zkData</value>
</property>
</configuration>
- 启动
[root@node1 bin]# ./start-hbase.sh
starting master, logging to /home/hbase-1.1.3/bin/../logs/hbase-root-master-node1.out
出错:
[root@node1 bin]# cd /home/hbase-1.1.3/logs/
[root@node1 logs]# ls
hbase-root-master-node1.log hbase-root-master-node1.out SecurityAuth.audit
[root@node1 logs]# tail -200 hbase-root-master-node1.log
Could not start ZK at requested port of 2181. ZK was started at port: 2182. Aborting as clients (e.g. shell) will not be able to find this ZK quorum.
##原因是暂用的端口,解决方法,暂停所有进程,杀死进程killall java
[root@node1 bin]# jps
5582 Jps
5187 HMaster
hbase shell就可以进入命令模式下
二、完全分布式安装
前提是:hadoop集群和zookpeer集群要正常启动
- 配置hbase-site.xml文件
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://shursulei/hbase</value>##hdfs://shursulei/可以修改
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>node1,node2,node3</value>
</property>
</configuration>
- 配置 regionservers(和zookpeer相同)
node1
node2
node3
- 配置hbase-env.sh文件
export HBASE_MANAGES_ZK=false
export HBASE_CLASSPATH=/home/hadoop-2.5.1/etc/hadoop##配置环境
##Add a pointer to your HADOOP_CONF_DIR to the HBASE_CLASSPATH environment variable in hbase-env.sh.
copy上面的文件到其他的节点中
[root@node1 home]# scp -r hbase-1.1.3 root@node2:/home/
[root@node1 home]# scp -r hbase-1.1.3 root@node3:/home/
- 配置环境变量
export JAVA_HOME=/usr/java/jdk1.7.0_79
export HBASE_HOME=/home/hbase-1.1.3
export PATH=$PATH:$JAVA_HOME/bin:$HBASE_HOME/bin
- 启动
start-hbase.sh
界面: