We are attempting to upgrade from Kafka 0.8.0, which includes ZK 3.3.4 to
Kafka 0.8.2.1 with ZK 3.4.6. My code which attempts to connect to ZK is
pretty straightforward:
try {
ZooKeeper zk = new ZooKeeper(connectString, sessionTimeout
, this);
int connectAttempts = 0;
while (!zk.getState().isConnected() && connectAttempts <
MAX_ZK_CONNECT_ATTEMPTS) {
try {
Thread.sleep(ZK_CONNECT_WAIT);
} catch (InterruptedException e) {
// Ignore
}
connectAttempts++;
}
} catch (IOException e) {
trace.exception(CLASS_NAME, methodName, e);
}
With some additional tracing, States is always CONNECTING. Has something
changed with 3.4.6 about how I should connect to the server? I can
connect just fine with the zookeeper-shell.sh that Kafka ships. This code
always runs on the same system as ZK, so the connectString is always
"localhost:2181"
Chris