openimsdk / openim-docker

openim-docker configuration for deploying OpenIM. Provides a build solution for a stable distribution, as well as a docker compose deployment strategy
https://openim.io
Apache License 2.0
39 stars 48 forks source link

Bug: After deploying and running sudo docker-compose logs openim-chat, I encountered an error: ! get zk config [16] error: zk: node does not exist. #24

Closed himym1 closed 7 months ago

himym1 commented 11 months ago

What happened?

"After deploying and running sudo docker-compose logs openim-chat, I encountered an error: ! get zk config [16] error: zk: node does not exist. What could be causing this issue?" ### What did you expect to happen? error: zk: node does not exist. ### How can we reproduce it (as minimally and precisely as possible)? Deploy according to the official documentation. ### Anything else we need to know? _No response_ ### version
```console $ {name} version # paste output here ```
### Cloud provider
### OS version
```console # On Linux: $ cat /etc/os-release # paste output here $ uname -a # paste output here # On Windows: C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture # paste output here ```
### Install tools
kvii commented 10 months ago

I got the same problem. In my case, I put mysql outside, but with a wrong role. That will cause openim-server to hang on when connecting mysql, and then timeout. So there is no node in zookeeper because openim-server did not start successfully.

中文大意: 我这边因为把 mysql 放外边了,并且访问权限配错了。导致 openim-server 连数据库的时候一直被挂起到超时。因此一直没有在 zookeeper 里注册。导致 chat 一直找不到 zookeeper 里的 node。

XiMTw commented 9 months ago

I got the same problem. In my case, I put mysql outside, but with a wrong role. That will cause openim-server to hang on when connecting mysql, and then timeout. So there is no node in zookeeper because openim-server did not start successfully.

中文大意: 我这边因为把 mysql 放外边了,并且访问权限配错了。导致 openim-server 连数据库的时候一直被挂起到超时。因此一直没有在 zookeeper 里注册。导致 chat 一直找不到 zookeeper 里的 node。

那需要怎么解决呢,我用的3.4依然有这个问题,

openim-chat  | ! get zk config [64] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [63] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [64] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [65] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [65] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [64] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [65] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [66] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [66] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [65] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [66] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [67] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [67] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [66] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [67] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [68] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [68] error: zk: node does not exist
openim-chat  |
openim-chat  | ! get zk config [67] error: zk: node does not exist
openim-chat  |
cubxxw commented 9 months ago

Could you please take a look at the address in the config.yaml file in the chat module to ensure its correctness? Additionally, would you mind checking the status logs of Kafka to see if everything is functioning properly? Lastly, it would be greatly appreciated if you could also verify if the openim-server logs indicate a successful startup. Thank you for your attention to these matters.

XiMTw commented 9 months ago

Could you please take a look at the address in the config.yaml file in the chat module to ensure its correctness? Additionally, would you mind checking the status logs of Kafka to see if everything is functioning properly? Lastly, it would be greatly appreciated if you could also verify if the openim-server logs indicate a successful startup. Thank you for your attention to these matters.

openim-chat config file

