1.下载zookeeper-3.4.5.tar.gz, hbase-0.98.6-hadoop2-bin.tar.gz
2.上传到master的 /usr/local/src/目录下,解压zookeeper-3.4.5.tar.gz,hbase-0.98.6-hadoop2-bin.tar.gz
tar -zxvf zookeeper-3.4.5.tar.gz
tar -zxvf hbase-0.98.6-hadoop2-bin.tar.gz
3.进入zookeeper-3.4.5/conf目录,修改zookeeper的配置
cp zoo_sample.cfg zoo.cfg,zoo.cfg
[root@master conf]# cat zoo.cfg # The number of milliseconds of each tick tickTime=2000 # 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. # do not use /tmp for storage, /tmp here is just # example sakes. dataDir=/usr/local/src/zookeeper-3.4.5 # the port at which the clients will connect clientPort=2181 # # Be sure to read the maintenance section of the # administrator guide before turning on autopurge. # # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance # # The number of snapshots to retain in dataDir #autopurge.snapRetainCount=3 # Purge task interval in hours # Set to "0" to disable auto purge feature #autopurge.purgeInterval=1 server.0=master:8880:7770 server.1=slave1:8881:7771 server.2=slave2:8882:7772
然后在/usr/local/src/zookeeper-3.4.5目录下创建myid
myid 的配置如下
[root@master zookeeper-3.4.5]# cat myid 0
将/usr/local/src/zookeeper-3.4.5目录拷贝到slave1和slave2上
slave1的myid配置修改如下:
[root@slave1 zookeeper-3.4.5]# cat myid 1
slave1的myid配置修改如下:
[root@slave2 zookeeper-3.4.5]# cat myid 2
4.启动zookeeper,在三台机器上分别执行
cd /usr/local/src/zookeeper-3.4.5/
./bin/zkServer.sh start
查看状态
./bin/zkServer.sh status
5.进入到hbase的conf目录,配置hbase,
/usr/local/src/hbase-0.98.6-hadoop2/conf
修改环境变量配置, hbase-env.sh
export JAVA_HOME=/usr/local/src/jdk1.8.0_172/ export HBASE_MANAGES_ZK=false
修改 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>master,slave1,slave2</value> </property> <property> <name>hbase.master.maxclockskew</name> <value>150000</value> </property> </configuration>
修改regionservers,配置如下:
[root@master conf]# cat regionservers
slave1
slave2
将/usr/local/src/hbase-0.98.6-hadoop2/目录拷贝到slave1和slave2上
6.启动hbase
cd /usr/local/src/hbase-0.98.6-hadoop2/
./bin/start-hbase.sh
在主节点上看到HMaster进程,在从节点看到HRegionServer进程