org.apache.curator.ConnectionState连接字符串的连接超时

时间:2018-06-26 21:15:59

标签: solr apache-zookeeper

我一直在面对由Zookeeper管理的Solr实例的此问题。

Zookeeper似乎能够将请求发送到Zookeeper,Zookeeper会暂时接受请求,然后拒绝它。

在Zookeeper日志中,我一直看到此错误:

INFO  org.apache.zookeeper.ZooKeeper.Client.environment:user.dir=/ [1635628661@qtp-2049348234-50]
INFO  org.apache.zookeeper.ZooKeeper  Initiating client connection, connectString=localhost:2181 sessionTimeout=150000 watcher=org.apache.curator.ConnectionState@c4f2fbd [1635628661@qtp-2049348234-50]
INFO  org.apache.zookeeper.ClientCnxn  Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) [1635628661@qtp-2049348234-50-SendThread(localhost:2181)]
INFO  org.apache.zookeeper.ClientCnxn  Socket connection established to localhost/127.0.0.1:2181, initiating session [1635628661@qtp-2049348234-50 SendThread(localhost:2181)]
ERROR org.apache.curator.ConnectionState  Connection timed out for connection string (localhost:2181) and timeout (15000) / elapsed (15290) [1635628661@qtp-204934823450]
org.apache.curator.CuratorConnectionLossException: KeeperErrorCode = ConnectionLoss
at org.apache.curator.ConnectionState.checkTimeouts(ConnectionState.java:191)
at org.apache.curator.ConnectionState.getZooKeeper(ConnectionState.java:86)
at org.apache.curator.CuratorZookeeperClient.getZooKeeper(CuratorZookeeperClient.java:113)
at org.apache.curator.framework.imps.CuratorFrameworkImpl getZooKeeper(CuratorF

在这里感谢您的任何帮助。

1 个答案:

答案 0 :(得分:0)

根据日志,您已在localhost:2181上打开套接字,因此行:

INFO  org.apache.zookeeper.ClientCnxn  Socket connection established to localhost/127.0.0.1:2181, initiating session [1635628661@qtp-2049348234-50 SendThread(localhost:2181)]

状态是否正常,我们找到了一个打开的套接字,现在我们尝试写入一些数据。并发送连接请求,发送会话ID和密码。如果尚未建立会话-它将发送0作为会话ID,但发送密码

如果启用调试输出,则会在日志中看到类似

的内容
Session establishment request sent on <remote address>

记录您询问的记录-

ERROR org.apache.curator.ConnectionState  Connection timed out for connection string (localhost:2181) and timeout (15000) / elapsed (15290) [1635628661@qtp-204934823450]

与策展人本身有关。如果客户端未连接-则调用checkTimeout(),并且如果检查超时结果为“ CONNECTION_TIMEOUT”,则会生成上述记录。

信息不多,但我尝试猜测您的本地主机上有zookeper,但连接被拒绝,可能是需要密码或其他原因。

希望这会有所帮助。

(我的回答基于此处的主编者代码-> https://github.com/apache/curator