Zookeeper正常部署
首先保证Zookeeper集群的正常部署,并启动之:
$ ~/modules/zookeeper-3.4.5/bin/zkServer.sh start
Hadoop正常部署
Hadoop集群的正常部署并启动:
$ ~/modules/hadoop-2.7.2/sbin/start-dfs.sh
$ ~/modules/hadoop-2.7.2/sbin/start-yarn.sh
HBase的解压
解压HBase到指定目录:
$ tar -zxf~/softwares/installations/hbase-1.3.1-bin.tar.gz -C ~/modules/
HBase的配置文件
需要修改HBase对应的配置文件。
hbase-env.sh修改内容:
export JAVA_HOME=/home/admin/modules/jdk1.8.0_121 export HBASE_MANAGES_ZK=false |
hbase-site.xml修改内容:
<configuration> <property> <name>hbase.rootdir</name> <value>hdfs://linux01:8020/hbase</value> </property>
<property> <name>hbase.cluster.distributed</name> <value>true</value> </property>
<!-- 0.98后的新变动,之前版本没有.port,默认端口为60000--> <property> <name>hbase.master.port</name> <value>16000</value> </property>
<property> <name>hbase.zookeeper.quorum</name> <value>linux01:2181,linux02:2181,linux03:2181</value> </property>
<property> <name>hbase.zookeeper.property.dataDir</name> <value>/home/admin/modules/zookeeper-3.4.5/zkData</value> </property> </configuration> |
regionservers:
linux01 linux02 linux03 |
HBase需要依赖的Jar包
由于HBase需要依赖Hadoop,所以替换HBase的lib目录下的jar包,以解决兼容问题:
1) 删除原有的jar:
$ rm -rf/home/admin/modules/hbase-1.3.1/lib/hadoop-* $ rm -rf/home/admin/modules/hbase-1.3.1/lib/zookeeper-3.4.6.jar |
2) 拷贝新jar,涉及的jar有:
hadoop-annotations-2.7.2.jar hadoop-auth-2.7.2.jar hadoop-client-2.7.2.jar hadoop-common-2.7.2.jar hadoop-hdfs-2.7.2.jar hadoop-mapreduce-client-app-2.7.2.jar hadoop-mapreduce-client-common-2.7.2.jar hadoop-mapreduce-client-core-2.7.2.jar hadoop-mapreduce-client-hs-2.7.2.jar hadoop-mapreduce-client-hs-plugins-2.7.2.jar hadoop-mapreduce-client-jobclient-2.7.2.jar hadoop-mapreduce-client-jobclient-2.7.2-tests.jar hadoop-mapreduce-client-shuffle-2.7.2.jar hadoop-yarn-api-2.7.2.jar hadoop-yarn-applications-distributedshell-2.7.2.jar hadoop-yarn-applications-unmanaged-am-launcher-2.7.2.jar hadoop-yarn-client-2.7.2.jar hadoop-yarn-common-2.7.2.jar hadoop-yarn-server-applicationhistoryservice-2.7.2.jar hadoop-yarn-server-common-2.7.2.jar hadoop-yarn-server-nodemanager-2.7.2.jar hadoop-yarn-server-resourcemanager-2.7.2.jar hadoop-yarn-server-tests-2.7.2.jar hadoop-yarn-server-web-proxy-2.7.2.jar zookeeper-3.4.5.jar |
这些jar包的对应版本应替换成你目前使用的hadoop版本,具体情况具体分析。
HBase软连接Hadoop配置
$ ln -s~/modules/hadoop-2.7.2/etc/hadoop/core-site.xml ~/modules/hbase-1.3.1/conf/core-site.xml
$ ln -s ~/modules/hadoop-2.7.2/etc/hadoop/hdfs-site.xml~/modules/hbase-1.3.1/conf/hdfs-site.xml
HBase远程scp到其他集群
$ scp -r /home/admin/modules/hbase-1.3.1/linux02:/home/admin/modules/
$ scp -r /home/admin/modules/hbase-1.3.1/ linux03:/home/admin/modules/
HBase服务的启动
如果集群之间的节点时间不同步,会导致regionserver无法启动,抛出ClockOutOfSyncException异常。
修复方式:
a、同步时间服务
https://blog.csdn.net/liangzelei/article/details/80262133
b、属性:hbase.master.maxclockskew设置更大的值
<property> <name>hbase.master.maxclockskew</name> <value>180000</value> <description>Time difference of regionserver frommaster</description> </property> |
启动方式:
$ bin/start-hbase.sh
停止服务:
$ bin/stop-hbase.sh
查看HBase页面
启动成功后,可以通过“host:port”的方式来访问HBase管理页面,例如:http://linux01:16010