目录
1.下载
2.解压
3.修改配置
4.启动
官网下载地址:https://zookeeper.apache.org/releases.html
我这里选择的是3.6.3版本
[root@iZm5e452n3se0jvpdlgbdpZ home]# wget https://downloads.apache.org/zookeeper/zookeeper-3.6.3/apache-zookeeper-3.6.3-bin.tar.gz
[root@iZm5e452n3se0jvpdlgbdpZ home]# tar -zxvf apache-zookeeper-3.6.3-bin.tar.gz [root@iZm5e452n3se0jvpdlgbdpZ home]# mv apache-zookeeper-3.6.3-bin /usr/local/zookeeper
解压并移动到/usr/local文件夹下
进入zookeeper下conf文件夹,复制zoo_sample文件一份,重命名为zoo.cfg
[root@iZm5e452n3se0jvpdlgbdpZ /]# cd /usr/local/zookeeper/conf/ [root@iZm5e452n3se0jvpdlgbdpZ conf]# cp zoo_sample.cfg zoo.cfg
修改dataDir=/usr/local/zookeeper/data
dataLogDir=/usr/local/zookeeper/logs
#创建data和logs文件夹 [root@iZm5e452n3se0jvpdlgbdpZ zookeeper]# cd .. [root@iZm5e452n3se0jvpdlgbdpZ zookeeper]# mkdir data [root@iZm5e452n3se0jvpdlgbdpZ zookeeper]# mkdir logs
[root@iZm5e452n3se0jvpdlgbdpZ bin]# cd bin [root@iZm5e452n3se0jvpdlgbdpZ bin]# ./zkServer.sh start ZooKeeper JMX enabled by default Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg Starting zookeeper ... STARTED -------------------- #启动成功,查看zookeeper进程 [root@iZm5e452n3se0jvpdlgbdpZ bin]# ps -ef|grep zookeeper root 21440 1 1 16:50 pts/2 00:00:01 /usr/java/jdk1.8.0_131/bin/java -Dzookeeper.log.dir=/usr/local/zookeeper/bin/../logs -Dzookeeper.log.file=zookeeper-root-server-iZm5e452n3se0jvpdlgbdpZ.log -Dzookeeper.root.logger=INFO,CONSOLE -XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError=kill -9 %p -cp /usr/local/zookeeper/bin/../zookeeper-server/target/classes:/usr/local/zookeeper/bin/../build/classes:/usr/local/zookeeper/bin/../zookeeper-server/target/lib/*.jar:/usr/local/zookeeper/bin/../build/lib/*.jar:/usr/local/zookeeper/bin/../lib/zookeeper-prometheus-metrics-3.6.3.jar:/usr/local/zookeeper/bin/../lib/zookeeper-jute-3.6.3.jar:/usr/local/zookeeper/bin/../lib/zookeeper-3.6.3.jar:/usr/local/zookeeper/bin/../lib/snappy-java-1.1.7.jar:/usr/local/zookeeper/bin/../lib/slf4j-log4j12-1.7.25.jar:/usr/local/zookeeper/bin/../lib/slf4j-api-1.7.25.jar:/usr/local/zookeeper/bin/../lib/simpleclient_servlet-0.6.0.jar:/usr/local/zookeeper/bin/../lib/simpleclient_hotspot-0.6.0.jar:/usr/local/zookeeper/bin/../lib/simpleclient_common-0.6.0.jar:/usr/local/zookeeper/bin/../lib/simpleclient-0.6.0.jar:/usr/local/zookeeper/bin/../lib/netty-transport-native-unix-common-4.1.63.Final.jar:/usr/local/zookeeper/bin/../lib/netty-transport-native-epoll-4.1.63.Final.jar:/usr/local/zookeeper/bin/../lib/netty-transport-4.1.63.Final.jar:/usr/local/zookeeper/bin/../lib/netty-resolver-4.1.63.Final.jar:/usr/local/zookeeper/bin/../lib/netty-handler-4.1.63.Final.jar:/usr/local/zookeeper/bin/../lib/netty-common-4.1.63.Final.jar:/usr/local/zookeeper/bin/../lib/netty-codec-4.1.63.Final.jar:/usr/local/zookeeper/bin/../lib/netty-buffer-4.1.63.Final.jar:/usr/local/zookeeper/bin/../lib/metrics-core-3.2.5.jar:/usr/local/zookeeper/bin/../lib/log4j-1.2.17.jar:/usr/local/zookeeper/bin/../lib/json-simple-1.1.1.jar:/usr/local/zookeeper/bin/../lib/jline-2.14.6.jar:/usr/local/zookeeper/bin/../lib/jetty-util-ajax-9.4.39.v20210325.jar:/usr/local/zookeeper/bin/../lib/jetty-util-9.4.39.v20210325.jar:/usr/local/zookeeper/bin/../lib/jetty-servlet-9.4.39.v20210325.jar:/usr/local/zookeeper/bin/../lib/jetty-server-9.4.39.v20210325.jar:/usr/local/zookeeper/bin/../lib/jetty-security-9.4.39.v20210325.jar:/usr/local/zookeeper/bin/../lib/jetty-io-9.4.39.v20210325.jar:/usr/local/zookeeper/bin/../lib/jetty-http-9.4.39.v20210325.jar:/usr/local/zookeeper/bin/../lib/javax.servlet-api-3.1.0.jar:/usr/local/zookeeper/bin/../lib/jackson-databind-2.10.5.1.jar:/usr/local/zookeeper/bin/../lib/jackson-core-2.10.5.jar:/usr/local/zookeeper/bin/../lib/jackson-annotations-2.10.5.jar:/usr/local/zookeeper/bin/../lib/commons-cli-1.2.jar:/usr/local/zookeeper/bin/../lib/audience-annotations-0.5.0.jar:/usr/local/zookeeper/bin/../zookeeper-*.jar:/usr/local/zookeeper/bin/../zookeeper-server/src/main/resources/lib/*.jar:/usr/local/zookeeper/bin/../conf:.:/usr/java/jdk1.8.0_131/lib/dt.jar:/usr/java/jdk1.8.0_131/lib/tools.jar -Xmx1000m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /usr/local/zookeeper/bin/../conf/zoo.cfg