zoo.cfg
# The number of milliseconds of each tick
tickTime=3000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
dataDir=/data/zookeeper-3.3.2/data
dataLogDir=/data/zookeeper-3.3.2/logs
# the port at which the clients will connect
clientPort=2181
server.1=xxx.xxx.xxx.193:2888:3888
server.2=xxx.xxx.xxx.194:2888:3888
server.3=xxx.xxx.xxx.221:2888:3888
安装好zookeeper后,安装hbase,配置hbase-site.xml,注意hbase.zookeeper.quorum的值必须是奇数个
hbase-site.xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://hostname:54310/hbase</value>
<description>The directory shared by RegionServers. must be hostname ,it will error if ip
</description>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
<description>The mode the cluster will be in. Possible values are
false: standalone and pseudo-distributed setups with managed Zookeeper
true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)
</description>
</property>
<property>
<name>dfs.support.append</name>
<value>true</value>
</property>
<property>
<name>hbase.master.port</name>
<value>60000</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/data/john/database1.0/zookeeper-3.3.2</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>xxx.xxx.xxx.193,xxx.xxx.xxx.194,xxx.xxx.xxx.221</value>
<description>the num of quorum must be odd</description>
</property>
</configuration>
hbase-env.sh中
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
<description>The mode the cluster will be in. Possible values are
false: standalone and pseudo-distributed setups with managed Zookeeper
true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)
</description>
</property>
让Hbase使用一个现有的不被Hbase托管的Zookeep集群,需要设置 conf/hbase-env.sh文件中的HBASE_MANAGES_ZK 属性为 false
export HBASE_MANAGES_ZK=false
启动Hadoop,启动hbase,
启动hbase步骤:
1. 首先启动zookeeper:bin/hbase-daemon.sh start zookeeper
2. jps一下,看是否有HQuorumPeer进程,没有的话,请查看log解决问题
3. bin/start-hbase.sh
在hbase中新建了新的数据库,可以在hadoop环境下利用bin/hadoop fs -ls /hbase查看,可以查看到表的名称
要想知道表的结构,切换到hbase环境,bin/hbase shell 然后利用 describe 表名
在安装过程中的问题:
1. zookeeper节点启动不成功,查看状态后发现有not running,网上的说法是由于脚本中含有nc -q 1导致的,我在安装的过程中发现的解决的方式是:
在各节点的/etc/hosts文件中加入各节点的ip hostname,最终解决
2. 启动hbase不成功,call xxx.xxx.xxx194 xxx的信息,和mismatch异常的问题,是由于当初我选择的hadoop版本是0.20.203,后来换成0.21都不行,最终换成0.20.2问题解决(hbase0.90.5+hadoop0.20.2)
当然要将hbase中的lib里的hadoop-core-xxx.jar包替换成hadoop中的hadoop-core.jar
3. 重启hbase是,有台机器的HRegionServer没有启动起来,解决方案:查看一下60020端口是否被占用了,如果没有被占用了,那么同步一下各节点的系统时间,可能是系统时间不同步导致的;如果被占用了,杀死占用的进程,重启hbase,(基本上问题出在系统时间不同步上)
