一、配置 java 环境
apt install openjdk-8-jdk
java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
二、部署 ZooKeeper
官网下载地址:https://archive.apache.org/dist/zookeeper/
cd /usr/local/src
tar xvf zookeeper-3.4.14.tar.gz
ln -sv /usr/local/src/zookeeper-3.4.14 /usr/local/zookeeper
'/usr/local/zookeeper' -> '/usr/local/src/zookeeper-3.4.14'
cd /usr/local/zookeeper/conf/
cp zoo_sample.cfg zoo.cfg
grep ^[a-Z] zoo.cfg #当前配置
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/tmp/zookeeper
clientPort=2181
三、启动 ZooKeeper
/usr/local/zookeeper/bin/zkServer.sh 用于启动、重启、停止 ZooKeeper
/usr/local/zookeeper/bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
四、验证 Zookeeper 进程
ps -ef | grep zookeeper
五、验证 Zookeeper 状态
/usr/local/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: standalone