基于源码安装ZooKeeper

下载ZK代码

git clone https://github.com/apache/zookeeper.git
cd zookeeper
git checkout branch-3.8

设置环境变量

echo "export ZOOKEEPER_HOME=/root/code/java/zookeeper" >> /etc/profile
echo "export PATH=$PATH:$ZOOKEEPER_HOME/bin" >> /etc/profile
source /etc/profile

设置配置文件

cd conf
cp zoo_sample.cfg zoo.cfg
echo "dataDir=/root/code/java/zookeeper/data" >> zoo.cfg
echo "dataLogDir=/root/code/java/zookeeper/logs" >> zoo.cfg

Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain

安装Maven并编译

cd $ZOOKEEPER_HOME/zookeeper-server
mvn clean install -Dmaven.test.skip=true

启动ZK

cd $ZOOKEEPER_HOME/bin
./zkServer.sh start

 

posted on 2023-07-16 14:42  王景迁  阅读(39)  评论(0编辑  收藏  举报

导航