fix connect zookeeper slow for getHostName fail
Motivation
I met same issue with #14578, broker cannot start due to fail to connect to zookeeper with ConnectionLoss error, and zookeeper shell can connect but cost about 20s to finish the connection.
After some investigation, I found it's related with zk server host name resolver.
It happens when zookeeper connection is configed with IP address in broker.conf, and there is no host name configed for the IP address.
in zookeeper client, it will call InetSocketAddress.getHostName() when connecting to server and block for 20s in this condition. https://github.com/apache/zookeeper/blob/c94473d2a18b718495225c3497693b58591cd209/zookeeper-server/src/main/java/org/apache/zookeeper/SaslServerPrincipal.java#L59
Maybe it will cause broker got ConnectionLoss error.
Modifications
add Server Principal setting when create zookeeper client to avoid call InetSocketAddress.getHostName()
Documentation
- [x]
no-need-doc
Hi @eolivelli Could you help review this patch ?
Hi @eolivelli Could you help review this patch ?
The pr had no activity for 30 days, mark with Stale label.