[hadoop@master conf]$ vim hbase-site.xmlnode
<configuration>shell
<property>apache
<name>hbase.rootdir</name>vim
<value>hdfs://master:9000/hbase</value>bash
</property>oop
<property>spa
<name>hbase.cluster.distributed</name>.net
<value>true</value>日誌
</property>server
<property>
<name>hbase.zookeeper.quorum</name>
<value>slave1,slave2</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/home/hadoop/tmp/zookeeper</value>
</property>
</configuration>
[hadoop@master conf]$ vim regionservers
slave1
slave2
將hbase拷貝到slave1 和slave2
[hadoop@master ~]$ scp -r hbase-0.94.16-security slave1:~
[hadoop@master ~]$ scp -r hbase-0.94.16-security slave2:~
到slave1機器
[hadoop@slave1 ~]$ ln -s hbase-0.94.16-security/ hbase
[hadoop@slave1 ~]$
到slave2機器
[hadoop@slave2 ~]$ ln -s hbase-0.94.16-security/ hbase
到master機器
[hadoop@master ~]$ scp .bashrc slave1:~
.bashrc 100% 350 0.3KB/s 00:00
[hadoop@master ~]$ scp .bashrc slave2:~
.bashrc 100% 350 0.3KB/s 00:00
[hadoop@master ~]$
到兩個slave執行
[hadoop@slave1 ~]$ . .bashrc
[hadoop@slave2 ~]$ . .bashrc
配置完畢,啓動hbase
[hadoop@master ~]$ start-hbase.sh
slave1: starting zookeeper, logging to /home/hadoop/hbase/logs/hbase-hadoop-zookeeper-slave1.out
slave2: starting zookeeper, logging to /home/hadoop/hbase/logs/hbase-hadoop-zookeeper-slave2.out
starting master, logging to /home/hadoop/hbase/logs/hbase-hadoop-master-master.out
slave1: starting regionserver, logging to /home/hadoop/hbase/logs/hbase-hadoop-regionserver-slave1.out
slave2: starting regionserver, logging to /home/hadoop/hbase/logs/hbase-hadoop-regionserver-slave2.out
[hadoop@master ~]$ jps
7528 Jps
5946 NameNode
7385 HMaster
6189 JobTracker
6108 SecondaryNameNode
在slave1
[hadoop@slave1 ~]$ jps
5485 Jps
5317 HRegionServer
5229 HQuorumPeer
4000 TaskTracker
3916 DataNode
[hadoop@slave1 ~]$
若是啓動hbase集羣出現regionserver沒法啓動,日誌報告以下相似錯誤時,說明是集羣的時間不一樣步,只須要同步便可解決。
FATAL org.apache.hadoop.hbase.regionserver.HRegionServer: ABORTING region server 10.210.78.22,60020,1344329095415: Unhandled exceptio
n: org.apache.hadoop.hbase.ClockOutOfSyncException: Server 10.210.78.22,60020,1344329095415 has been rejected; Reported time is too far out of sync with mast
er. Time difference of 90358ms > max allowed of 30000ms
org.apache.hadoop.hbase.ClockOutOfSyncException: org.apache.hadoop.hbase.ClockOutOfSyncException: Server 10.210.78.22,60020,1344329095415 has been rejected;
Reported time is too far out of sync with master. Time difference of 90358ms > max allowed of 30000ms
......
Caused by: org.apache.hadoop.ipc.RemoteException: org.apache.hadoop.hbase.ClockOutOfSyncException: Server 10.210.78.22,60020,1344329095415 has been rejected;
Reported time is too far out of sync with master. Time difference of 90358ms > max allowed of 30000ms
Linux 修改日期時間
date -s "2008-08-08 12:00:00"
修改完後,記得執行clock -w,把系統時間寫入CMOS
hadoop@master ~]$ hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.94.16, r1557241, Fri Jan 10 20:10:24 UTC 2014
hbase(main):001:0> status
2 servers, 0 dead, 1.0000 average load
hbase(main):002:0> status 'detailed'
version 0.94.16
0 regionsInTransition
master coprocessors: []
2 live servers
slave1:60020 1414092860979
requestsPerSecond=0, numberOfOnlineRegions=1, usedHeapMB=33, maxHeapMB=48
-ROOT-,,0
numberOfStores=1, numberOfStorefiles=1, storefileUncompressedSizeMB=0, storefileSizeMB=0, memstoreSizeMB=0, storefileIndexSizeMB=0, readRequestsCount=33, writeRequestsCount=1, rootIndexSizeKB=0, totalStaticIndexSizeKB=0, totalStaticBloomSizeKB=0, totalCompactingKVs=0, currentCompactedKVs=0, compactionProgressPct=NaN
slave2:60020 1414092857315
requestsPerSecond=0, numberOfOnlineRegions=1, usedHeapMB=30, maxHeapMB=48
.META.,,1
numberOfStores=1, numberOfStorefiles=0, storefileUncompressedSizeMB=0, storefileSizeMB=0, memstoreSizeMB=0, storefileIndexSizeMB=0, readRequestsCount=0, writeRequestsCount=0, rootIndexSizeKB=0, totalStaticIndexSizeKB=0, totalStaticBloomSizeKB=0, totalCompactingKVs=0, currentCompactedKVs=0, compactionProgressPct=NaN
0 dead servers
Web監控頁面
http://192.168.1.222:60010
建立表
hbase(main):004:0> create 'mmm','a','b';
hbase(main):005:0* list
0 row(s) in 1.2720 seconds
TABLE
mmm
1 row(s) in 0.0220 seconds
hbase(main):007:0> describe 'mmm'
DESCRIPTION ENABLED
'mmm', {NAME => 'a', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => ' true
NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NO
NE', MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS =>
'false', BLOCKSIZE => '65536', IN_MEMORY => 'false', ENCODE_ON_DISK
=> 'true', BLOCKCACHE => 'true'}, {NAME => 'b', DATA_BLOCK_ENCODING
=> 'NONE', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSION
S => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '214748
3647', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMOR
Y => 'false', ENCODE_ON_DISK => 'true', BLOCKCACHE => 'true'}
1 row(s) in 0.1310 seconds
若是這裏建立表後使用list出現卡機,重啓hadoop和hbase
若是仍是不行,則
增長conf/hdfs-site.xml裏面的xceivers參數,至少要有4096
<property>
<name>dfs.datanode.max.xcievers</name>
<value>4096</value>
</property>
繼續重啓
在hbase-site.xml添加配置
<property>
<name>hbase.master.maxclockskew</name>
<value>180000</value>
<description>Time difference of regionserver from master</description>
</property>