HBASE-12781 thrift2 listen port will bind always to the passed command line address (Pankaj Kumar)

This commit is contained in:
tedyu 2014-12-30 08:32:12 -08:00
parent 0513a21dc8
commit 7310fa2ba7
1 changed files with 10 additions and 1 deletions

View File

@ -309,6 +309,15 @@ public class ThriftServer {
System.exit(1); System.exit(1);
} }
// Get address to bind
String bindAddress;
if (cmd.hasOption("bind")) {
bindAddress = cmd.getOptionValue("bind");
conf.set("hbase.thrift.info.bindAddress", bindAddress);
} else {
bindAddress = conf.get("hbase.thrift.info.bindAddress");
}
// Get port to bind to // Get port to bind to
int listenPort = 0; int listenPort = 0;
try { try {
@ -387,7 +396,7 @@ public class ThriftServer {
conf.getBoolean("hbase.regionserver.thrift.framed", false) || nonblocking || hsha; conf.getBoolean("hbase.regionserver.thrift.framed", false) || nonblocking || hsha;
TTransportFactory transportFactory = getTTransportFactory(qop, name, host, framed, TTransportFactory transportFactory = getTTransportFactory(qop, name, host, framed,
conf.getInt("hbase.regionserver.thrift.framed.max_frame_size_in_mb", 2) * 1024 * 1024); conf.getInt("hbase.regionserver.thrift.framed.max_frame_size_in_mb", 2) * 1024 * 1024);
InetSocketAddress inetSocketAddress = bindToPort(cmd.getOptionValue("bind"), listenPort); InetSocketAddress inetSocketAddress = bindToPort(bindAddress, listenPort);
conf.setBoolean("hbase.regionserver.thrift.framed", framed); conf.setBoolean("hbase.regionserver.thrift.framed", framed);
if (qop != null) { if (qop != null) {
// Create a processor wrapper, to get the caller // Create a processor wrapper, to get the caller