HBASE-8148 Allow IPC to bind on a specific address
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1459589 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3ce9acc3e7
commit
dccb58a92d
|
@ -370,17 +370,25 @@ Server {
|
||||||
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);
|
||||||
// Creation of a ISA will force a resolve.
|
// 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 " + 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int numHandlers = conf.getInt("hbase.master.handler.count",
|
int numHandlers = conf.getInt("hbase.master.handler.count",
|
||||||
conf.getInt("hbase.regionserver.handler.count", 25));
|
conf.getInt("hbase.regionserver.handler.count", 25));
|
||||||
this.rpcServer = HBaseServerRPC.getServer(MasterMonitorProtocol.class, this,
|
this.rpcServer = HBaseServerRPC.getServer(MasterMonitorProtocol.class, this,
|
||||||
new Class<?>[]{MasterMonitorProtocol.class,
|
new Class<?>[]{MasterMonitorProtocol.class,
|
||||||
MasterAdminProtocol.class, RegionServerStatusProtocol.class},
|
MasterAdminProtocol.class, RegionServerStatusProtocol.class},
|
||||||
initialIsa.getHostName(), // BindAddress is IP we got for this server.
|
initialIsa.getHostName(), // This is bindAddress if set else it's hostname
|
||||||
initialIsa.getPort(),
|
initialIsa.getPort(),
|
||||||
numHandlers,
|
numHandlers,
|
||||||
0, // we dont use high priority handlers in master
|
0, // we dont use high priority handlers in master
|
||||||
|
@ -388,7 +396,7 @@ 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(this.isa.getHostName(),
|
this.serverName = new ServerName(hostname,
|
||||||
this.isa.getPort(), System.currentTimeMillis());
|
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));
|
||||||
|
|
|
@ -488,9 +488,10 @@ public class HRegionServer implements ClientProtocol,
|
||||||
HConstants.DEFAULT_HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD);
|
HConstants.DEFAULT_HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD);
|
||||||
|
|
||||||
// Server to handle client requests.
|
// Server to handle client requests.
|
||||||
String hostname = Strings.domainNamePointerToHostName(DNS.getDefaultHost(
|
String hostname = conf.get("hbase.regionserver.ipc.address",
|
||||||
|
Strings.domainNamePointerToHostName(DNS.getDefaultHost(
|
||||||
conf.get("hbase.regionserver.dns.interface", "default"),
|
conf.get("hbase.regionserver.dns.interface", "default"),
|
||||||
conf.get("hbase.regionserver.dns.nameserver", "default")));
|
conf.get("hbase.regionserver.dns.nameserver", "default"))));
|
||||||
int port = conf.getInt(HConstants.REGIONSERVER_PORT,
|
int port = conf.getInt(HConstants.REGIONSERVER_PORT,
|
||||||
HConstants.DEFAULT_REGIONSERVER_PORT);
|
HConstants.DEFAULT_REGIONSERVER_PORT);
|
||||||
// Creation of a HSA will force a resolve.
|
// Creation of a HSA will force a resolve.
|
||||||
|
|
Loading…
Reference in New Issue