TRIERR 2022-08-25 20:55 采纳率: 25%
浏览 70
已结题

Error contacting service. It is probably not running.

问题遇到的现象和发生背景

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

  • 写回答

2条回答 默认 最新

  • Java智慧阁 2022-08-25 21:52
    关注

    执行一下./zkServer.sh start-foreground 截图看看

    基于上述排查了部分,还有可能是:
    1.zoo.cfg文件中主机名出错;
    2.hosts文件中,本机的主机名有两个对应,只需保留主机名和ip地址的映射

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 9月3日
  • 已采纳回答 8月26日
  • 赞助了问题酬金10元 8月25日
  • 创建了问题 8月25日

悬赏问题

  • ¥15 删除虚拟显示器驱动 删除所有 Xorg 配置文件 删除显示器缓存文件 重启系统 可是依旧无法退出虚拟显示器
  • ¥15 vscode程序一直报同样的错,如何解决?
  • ¥15 关于使用unity中遇到的问题
  • ¥15 开放世界如何写线性关卡的用例(类似原神)
  • ¥15 关于并联谐振电磁感应加热
  • ¥60 请查询全国几个煤炭大省近十年的煤炭铁路及公路的货物周转量
  • ¥15 请帮我看看我这道c语言题到底漏了哪种情况吧!
  • ¥66 如何制作支付宝扫码跳转到发红包界面
  • ¥15 pnpm 下载element-plus
  • ¥15 解决编写PyDracula时遇到的问题