三台服务器:
192.168.15.5 master
192.168.15.6 node2
192.168.15.7 node2
在每台服务器的host中添加:
192.168.15.5 master
192.168.15.6 node2
192.168.15.7 node2
随便在某一台上如:192.168.15.5
解压zookeeper压缩文件:
tar –zxvf zookeeper-3.4.8.tar.gz
配置环境变量:
#zookeeper
export ZOOKEEPER=/usr/tools/zookeeper-3.4.8
export PATH=$PATH:$ZOOKEEPER/bin
使修改生效:
source /etc/profile
到zookeeper的conf目录下面,新增一个zoo.cfg文件
dataDir=/usr/tools/zookeeper-3.4.8/data
添加:
server.1=master:2888:3888
server.2=node1:2888:3888
server.3=node2:2888:3888
cd 到安装目录,找到data 目录,新建myid 并填入数字 (1)与server对应
配置完以后将上述内容全部拷贝到另外两台服务的相同位置
使用scp
scp -r /usr/tools/zookeeper-3.4.8 root@node1:/usr/tools/
scp -r /usr/tools/zookeeper-3.4.8 root@node2:/usr/tools/
cd 到安装目录,找到data 目录,修改myid与server对应
/etc/profile环境变了也可以用scp来完成,或者可以各自修改成一致的
三台分别启动zookeeper
zkServer.sh start
每台机器上查看状态:
zkServer.sh status
结果:
ZooKeeper JMX enabled by default
Using config: /usr/tools/zookeeper-3.4.8/bin/../conf/zoo.cfg
Mode: follower
使用jps查看:
jps
结果
QuorumPeerMain
在某一台上解压hbase的压缩文件,如在192.168.15.5
tar –zxvf hbase-1.2.0-bin.tar.gz
配置添加环境变量:
#hbase
export HBASE_HOME=/usr/tools/hbase-1.2.3
exportPATH=$PATH:$HBASE_HOME/bin
使环境变量生效
source /etc/profile
进入hbase的conf目录,需要修改三个文件:hbase-env.sh、hbase-site.xml和regionservers
其中hbase-env.sh中,在文档的十多行位置处添加:
# The java implementation to use. Java 1.7+ required.
# export JAVA_HOME=/usr/java/jdk1.6.0/
exportJAVA_HOME=/usr/tools/jdk1.8.0_73
# Extra Java CLASSPATH elements. Optional.
# export HBASE_CLASSPATH=
然后在后面添加:
# Seconds to sleep between slavecommands. Unset by default. This
# can be useful in large clusters, where,e.g., slave rsyncs can
# otherwise arrive faster than the mastercan service them.
# export HBASE_SLAVE_SLEEP=0.1
# Tell HBase whether it should manage it'sown instance of Zookeeper or not.
exportHBASE_MANAGES_ZK=false
hbase-site.xml中
The directory where thesnapshot is stored.
false: standalone andpseudo-distributed setups with managed Zookeeper
true: fully-distributed withunmanaged Zookeeper Quorum (see hbase-env.sh)
regionservers文件中添加各个从属服务器的ip或者hostname:
master
node1
node2
保存后分别把hbase的整个文件夹拷贝到其他服务器:
scp -r /usr/tools/hbase-1.2.3 root@node1:/usr/tools/
scp –r /usr/tools/hbase-1.2.3 root@node2:/usr/tools/
在hadoop的namenode节点上启动hbase服务
start-hbase.sh
启动后:jps
HRegionServer
HMaster
子节点
HRegionServer
启动顺序
Hadoop-hdfs-------》hadoop-yarn------》zookeeper------》hbase