Linux安装zookeeper

1:将zookeeper压缩包上传到/ustr/local/mysoft目录下

Linux安装zookeeper

2:cd /usr/local/mysoft/  进入mysoft目录

[ bin]# cd /usr/local/mysoft/
[ 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压缩包

[ mysoft]# tar -zxvf zookeeper-3.4.6.tar.gz 
[ 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目录

[ mysoft]# cd zookeeper-3.4.6/conf/
[ conf]# ls
configuration.xsl  log4j.properties  zoo_sample.cfg

5: mv zoo_sample.cfg zoo.cfg   将zoo_sample.cfg 文件重命名为zoo.cfg

[ conf]# mv zoo_sample.cfg zoo.cfg 
[ conf]# ls
configuration.xsl  log4j.properties  zoo.cfg

6:进入zookeeper目录下的bin目录

[ conf]# cd /usr/local/mysoft/zookeeper-3.4.6/bin/
[ 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 )

[ 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已经开启

[ 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防火墙拦截了,需要关闭防火墙

相关推荐