准备环境 jdk-1.8.0
[root@T-DMP02-10 config]# java -version java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
1、准备安装包zookeeper-3.4.14.tar.gz,解压
[root@T-DMP02-10 data]# tar zxf zookeeper-3.4.14.tar.gz [root@T-DMP02-10 data]# cd zookeeper-3.4.14/config [root@T-DMP02-10 conf]# cp zoo_sample.cfg zoo.cfg [root@T-DMP02-10 conf]# vim zoo.cfg tickTime=2000 initLimit=10 syncLimit=5 dataDir=/data/zookeeper-3.4.14/data maxClientCnxns=1000 clientPort=2181 #集群模式需要指定以下server server.1=ip1:2888:3888 server.2=ip2:2888:3888 server.3=ip3:2888:3888
[root@T-DMP02-10 zookeeper-3.4.14]# mkdir data #集群模式下需要在每台添加,zookeeper的数据目录中创建自己的myid对应1-3 [root@T-DMP02-10 zookeeper-3.4.14]# cat data/myid 1
2、启动zk
[root@T-DMP02-10 ]# cd /data/zookeeper-3.4.14/bin/ [root@T-DMP02-10 bin]# ./zkServer.sh start [root@T-DMP02-10 bin]# jps 192852 QuorumPeerMain 195045 Jps