所需安裝包:
hbase-0.94.1的安裝包
安裝流程:
1、配置hbase-env.xml
export JAVA_HOME=/usr/java/jdk1.6.0_37export HBASE_MANAGES_ZK=true
2、配置hbase-site.xml
<configuration><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>dd1,dd2,dd3</value></property><property><name>hbase.zookeeper.property.dataDir</name><value>/home/hadoop/zookeeper</value></property></configuration>
- hbase.rootdir 設定hbase在hdfs上的目錄,主機名稱為hdfs的namenode節點所在的主機
- hbase.cluster.distributed 設定為true,表明是完全分布式的hbase叢集
- hbase.zookeeper.quorum 設定zookeeper的主機,建議使用單數
- hbase.zookeeper.property.dataDir 設定zookeeper的資料路徑
3、配置regionservers
dd1dd2dd3
4、配置hadoop中的hdfs-site.xml,添加配置
<property><name>dfs.datanode.max.xcievers</name><value>4096</value></property>
該參數限制了datanode所允許同時執行的發送和接受任務的數量,預設為256,hadoop-defaults.xml中通常不設定這個參數。這個限制看來實際有些偏小,高負載下,DFSClient 在put資料的時候會報 could not read from stream 的 Exception。
An Hadoop HDFS datanode has an upper bound on the number of files that it will serve at any one time. The upper bound parameter is called xcievers (yes, this is misspelled).
Not having this configuration in place makes for strange looking failures. Eventually you'll see a complain in the datanode logs complaining about the xcievers exceeded, but on the run up to this one manifestation
is complaint about missing blocks. For example: 10/12/08 20:10:31 INFO hdfs.DFSClient: Could not obtain block blk_XXXXXXXXXXXXXXXXXXXXXX_YYYYYYYY from any node: java.io.IOException: No live nodes contain current block. Will get new block locations from
namenode and retry...
5、刪除hbase/lib包下面的hadoop-core-1.0.X.jar和commons-collections-3.2.1.jar,將hadoop目錄下的core包和commons-collections-3.2.1.jar拷貝到hbase的lib下面 ---這個操作是為了保證hadoop和hbase的包的版本一致,以為出現一些類似版本不相容的問題。
6、查看修改/etc/hosts是否綁定了127.0.0.1,如果有將其注釋
下面是官網的說明
Before we proceed, make sure you are good on the below loopback prerequisite.
Loopback IP
HBase expects the loopback IP address to be 127.0.0.1. Ubuntu and some other distributions, for example, will default to 127.0.1.1 and this will cause problems for you.
/etc/hosts should look something like this:
127.0.0.1 localhost 127.0.0.1 ubuntu.ubuntu-domain ubuntu
這裡說了hbase預設的會送地址是127.0.0.1,配置應該像上面這樣,他這裡添加了 127.0.0.1 localhost 這段。其實也可以直接不添加,把下面的這句話注釋掉。問題就解決了!
錯誤記錄:情況1:
2012-12-19 22:11:46,018 INFO org.apache.zookeeper.client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not
be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
2012-12-19 22:11:46,024 WARN org.apache.zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
解決方案:
修改/etc/hosts
注釋掉加粗的一行
#127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.130.170 master192.168.130.168 dd1192.168.130.162 dd2192.168.130.248 dd3192.168.130.164 dd4
7、各伺服器時間間隔不同導致異常:Time difference of 39431466ms > max allowed of 30000ms
解決方案:
1).方案1
在hbase-site.xml添加配置
<property> <name>hbase.master.maxclockskew</name> <value>180000</value> <description>Time difference of regionserver from master</description> </property>
2).方案2
修改各結點時間,使其誤差在30s內
clock --set --date="10/29/2011 18:46:50"
clock --hctosys