Hbase環境搭建
此筆記僅用於作者記錄復習使用,如有錯誤地方歡迎留言指正,作者感激不盡,如有轉載請指明出處
Hbase環境搭建
- Hbase環境搭建
- hadoop為HA的Hbase配置
- Zookeeper集群的正常部署並啟動
- Hadoop集群的正常部署並啟動
- 解壓HBase
- 修改HBase配置文件
- 替換HBase根目錄下的lib目錄下的jar包,以解決兼容問題
- 將Hadoop配置文件軟連接到HBase的conf目錄下
- 將整理好的HBase安裝目錄scp到其他機器節點
- 啟動服務
- 查看頁面驗證是否啟動成功
- HMaster的高可用
- hadoop為HA的Hbase配置
hadoop為HA的Hbase配置
Zookeeper集群的正常部署並啟動
$ /usr/local/src/zookeeper-3.4.5-cdh5.3.6/bin/zkServer.sh start
Hadoop集群的正常部署並啟動
$ /usr/local/src/hadoop-2.5.0-cdh5.3.6/sbin/start-dfs.sh
$ /usr/local/src/hadoop-2.5.0-cdh5.3.6/sbin/start-yarn.sh
解壓HBase
$ tar -zxf /opt/cdh/hbase-0.98.6-cdh5.3.6.tar.gz -C /usr/local/src/
修改HBase配置文件
- 修改hbase-env.sh文件
export JAVA_HOME=/usr/local/src/jdk1.8.0_121/
export HBASE_MANAGES_ZK=false
- 修改hbase-site.xml文件
<!--指定hbase的根目錄,mycluster:高可用hdfs名稱-->
<property>
<name>hbase.rootdir</name>
<value>hdfs://mycluster/hbase</value>
</property>
<!--是否運行在完全分布式中-->
<property>
<name> hbase.cluster.distributed</name>
<value>true</value>
</property>
<!---高可用集群中只配置端口號就行,如果是單節點,則指明機器名-->
<property>
<name>hbase.master</name>
<value>60000</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master:2181,slave1:2181,slave2:2181</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/local/src/zookeeper-3.4.5-cdh5.3.6/dataDir</value>
</property>
- 修改regionservers文件
master
slave1
slave2
替換HBase根目錄下的lib目錄下的jar包,以解決兼容問題
刪除原有Jar包以及zookeeper的jar包
$ rm -rf /usr/local/src/hbase-0.98.6-cdh5.3.6/lib/hadoop-*$ rm -rf lib/zookeeper-3.4.6.jar
拷貝新的Jar包
這裏涉及到的jar包大概是:
hadoop-annotations-2.5.0.jar
hadoop-auth-2.5.0-cdh5.3.6.jar
hadoop-client-2.5.0-cdh5.3.6.jar
hadoop-common-2.5.0-cdh5.3.6.jar
hadoop-hdfs-2.5.0-cdh5.3.6.jar
hadoop-mapreduce-client-app-2.5.0-cdh5.3.6.jar
hadoop-mapreduce-client-common-2.5.0-cdh5.3.6.jar
hadoop-mapreduce-client-core-2.5.0-cdh5.3.6.jar
hadoop-mapreduce-client-hs-2.5.0-cdh5.3.6.jar
hadoop-mapreduce-client-hs-plugins-2.5.0-cdh5.3.6.jar
hadoop-mapreduce-client-jobclient-2.5.0-cdh5.3.6.jar
hadoop-mapreduce-client-jobclient-2.5.0-cdh5.3.6-tests.jar
hadoop-mapreduce-client-shuffle-2.5.0-cdh5.3.6.jar
hadoop-yarn-api-2.5.0-cdh5.3.6.jar
hadoop-yarn-applications-distributedshell-2.5.0-cdh5.3.6.jar
hadoop-yarn-applications-unmanaged-am-launcher-2.5.0-cdh5.3.6.jar
hadoop-yarn-client-2.5.0-cdh5.3.6.jar
hadoop-yarn-common-2.5.0-cdh5.3.6.jar
hadoop-yarn-server-applicationhistoryservice-2.5.0-cdh5.3.6.jar
hadoop-yarn-server-common-2.5.0-cdh5.3.6.jar
hadoop-yarn-server-nodemanager-2.5.0-cdh5.3.6.jar
hadoop-yarn-server-resourcemanager-2.5.0-cdh5.3.6.jar
hadoop-yarn-server-tests-2.5.0-cdh5.3.6.jar
hadoop-yarn-server-web-proxy-2.5.0-cdh5.3.6.jar
zookeeper-3.4.5-cdh5.3.6.jar
將Hadoop配置文件軟連接到HBase的conf目錄下
$ ln -s /usr/local/src/hadoop-2.5.0-cdh5.3.6/etc/hadoop/core-site.xml /usr/local/src/hbase-0.98.6-cdh5.3.6/conf/core-site.xml
$ ln -s /usr/local/src/hadoop-2.5.0-cdh5.3.6/etc/hadoop/hdfs-site.xml /usr/local/src/hbase-0.98.6-cdh5.3.6/conf/hdfs-site.xml
將整理好的HBase安裝目錄scp到其他機器節點
啟動服務
$ bin/hbase-daemon.sh start master
$ bin/hbase-daemon.sh start regionserver
或者:
$ bin/start-hbase.sh
對應的停止命令:
$ bin/stop-hbase.sh
查看頁面驗證是否啟動成功
http://192.168.159.30:60010
HMaster的高可用
確保HBase集群已正常停止
$ bin/stop-hbase.sh在conf目錄下創建backup-masters文件
$ touch conf/backup-masters在backup-masters文件中配置高可用HMaster節點
$ echo slave1 > conf/backup-masters拷貝到其他節點的機器
打開頁面測試
測試http://master:60010嘗試關閉第一臺機器的HMaster
$ bin/hbase-daemon.sh stop master
然後查看第二臺的HMaster是否會直接啟用
Hbase環境搭建