HBASE-12263 RegionServer listens on localhost in distributed cluster when DNS is unavailable (Shaohui)

This commit is contained in:
Ted Yu 2014-10-17 20:52:55 +00:00
parent 728fc543ea
commit 349a56ae2c
2 changed files with 12 additions and 1 deletions

View File

@ -275,7 +275,7 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
conf.getLong("hbase.master.buffer.for.rs.fatals", 1*1024*1024));
LOG.info("hbase.rootdir=" + FSUtils.getRootDir(this.conf) +
", hbase.cluster.distributed=" + this.conf.getBoolean("hbase.cluster.distributed", false));
", hbase.cluster.distributed=" + this.conf.getBoolean(HConstants.CLUSTER_DISTRIBUTED, false));
Replication.decorateMasterConfiguration(this.conf);

View File

@ -767,6 +767,17 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
Strings.domainNamePointerToHostName(DNS.getDefaultHost(
rs.conf.get("hbase.regionserver.dns.interface", "default"),
rs.conf.get("hbase.regionserver.dns.nameserver", "default"))));
boolean mode =
rs.conf.getBoolean(HConstants.CLUSTER_DISTRIBUTED, HConstants.DEFAULT_CLUSTER_DISTRIBUTED);
if (mode == HConstants.CLUSTER_IS_DISTRIBUTED && hostname.equals(HConstants.LOCALHOST)) {
String msg =
"The hostname of regionserver cannot be set to localhost "
+ "in a fully-distributed setup because it won't be reachable. "
+ "See \"Getting Started\" for more information.";
LOG.fatal(msg);
throw new IOException(msg);
}
int port = rs.conf.getInt(HConstants.REGIONSERVER_PORT,
HConstants.DEFAULT_REGIONSERVER_PORT);
// Creation of a HSA will force a resolve.