问题遇到的现象和发生背景
Error contacting service. It is probably not running.
问题相关代码,请勿粘贴截图
以下是zookeeper的zoo.cfg配置
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/opt/zookeeper/zkData
dataLogDir=/opt/zookeeper/zkLog
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true
zkData、和zkLog也都有
[root@localhost zookeeper]# ll
total 40
drwxr-xr-x. 2 guoz guoz 4096 Feb 25 2020 bin
drwxr-xr-x. 2 guoz guoz 4096 Aug 25 05:46 conf
drwxr-xr-x. 5 guoz guoz 4096 Feb 25 2020 docs
drwxr-xr-x. 2 root root 4096 Aug 19 05:23 lib
-rw-r--r--. 1 guoz guoz 11358 Feb 25 2020 LICENSE.txt
drwxr-xr-x. 2 root root 86 Aug 19 05:42 logs
-rw-r--r--. 1 guoz guoz 432 Feb 25 2020 NOTICE.txt
-rw-r--r--. 1 guoz guoz 1963 Feb 25 2020 README.md
-rw-r--r--. 1 guoz guoz 3166 Feb 25 2020 README_packaging.md
drwxr-xr-x. 3 root root 60 Aug 25 03:20 zkData
drwxr-xr-x. 3 root root 22 Aug 19 05:42 zkLog
防火墙也是关闭了的
[root@localhost bin]# systemctl stop firewalld.service
[root@localhost bin]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Thu 2022-08-25 03:33:57 PDT; 2h 17min ago
Docs: man:firewalld(1)
Process: 46802 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 46802 (code=exited, status=0/SUCCESS)
Aug 25 03:03:46 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Aug 25 03:03:47 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Aug 25 03:03:47 localhost.localdomain firewalld[46802]: WARNING: AllowZoneDrifting is enabled. This is conside...ow.
Aug 25 03:05:29 localhost.localdomain firewalld[46802]: WARNING: AllowZoneDrifting is enabled. This is conside...ow.
Aug 25 03:33:57 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
Aug 25 03:33:57 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.
但是启动时还是报错,究竟是什么问题呢?
运行结果及报错内容
[root@localhost bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Error contacting service. It is probably not running.
我的解答思路和尝试过的方法
网上的搜索方案基本丢失,检查防火墙,还有删除什么ID,也都尝试过,
有没有可能是安装MySQL导致的占用端口,因为之前先安装的zookeeper,可以正常启动,集群也能正常启动
但是在安装mysql后,不知道是不是这个原因
我想要达到的结果
如何才能正常启动zookeeper