单台安装篇
安装之前确保安装了java sdk环境
mkdir -p /usr/local/services/zookeeper
cd /usr/local/services/zookeeper
wget https://archive.apache.org/dist/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar.gz
tar -zxvf zookeeper-3.4.9.tar.gz
cd zookeeper-3.4.9
mdkir -p /data/zkdata
mkdir /usr/local/services/zookeeper/log
cp conf/zoo_sample.cfg conf/zoo.cfg
vim conf/zoo.cfg
修改 dataDir=/data/zkdata
追加 dataLogDir=/usr/local/services/zookeeper/log
vim /etc/profile
追加
export ZOOKEEPER_HOME=/usr/local/services/zookeeper/zookeeper-3.4.9/
export PATH=PATH
export PATH
source /etc/profile
zkServer.sh start
如果见到以下内容标识安装成功:
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
zkServer.sh status
zkServer.sh stop
zkServer.sh restart