You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Timothy Ward (JIRA)" <ji...@apache.org> on 2016/02/12 19:52:18 UTC

[jira] [Created] (ZOOKEEPER-2367) Unable to establish quorum when hostnames are not resolvable between all of the nodes

Timothy Ward created ZOOKEEPER-2367:
---------------------------------------

             Summary: Unable to establish quorum when hostnames are not resolvable between all of the nodes
                 Key: ZOOKEEPER-2367
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2367
             Project: ZooKeeper
          Issue Type: Bug
          Components: quorum
    Affects Versions: 3.5.0
            Reporter: Timothy Ward
            Priority: Critical


If I have a set of three machines, all of which have locally defined hostnames A, B and C (i.e. B and C cannot look up A by name). I am unable to control the DNS setup, and I don't want to manually reimplement DNS using entries in the hosts file.

A is on IP 192.168.1.16
B is on IP 192.168.1.17
C is on IP 192.168.1.18

All of my ZK configuration uses literal IP addresses (no hostnames anywhere), however I still see a hostname appearing in the leader log (in this case the leader was C):

    java.net.UnknownHostException: B
    	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
    	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    	at java.net.Socket.connect(Socket.java:589)
    	at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:369)
    	at org.apache.zookeeper.server.quorum.QuorumCnxManager.receiveConnection(QuorumCnxManager.java:291)
    	at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener.run(QuorumCnxManager.java:558)

This is caused by the initiateConnection method of QuorumCnxManager, which contains the line:

    self.getElectionAddress().getHostName()

The use of getHostName() forces a reverse DNS lookup, which I do not want. The code should use getHostString() instead, which will use the actual data from config, and avoid unresolvable hosts being sent over the wire. This will mean that node C attempts to connect to 192.168.1.17, not "B".



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)