`cat openim-chat/release-v1.4/config/config.yaml

Copyright © 2023 OpenIM. All rights reserved.

#

Licensed under the Apache License, Version 2.0 (the "License");

you may not use this file except in compliance with the License.

You may obtain a copy of the License at

#

http://www.apache.org/licenses/LICENSE-2.0

#

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

Configuration for OpenIMServer

-----------------------------------------------------------------

TODO: This config file is the template file

--| source: deployments/templates/chat.yaml

--| env: scripts/install/environment

--| target: config/config.yaml

-----------------------------------------------------------------

envs: discovery: "zookeeper"

###################### Zookeeper ######################

Zookeeper configuration

It's not recommended to modify the schema

zookeeper: schema: openim zkAddr:

###################### Chat API ###################### chatApi: openImChatApiPort: [ 10008 ] listenIP: ''

###################### Admin API ###################### adminApi: openImAdminApiPort: [ 10009 ] listenIP: ''

###################### RPC ###################### rpc: registerIP: #作为rpc启动时,注册到zookeeper的IP,api/gateway能访问到此ip和对应的rpcPort中的端口 listenIP: #默认为0.0.0.0

rpcPort: openImAdminPort: [ 30200 ] openImChatPort: [ 30300 ] rpcRegisterName: openImAdminName: admin openImChatName: chat

###################### MySQL ###################### mysql:

address: [ 127.0.0.1:13306 ] #目前仅支持单机

username: root #用户名

password: openIM123 #密码

database: openIM_v2 #不建议修改

maxOpenConn: 1000 #最大连接数

maxIdleConn: 100 #最大空闲连接数

maxLifeTime: 60 #连接可以重复使用的最长时间(秒)

logLevel: 4 #日志级别 1=slient 2=error 3=warn 4=info

slowThreshold: 500 #慢语句阈值 (毫秒)

database: openim_enterprise

###################### Log ###################### log: storageLocation: ../logs/ #存放目录

rotationTime: 24 #日志旋转时间

remainRotationCount: 2 #日志数量

remainLogLevel: 6 #日志级别 6表示全都打印,

isStdout: false

isJson: false

withStack: false

###################### Secret & Token Policy ######################

secret: openIM123

tokenPolicy:

expire: 86400

###################### Verify Code ###################### verifyCode: validTime: 300 # 验证码有效时间 validCount: 5 # 验证码有效次数 uintTime: 86400 # 单位时间间隔 maxCount: 10 # 单位时间内最大获取次数 superCode: "666666" # 超级验证码(只有use为空时使用) len: 6 # 验证码长度 use: "" # 使用的验证码服务(use: "ali") ali: endpoint: "dysmsapi.aliyuncs.com" accessKeyId: "" accessKeySecret: "" signName: "" verificationCodeTemplateCode: "" mail: # 根据对应的发件邮箱更改 sendMail、senderAuthorizationCode、smtpAddr、smtpPort 即可 title: "" senderMail: "" # 发送者 senderAuthorizationCode: "" # 授权码 smtpAddr: "smtp.qq.com" # smtp 服务器地址 smtpPort: 25 # smtp 服务器邮件发送端口 testDepartMentID: 001 imAPIURL: http://127.0.0.1:10002

###################### Proxy Header ######################

获取ip的header,没有配置直接获取远程地址

proxyHeader: "X-Forwarded-For"

###################### Admin List ###################### adminList:

###################### OpenIM URL ######################

TODO

openIMUrl: "http://172.28.0.1:10002"

###################### Redis ###################### redis:

address: [ 127.0.0.1:16379 ]

username:

password: openIM123`

#Kafka Log
```ced7640b23b8   bitnami/kafka:3.5.1                            "/opt/bitnami/script…"   34 minutes ago   Up 34 minutes               0.0.0.0:19094->9092/tcp, :::19094->9092/tcp                                              kafka```

