zookeeper启动时,出现如下情况:
====== zookeeper node1 启动 ==========
[root conf]# zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
====== zookeeper node2 启动 ==========
[root ~]# zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
====== zookeeper node3启动 ==========
[root ~]# zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
显示JMX是默认关闭的
通过jps命令查看进程时,没有QuorumPeerMain这个进程
网上有很多方法,有说关闭防火墙的,
也有说把命令改成 ./zkServer.sh start
[root bin]# ./zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root bin]# ./zkServer.sh status
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.6/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
我都尝试过,和上面效果一样,均无法启动(可能每一个人的解决办法都不一样)
解决方案
在 zkServer.sh 文件的开头部分,加上jdk环境变量信息
找到zkServer.sh文件,就找安装的zookeeper路径的bin目录下
[root ~]# cd /usr/local/zookeeper-3.4.6/bin
[root bin]# ls
README.txt zkCli.cmd zkEnv.cmd zkServer.cmd zookeeper.out
zkCleanup.sh zkCli.sh zkEnv.sh zkServer.sh
[root bin]# vi zkServer.sh
添加JAVA_HOME的环境变量(这里要自己去查看自己配置的)
export JAVA_HOME=/usr/java/jdk1.8.0_281-amd64
export PATH=$JAVA_HOME/bin:$PATH
node1、node2、node3都进行添加
然后刷新语句变量:
source /etc/profile
再次输入启动zkServer.sh,查看开启状态
[root conf]# zkServer.sh start
[root conf]# zkServer.sh status
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.6/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
文章来源:https://www.toymoban.com/news/detail-788938.html
重新运行脚本,查看jps,就可以找到QuorumPeerMain进程
同样的错误,每个人的解决方式可能不一样,但是我用这中方式成功启动ZooKeeper集群文章来源地址https://www.toymoban.com/news/detail-788938.html
到了这里,关于zookeeper 启动失败,报错 “ZooKeeper JMX enabled by default”的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!