Zookeeper 使用中出现的错误排查
启动
错误日志-01
2022-04-03 16:00:12.139 ERROR 21600 --- [p-nio-80-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://payment-service/payment/zk": connect timed out; nested exception is java.net.SocketTimeoutException: connect timed out] with root cause
java.net.SocketTimeoutException: connect timed out
解决方案如下:
- 查看 linux 服务器上防火墙是否关闭,或者开放该 2181 端口
- 如在虚拟机安装的zookeeper,查看本机是否能ping通 linux 服务器IP和端口,cmd命令:telnet 192.168.15.130 2181
- 如win10本机有防火墙,检查是否关闭防火墙,或者防火墙开放端口
- 如使用 RestTemplate 作为客户端访问zookeeper服务,确认是否已在RestTemplate配置类上添加注解:@LoadBalanced