[ 
https://issues.apache.org/jira/browse/BOOKKEEPER-629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13688847#comment-13688847
 ] 

Rakesh R commented on BOOKKEEPER-629:
-------------------------------------

Hi [~hustlmsp] [[email protected]], will introduce the following config 
item. Since Bookie#getBookieAddress() is using reverseDNS on the ip, I think 
just changing the StringUtils#addrToString will work. Whats your opinion?
{code}
# Whether the bookie should use its hostname to register with the 
# co-ordination service(eg: zookeeper service). 
# When false, bookie will use its ipaddress for the registration.
# Default value is false.
#useHostName=false
{code}

AbstractConfiguration.java
{code}
    /**
     * Get whether bookie is using hostname for registration. The default is
     * false.
     * 
     * @return true, if bookie is registering with its hostname. Otherwise
     *         bookie is using its ipaddress
     */
    public boolean getUseHostName() {
        return getBoolean(USE_HOST_NAME, false);
    }

    /**
     * Configure the bookie to use its hostname to register with the
     * co-ordination service(eg: zookeeper)
     * 
     * @see #getUseHostName
     * @param useHostName
     *            whether to use hostname for registration
     */
    public void setUseHostName(boolean useHostName) {
        setProperty(USE_HOST_NAME, useHostName);
    }
{code}

StringUtils.java
{code}
    public static String addrToString(InetSocketAddress addr,
            AbstractConfiguration conf) {
        if (conf.getUseHostName()) {
            return addr.getAddress().getCanonicalHostName() + ":"
                    + addr.getPort();
        } else {
            return addr.getAddress().getHostAddress() + ":" + addr.getPort();
        }
    }
{code}

                
> Support hostname based ledger metadata to help users to change IP with 
> exitsting installation
> ---------------------------------------------------------------------------------------------
>
>                 Key: BOOKKEEPER-629
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-629
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-client, bookkeeper-server
>    Affects Versions: 4.2.1, 4.3.0
>            Reporter: Vinay
>
> Register the bookie with *hostname:port* and also store the bookie addresses 
> as *hostname:port* in ledger metadata files instead of *ip:port*
> This will help users to change the machine IP if they want without loosing 
> their data.
> Supporting hostname based installation/functionality is one of the important 
> requirement of users.
> Any thoughts?

--
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