1:将zookeeper压缩包上传到/ustr/local/mysoft目录下
2:cd /usr/local/mysoft/ 进入mysoft目录
[root@localhost bin]# cd /usr/local/mysoft/ [root@localhost mysoft]# ls apache-maven-3.5.4 apache-tomcat-7.0.93 jdk1.8.0_212 mysql redis-4.0.9 zookeeper-3.4.6.tar.gz
3:tar -zxvf zookeeper-3.4.6.tar.gz 解压zookeeper压缩包
[root@localhost mysoft]# tar -zxvf zookeeper-3.4.6.tar.gz
[root@localhost mysoft]# ls
apache-maven-3.5.4 apache-tomcat-7.0.93 jdk1.8.0_212 mysql redis-4.0.9 zookeeper-3.4.6 zookeeper-3.4.6.tar.gz
4:进入解压后的zookeeper目录下的conf目录
[root@localhost mysoft]# cd zookeeper-3.4.6/conf/
[root@localhost conf]# ls
configuration.xsl log4j.properties zoo_sample.cfg
5: mv zoo_sample.cfg zoo.cfg 将zoo_sample.cfg 文件重命名为zoo.cfg
[root@localhost conf]# mv zoo_sample.cfg zoo.cfg
[root@localhost conf]# ls
configuration.xsl log4j.properties zoo.cfg
6:进入zookeeper目录下的bin目录
[root@localhost conf]# cd /usr/local/mysoft/zookeeper-3.4.6/bin/
[root@localhost bin]# ls
README.txt zkCleanup.sh zkCli.cmd zkCli.sh zkEnv.cmd zkEnv.sh zkServer.cmd zkServer.sh zookeeper.out
7:./zkServer.sh start 开启zookeeper服务( ./zkServer.sh stop 关闭zookeeper )
[root@localhost bin]# ./zkServer.sh start JMX enabled by default Using config: /usr/local/mysoft/zookeeper-3.4.6/bin/../conf/zoo.cfg Starting zookeeper ... STARTED
8:./zkServer.sh status 查看zookeeper状态,如果出现如下内容,说明你的zookeeper已经开启
[root@localhost bin]# ./zkServer.sh status JMX enabled by default Using config: /usr/local/mysoft/zookeeper-3.4.6/bin/../conf/zoo.cfg Mode: standalone
9:systemctl stop firewalld.service 关闭防火墙,有时我们zookeeper已经开启,但程序运行时连接不到zookeeper,可能因为连接请求被Linux防火墙拦截了,需要关闭防火墙