前提环境:确保系统已安装JDK

下载 Zookeeper 安装包

在《Kafka权威指南》下载包是未编译的…  记得选带bin包 😄

带 bin 是已编译的

Zookeeper 安装及配置

具体步骤如下:

wget xxxx链接xxxx

tar -zxf apache-zookeeper-3.7.0-bin.tar.gz

mv apache-zookeeper-3.7.0-bin /usr/local/zookeeper

cp /usr/local/zookeeper/conf/zoo_sample.cfg /usr/local/zookeeper/conf/zoo.cfg

vim /usr/local/zookeeper/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/var/lib/zookeeper
dataLogDir=/var/lib/zookeeper/logs
clientPort=2181
server.1=192.168.1.154:2888:3888
server.2=192.168.1.156:2888:3888
server.3=192.168.1.157:2888:3888

/usr/local/zookeeper/bin/zkServer.sh start
/opt/jdk_8u271/bin/java
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

echo "1" > /var/lib/zookeeper/myid
echo "2" > /var/lib/zookeeper/myid
echo "3" > /var/lib/zookeeper/myid