HBASE-8640 ServerName in master may not initialize with the configured ipc address of hbase.master.ipc.address

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1488834 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2013-06-03 03:47:38 +00:00
parent 191ba57a27
commit 3d88fbbcfd
1 changed files with 6 additions and 12 deletions

View File

@ -380,23 +380,16 @@ MasterServices, Server {
// Disable the block cache on the master // Disable the block cache on the master
this.conf.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0.0f); this.conf.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0.0f);
// Server to handle client requests. // Server to handle client requests.
String hostname = Strings.domainNamePointerToHostName(DNS.getDefaultHost( String hostname = conf.get("hbase.master.ipc.address",
Strings.domainNamePointerToHostName(DNS.getDefaultHost(
conf.get("hbase.master.dns.interface", "default"), conf.get("hbase.master.dns.interface", "default"),
conf.get("hbase.master.dns.nameserver", "default"))); conf.get("hbase.master.dns.nameserver", "default"))));
int port = conf.getInt(HConstants.MASTER_PORT, HConstants.DEFAULT_MASTER_PORT); int port = conf.getInt(HConstants.MASTER_PORT, HConstants.DEFAULT_MASTER_PORT);
// Test that the hostname is reachable // Test that the hostname is reachable
InetSocketAddress initialIsa = new InetSocketAddress(hostname, port); InetSocketAddress initialIsa = new InetSocketAddress(hostname, port);
if (initialIsa.getAddress() == null) { if (initialIsa.getAddress() == null) {
throw new IllegalArgumentException("Failed resolve of hostname " + initialIsa); throw new IllegalArgumentException("Failed resolve of hostname " + initialIsa);
} }
// Verify that the bind address is reachable if set
String bindAddress = conf.get("hbase.master.ipc.address");
if (bindAddress != null) {
initialIsa = new InetSocketAddress(bindAddress, port);
if (initialIsa.getAddress() == null) {
throw new IllegalArgumentException("Failed resolve of bind address " + initialIsa);
}
}
String name = "master/" + initialIsa.toString(); String name = "master/" + initialIsa.toString();
// Set how many times to retry talking to another server over HConnection. // Set how many times to retry talking to another server over HConnection.
HConnectionManager.setServerSideHConnectionRetries(this.conf, name, LOG); HConnectionManager.setServerSideHConnectionRetries(this.conf, name, LOG);
@ -410,7 +403,8 @@ MasterServices, Server {
0); // this is a DNC w/o high priority handlers 0); // this is a DNC w/o high priority handlers
// Set our address. // Set our address.
this.isa = this.rpcServer.getListenerAddress(); this.isa = this.rpcServer.getListenerAddress();
this.serverName = new ServerName(hostname, this.isa.getPort(), System.currentTimeMillis()); this.serverName =
new ServerName(this.isa.getHostName(), this.isa.getPort(), System.currentTimeMillis());
this.rsFatals = new MemoryBoundedLogMessageBuffer( this.rsFatals = new MemoryBoundedLogMessageBuffer(
conf.getLong("hbase.master.buffer.for.rs.fatals", 1*1024*1024)); conf.getLong("hbase.master.buffer.for.rs.fatals", 1*1024*1024));