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

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 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