hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Duo Xu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-18226) Disable reverse DNS lookup at HMaster and use default hostname provided by RegionServer
Date Tue, 20 Jun 2017 03:15:00 GMT

    [ https://issues.apache.org/jira/browse/HBASE-18226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16055089#comment-16055089

Duo Xu commented on HBASE-18226:


I do not see anywhere else we need to change.

if the instance is HMaster, it will get the serverName from HRegionServer constructor and
no further changes happen on the serverName variable.

    String hostName = shouldUseThisHostnameInstead() ? useThisHostnameInstead :
    serverName = ServerName.valueOf(hostName, rpcServices.isa.getPort(), startcode);

if the instance is HRegionServer, although it is going through the same piece of constructor
code, in run() function, it will call reportForDuty() and in handleReportForDutyResponse(w),
servername is overwritten by the hostname returned by HMaster.

// Try and register with the Master; tell it we are here.  Break if
      // server is stopped or the clusterup flag is down or hdfs went wacky.
      while (keepLooping()) {
        RegionServerStartupResponse w = reportForDuty();
        if (w == null) {
          LOG.warn("reportForDuty failed; sleeping and then retrying.");
        } else {

protected void handleReportForDutyResponse(final RegionServerStartupResponse c)
  throws IOException {
    try {
      boolean updateRootDir = false;
      for (NameStringPair e : c.getMapEntriesList()) {
        String key = e.getName();
        // The hostname the master sees us as.
        if (key.equals(HConstants.KEY_FOR_HOSTNAME_SEEN_BY_MASTER)) {
          String hostnameFromMasterPOV = e.getValue();
          this.serverName = ServerName.valueOf(hostnameFromMasterPOV,
            rpcServices.isa.getPort(), this.startcode);

So I think we do not need to add extra code for handling Master as a RS.

Let me know if i missed something.

> Disable reverse DNS lookup at HMaster and use default hostname provided by RegionServer
> ---------------------------------------------------------------------------------------
>                 Key: HBASE-18226
>                 URL: https://issues.apache.org/jira/browse/HBASE-18226
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Duo Xu
>         Attachments: HBASE-18226.001.patch, HBASE-18226.002.patch, HBASE-18226.003.patch,
> Description updated:
> In some unusual network environment, forward DNS lookup is supported while reverse DNS
lookup may not work properly.
> This JIRA is to address that HMaster uses the hostname passed from RS instead of doing
reverse DNS lookup to tells RS which hostname to use during reportForDuty() . This has already
been implemented by HBASE-12954 by adding "useThisHostnameInstead" field in RegionServerStatusProtos.
> Currently "useThisHostnameInstead" is optional and RS by default only passes port, server
start code and server current time info to HMaster during RS reportForDuty(). In order to
use this field, users currently need to specify "hbase.regionserver.hostname" on every regionserver
node's hbase-site.xml. This causes some trouble in
> 1. some deployments managed by some management tools like Ambari, which maintains the
same copy of hbase-site.xml across all the nodes.
> 2. HBASE-12954 is targeting multihomed hosts, which users want to manually set the hostname
value for each node. In the other cases (not multihomed), I just want RS to use the hostname
return by the node and set it in useThisHostnameInstead and pass to HMaster during reportForDuty().
> I would like to introduce a setting that if the setting is set to true, "useThisHostnameInstead"
will be set to the hostname RS gets from the node. Then HMaster will skip reverse DNS lookup
because it sees "useThisHostnameInstead" field is set in the request.
> "hbase.regionserver.hostname.reported.to.master", is it a good name?
> --------------------
> Regarding the hostname returned by the RS node, I read the source code again (including
hadoop-common dns.java). By default RS gets hostname by calling InetAddress.getLocalHost().getCanonicalHostName().
If users specify "hbase.regionserver.dns.interface" or "hbase.regionserver.dns.nameserver"
or some underlying system configuration changes (eg. modifying /etc/nsswitch.conf), it may
first read from DNS or other sources instead of first checking /etc/hosts file.

This message was sent by Atlassian JIRA

View raw message