Hadoop + HBase 集群
最好在各个服务器的/etc/hosts里面,配置机器名:IP对,以下所有配置文件,都用机器名
192.168.2.79 webdev
192.168.5.11 TEST-A
192.168.5.12 TEST-B (后来新增)
下载最新的HBase
http://labs.renren.com/apache-mirror/Hadoop/hbase/hbase-0.20.3/
安装步骤
http://hadoop.apache.org/hbase/docs/r0.20.3/api/overview-summary.html#overview_description
2.79
cp hbase-0.20.3.tar.gz /home/iic/
cd /home/iic
gzip -d hbase-0.20.3.tar.gz
tar xvf hbase-0.20.3.tar
cd hbase-0.20.3
chmod 700 bin/*
vi conf/hbase-env.sh: export JAVA_HOME=/home/bmb/jdk1.6.0_16
修改2.79的conf/hadoop-env.sh,加入对HBASE类库的引用
export HBASE_HOME=/home/iic/hbase-0.20.3
(此处的配置要加上$HADOOP_CLASSPATH:,不然会影响Hive的启动)
export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HBASE_HOME/hbase-0.20.3.jar:$HBASE_HOME/hbase-0.20.3-test.jar:$HBASE_HOME/conf:${HBASE_HOME}/lib/zookeeper-3.3.0.jar
5.11
scp hbase-0.20.3.tar [email protected]:/home/iic/
vi conf/hbase-env.sh: export JAVA_HOME=/home/iic/jdk1.6.0_16
1:提高ulimit数量
ulimit -n 2048
2:所有机器的时间必须同步
date -s 10:54:12
date -s 100412
3:修改 <font face="Courier New">${HBASE_HOME}/conf/hbase-site.xml,指向2.79 Hadoop集群 (/hbase必须自动创建)</font>
<font face="Courier New"> <property><br> <name>hbase.rootdir</name><br> <value>hdfs://webdev:9000/hbase</value><br> <description>The directory shared by region servers.<br> </description><br> </property><br> <property><br> <name>hbase.cluster.distributed</name><br> <value>true</value><br> <description>The mode the cluster will be in. Possible values are<br> false: standalone and pseudo-distributed setups with managed Zookeeper<br> true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)<br> </description><br> </property></font>
<font face="Courier New"> <property><br> <name>hbase.zookeeper.quorum</name> </font>
<font face="Courier New"> <value>webdev,TEST-A</value><br> <description>Comma separated list of servers in the ZooKeeper Quorum.<br> For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com".<br> By default this is set to localhost for local and pseudo-distributed modes<br> of operation. For a fully-distributed setup, this should be set to a full<br> list of ZooKeeper quorum servers. If HBASE_MANAGES_ZK is set in hbase-env.sh<br> this is the list of servers which we will start/stop ZooKeeper on.<br> </description><br> </property><br></font>
<br><font face="Courier New">4:修改2.79 ${HBASE_HOME}/conf/regionservers </font>
<font face="Courier New">webdev</font>
<font face="Courier New">TEST-A</font>
<font face="Courier New">TEST-B</font>
<font face="Courier New">5:HBase 依赖 ZooKeeper 集群 (本例子使用默认的Hbase启动内嵌的Zookeeper,而不是使用单独Zookeeper集群)</font>
<font face="Courier New">${HBASE_HOME}/conf/hbase-env.sh的变量HBASE_MANAGES_ZK 默认true. tells HBase whether to start/stop the ZooKeeper quorum servers alongside the rest of the servers.</font>
<font face="Courier New">5:让HBase看到Hadoop的<em>HDFS client configuration</em> </font>
<font face="Courier New">HADOOP_CONF_DIR</font>
to <font face="Courier New">CLASSPATH</font>
in <font face="Courier New">hbase-env.sh</font>
. Add a copy of <font face="Courier New">hdfs-site.xml</font>
(or <font face="Courier New">hadoop-site.xml</font>
) to <font face="Courier New">${HBASE_HOME}/conf</font>
, or if only a small set of HDFS client configurations, add them to <font face="Courier New">hbase-site.xml</font>
. 此功能很重要,比如Hadoop指定了replication是2,如果不按照上面的操作,则Hbase不会跟Hadoop一致。
HBase默认的replication是3
cd /home/iic/hbase-0.20.3
vi conf/hbase-env.sh
export HBASE_CLASSPATH=/home/iic/hadoop-0.20.2
<font face="Courier New">启动Hbase集群</font>
<font face="Courier New">/home/iic/hbase-0.20.3</font>
<font face="Courier New">启动后,日志hbase-iic-master-webdev.log出现错误:</font>
<font face="Courier New">Caused by: java.lang.IllegalArgumentException: Wrong FS: hdfs://192.168.2.79:9000/hbase, expected: hdfs://webdev:9000<br>修改:hbase-site.xml</font>
重启后,还是出错:
尝试把“hbase.zookeeper.quorum”的IP“192.168.2.79,192.168.5.11”,改为机器名“webdev,TEST-A”
在/etc/hosts中互相添加映射
192.168.2.79 webdev
192.168.5.11 TEST-A
重启后,5.11的zookeeper日志出现错误:org.apache.zookeeper.KeeperException$NodeExistsException: KeeperErrorCode = NodeExists