Bryan Beaudreault created BOOKKEEPER-618:
--------------------------------------------

             Summary: Better resolution of bookie address
                 Key: BOOKKEEPER-618
                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-618
             Project: Bookkeeper
          Issue Type: Improvement
          Components: bookkeeper-server
    Affects Versions: 4.2.1
            Reporter: Bryan Beaudreault
            Priority: Minor


Bookie#getBookieAddress uses the following code:

{code:title=Bookie.java}
    /**
     * Return the configured address of the bookie.
     */
    public static InetSocketAddress getBookieAddress(ServerConfiguration conf)
            throws UnknownHostException {
        return new InetSocketAddress(InetAddress.getLocalHost()
                .getHostAddress(), conf.getBookiePort());
    }
{code}

This code is subject to the contents of one's /etc/hosts file, in that if they 
have an entry like {{ 127.0.0.1 myhostname }}, this method will return the same 
127.0.0.1 address on all bookie servers.  This causes conflicts due to the way 
bookies register in zookeeper.

There should be an optional bk_server.conf setting to allow one to select their 
preferred network interface to use for the bookie.  Then you could use 
something like {{ 
NetworkInterface.getByName(PREFERRED_INTERFACE).getInetAddresses() }} instead.  
This method is not effected by the /etc/hosts.

An alternative method of registering the bookie that does not rely on the local 
address would be another possible solution, such as using the DNS like other 
apache projects (hbase).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to