1.关闭防火墙
service iptables stop
chkconfig iptables off
2.编辑hosts文件:
vi /etc/hosts
192.168.99.6 JacK6
192.168.99.7 JacK7
192.168.99.8 JacK8
tar -xvf zookeeper-3.5.0.tar.gz -C /data/hadoop/Zookeeper_3.5.0
mkdir -p /data/tmp_data/zookeeper/data
mkdir -p /data/tmp_data/zookeeper/logs
cd /data/hadoop/Zookeeper_3.5.0/conf/
cp zoo_sample.cfg zoo.cfg
vi 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=/data/tmp_data/zookeeper/data
dataLogDir=/data/tmp_data/zookeeper/logs
# the port at which the clients will connect
clientPort=2181
server.1=JacK6:2888:3888
server.2=JacK7:2888:3888
server.3=JacK8:2888:3888
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
cd ../..
scp -r Zookeeper_3.5.0 JacK7:/data/hadoop/
scp -r Zookeeper_3.5.0 JacK8:/data/hadoop/
cd /data/tmp_data/zookeeper/data/ 每台机器不一样
vi myid
#标识机器1为1
cd /data/hadoop/Zookeeper_3.5.0/bin/
sh zkServer.sh start
#三个节点都启动完之后在查看状态
ps -ef | grep zookeeper | grep -v grep
sh zkServer.sh status
JMX enabled by default
Using config: /data/hadoop/Zookeeper_3.5.0/bin/../conf/zoo.cfg
Mode: follower
JMX enabled by default
Using config: /data/hadoop/Zookeeper_3.5.0/bin/../conf/zoo.cfg
Mode: leader
sh zkServer.sh stop
hadoop@JacK6 bin]$ ./zkServer.sh start-foreground
JMX enabled by default
Using config: /data/hadoop/Zookeeper_3.5.0/bin/../conf/zoo.cfg
2017-10-23 21:07:00,452 [myid:] - INFO [main:QuorumPeerConfig@109] - Reading configuration from: /data/hadoop/Zookeeper_3.5.0/bin/../conf/zoo.cfg
2017-10-23 21:07:00,474 [myid:] - ERROR [main:QuorumPeerMain@86] - Invalid config, exiting abnormally
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Address unresolved: JacK6:3888
at org.apache.zookeeper.server.quorum.QuorumPeer$QuorumServer.(QuorumPeer.java:205)
at org.apache.zookeeper.server.quorum.flexible.QuorumMaj.(QuorumMaj.java:89)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.createQuorumVerifier(QuorumPeerConfig.java:401)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseDynamicConfig(QuorumPeerConfig.java:425)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:291)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:126)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:110)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:79)
Invalid config, exiting abnormally
因为有空格