kafka | (kafka.server.KafkaConfig) kafka | [2023-11-21 18:43:04,048] INFO [BrokerLifecycleManager id=0] The broker is in RECOVERY. (kafka.server.BrokerLifecycleManager) kafka | [2023-11-21 18:43:04,052] INFO [BrokerServer id=0] Waiting for the broker to be unfenced (kafka.server.BrokerServer) kafka | [2023-11-21 18:43:04,053] INFO [QuorumController id=0] The request from broker 0 to unfence has been granted because it has caught up with the offset of its register broker record 950. (org.apache.kafka.controller.BrokerHeartbeatManager) kafka | [2023-11-21 18:43:04,088] INFO [BrokerLifecycleManager id=0] The broker has been unfenced. Transitioning from RECOVERY to RUNNING. (kafka.server.BrokerLifecycleManager) kafka | [2023-11-21 18:43:04,088] INFO [BrokerServer id=0] Finished waiting for the broker to be unfenced (kafka.server.BrokerServer) kafka | [2023-11-21 18:43:04,088] INFO [SocketServer listenerType=BROKER, nodeId=0] Enabling request processing. (kafka.network.SocketServer) kafka | [2023-11-21 18:43:04,089] INFO Awaiting socket connections on 0.0.0.0:9094. (kafka.network.DataPlaneAcceptor) kafka | [2023-11-21 18:43:04,090] INFO Awaiting socket connections on 0.0.0.0:9092. (kafka.network.DataPlaneAcceptor) kafka | [2023-11-21 18:43:04,095] INFO [BrokerServer id=0] Waiting for all of the authorizer futures to be completed (kafka.server.BrokerServer) kafka | [2023-11-21 18:43:04,095] INFO [BrokerServer id=0] Finished waiting for all of the authorizer futures to be completed (kafka.server.BrokerServer) kafka | [2023-11-21 18:43:04,095] INFO [BrokerServer id=0] Waiting for all of the SocketServer Acceptors to be started (kafka.server.BrokerServer) kafka | [2023-11-21 18:43:04,095] INFO [BrokerServer id=0] Finished waiting for all of the SocketServer Acceptors to be started (kafka.server.BrokerServer) kafka | [2023-11-21 18:43:04,095] INFO [BrokerServer id=0] Transition from STARTING to STARTED (kafka.server.BrokerServer) kafka | [2023-11-21 18:43:04,096] INFO Kafka version: 3.5.1 (org.apache.kafka.common.utils.AppInfoParser) kafka | [2023-11-21 18:43:04,096] INFO Kafka commitId: 2c6fb6c54472e90a (org.apache.kafka.common.utils.AppInfoParser) kafka | [2023-11-21 18:43:04,096] INFO Kafka startTimeMs: 1700563384095 (org.apache.kafka.common.utils.AppInfoParser) kafka | [2023-11-21 18:43:04,097] INFO [KafkaRaftServer nodeId=0] Kafka Server started (kafka.server.KafkaRaftServer) kafka | latestMsgToRedis kafka | msgToPush kafka | offlineMsgToMongoMysql kafka | [2023-11-21 18:43:11,692] INFO [QuorumController id=0] CreateTopics result(s): CreatableTopic(name='latestMsgToRedis', numPartitions=8, replicationFactor=1, assignments=[], configs=[]): TOPIC_ALREADY_EXISTS (Topic 'latestMsgToRedis' already exists.) (org.apache.kafka.controller.ReplicationControlManager) kafka | Error while executing topic command : Topic 'latestMsgToRedis' already exists. kafka | [2023-11-21 18:43:11,761] ERROR org.apache.kafka.common.errors.TopicExistsException: Topic 'latestMsgToRedis' already exists. kafka | (kafka.admin.TopicCommand$) kafka | [2023-11-21 18:43:17,675] INFO [QuorumController id=0] CreateTopics result(s): CreatableTopic(name='msgToPush', numPartitions=8, replicationFactor=1, assignments=[], configs=[]): TOPIC_ALREADY_EXISTS (Topic 'msgToPush' already exists.) (org.apache.kafka.controller.ReplicationControlManager) kafka | Error while executing topic command : Topic 'msgToPush' already exists. kafka | [2023-11-21 18:43:17,690] ERROR org.apache.kafka.common.errors.TopicExistsException: Topic 'msgToPush' already exists. kafka | (kafka.admin.TopicCommand$) kafka | [2023-11-21 18:43:23,343] INFO [QuorumController id=0] CreateTopics result(s): CreatableTopic(name='offlineMsgToMongoMysql', numPartitions=8, replicationFactor=1, assignments=[], configs=[]): TOPIC_ALREADY_EXISTS (Topic 'offlineMsgToMongoMysql' already exists.) (org.apache.kafka.controller.ReplicationControlManager) kafka | Error while executing topic command : Topic 'offlineMsgToMongoMysql' already exists. kafka | [2023-11-21 18:43:23,401] ERROR org.apache.kafka.common.errors.TopicExistsException: Topic 'offlineMsgToMongoMysql' already exists. kafka | (kafka.admin.TopicCommand$) kafka | Topics created. kafka | [2023-11-21 18:53:23,414] INFO [BrokerToControllerChannelManager id=0 name=forwarding] Node 0 disconnected. (org.apache.kafka.clients.NetworkClient)

# openim-server logs

