0
私はZookeeperに接続するためにキュレーターを使用しています。飼育係が利用できない状況で、私は常にこのようなイベントを取得しています:キュレーターとZookeeperとの接続遅延を設定する方法は、1秒ごとにpingを実行しないのですか?
2016-09-29 12:54:22.831 INFO 43937 --- [localhost:2181)]
org.apache.zookeeper.ClientCnxn : Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2016-09-29 12:54:22.832 WARN 43937 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2016-09-29 12:54:23.940 INFO 43937 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2016-09-29 12:54:23.940 WARN 43937 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
私はそう頻繁に起こらないために、この動作を設定することができる場所を見つけることができません。 CuratorFramework
で設定できるRetryPolicy
は、初めてZookeeperに接続しようとしているときは考慮されていません。どんなアドバイスですか?私はスレッドが毎秒接続をチェックしないようにしたいと思いますが、それほど頻繁にはしませんし、理想的には指数ポリシーに適合させることもできます。
はい、私はそのクラスをデバッグしていましたが、実際にはパスではなく、コードが実行されました(ブール値のフラグisFirstConnectは「true」でした)。 〜1秒ごとに起こっている唯一の理由は、後で行われるネイティブpingコールです。 – dmydlarz