openim-server | Zookeeper starts successfully openim-server | Kafka starts successfully openim-server | All components started successfully! openim-server | openim-server | ## Starting OpenIM services openim-server | +++ [1121 18:43:04] Starting script: openim-api.sh openim-server | ++ OPENIM_API_SERVICE_LISTARIES: openim-api openim-server | ++ OPENIM_API_PORT_LISTARIES: 10002 openim-server | ++ OpenIM API config path: /openim/openim-server/config/ openim-server | Starting openim-api ... openim-server | +------------------------+--------------+ openim-server | | Service Name | Port | openim-server | +------------------------+--------------+ openim-server | | openim-api | 10002 | openim-server | +------------------------+--------------+ openim-server | Stopping services on ports: 10002 openim-server | [success 1121 18:55:44] ==> All specified services were stopped. openim-server | OpenIM openim-api config path: /openim/openim-server/config/ openim-server | Starting openim-api service, port: 10002, binary root: /openim/openim-server/_output/bin/platforms/linux/amd64/openim-api openim-server | Checking ports: 10002 openim-server | openim-server | ### Started ports: openim-server | Port 10002 - Command: openim-api, PID: 7269, FD: 9, Started: Tue Nov 21 18:55:43 2023 openim-server | [success 1121 18:55:45] ==> All specified processes are running. openim-server | openim-api.sh executed successfully. openim-server | +++ [1121 18:55:45] Starting script: openim-rpc.sh openim-server | OPENIM_RPC_SERVICE_LISTARIES: openim-rpc-user openim-rpc-friend openim-rpc-msg openim-rpc-group openim-rpc-auth openim-rpc-conversation openim-rpc-third openim-server | OPENIM_RPC_PROM_PORT_LISTARIES: 20110 20120 20130 20150 20160 20230 21301 openim-server | OPENIM_RPC_PORT_LISTARIES: 10110 10120 10130 10150 10160 10180 10190 openim-server | Starting openim-rpc ... openim-server | +------------------------+-------+-----------------+ openim-server | | Service Name | Port | Prometheus Port | openim-server | +------------------------+-------+-----------------+ openim-server | | openim-rpc-user | 10110 | 20110 | openim-server | +------------------------+-------+-----------------+ openim-server | | openim-rpc-friend | 10120 | 20120 | openim-server | +------------------------+-------+-----------------+ openim-server | | openim-rpc-msg | 10130 | 20130 | openim-server | +------------------------+-------+-----------------+ openim-server | | openim-rpc-group | 10150 | 20150 | openim-server | +------------------------+-------+-----------------+ openim-server | | openim-rpc-auth | 10160 | 20160 | openim-server | +------------------------+-------+-----------------+ openim-server | | openim-rpc-conversation | 10180 | 20230 | openim-server | +------------------------+-------+-----------------+ openim-server | | openim-rpc-third | 10190 | 21301 | openim-server | +------------------------+-------+-----------------+ openim-server | Stopping services on ports: 10110 openim-server | [success 1121 19:08:31] ==> All specified services were stopped. openim-server | OpenIM openim-rpc-user config path: /openim/openim-server/config openim-server | Starting openim-rpc-user service, port: 10110, prometheus port: 20110, binary root: /openim/openim-server/_output/bin/platforms/linux/amd64/openim-rpc-user openim-server | Specifying prometheus port: 20110 openim-server | Stopping services on ports: 10120

cubxxw commented 9 months ago
openim-server  | Stopping services on ports: 10110
openim-server  | [success 1121 19:08:31] ==>  All specified services were stopped.
openim-server  | OpenIM openim-rpc-user config path: /openim/openim-server/config
openim-server  | Starting openim-rpc-user service, port: 10110, prometheus port: 20110, binary root: /openim/openim-server/_output/bin/platforms/linux/amd64/openim-rpc-user
openim-server  | Specifying prometheus port: 20110
openim-server  | Stopping services on ports: 10120

It seems that the status of openim-server is not correct. Could you please check by running the command "docker ps | grep openim"? Additionally, it would be helpful if you could provide more detailed logs. For example, you can navigate to the corresponding directory inside the container to inspect further. Thank you for your assistance.

XiMTw commented 9 months ago

Thanks for your help, I try restart ,is working for now, Thanks bro.

kubbot commented 7 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.