diff --git a/hbase-common/src/main/resources/hbase-default.xml b/hbase-common/src/main/resources/hbase-default.xml
index 2b4ca33f30f..2a98d7d69e2 100644
--- a/hbase-common/src/main/resources/hbase-default.xml
+++ b/hbase-common/src/main/resources/hbase-default.xml
@@ -96,6 +96,11 @@ possible configurations would overwhelm and obscure the important.
+
+ hbase.master.port
+ 16000
+ The port the HBase Master should bind to.
+
hbase.master.info.port
16010
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
index 2d05c9688c6..71ccf31873e 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
@@ -419,6 +419,9 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
}
RedirectServlet.regionServerInfoPort = infoServer.getPort();
+ if(RedirectServlet.regionServerInfoPort == infoPort) {
+ return infoPort;
+ }
masterJettyServer = new org.mortbay.jetty.Server();
Connector connector = new SelectChannelConnector();
connector.setHost(addr);
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index 83f37d9d272..27b6e8db24b 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -1730,6 +1730,10 @@ public class HRegionServer extends HasThread implements
private int putUpWebUI() throws IOException {
int port = this.conf.getInt(HConstants.REGIONSERVER_INFO_PORT,
HConstants.DEFAULT_REGIONSERVER_INFOPORT);
+ if(this instanceof HMaster) {
+ port = conf.getInt(HConstants.MASTER_INFO_PORT,
+ HConstants.DEFAULT_MASTER_INFOPORT);
+ }
// -1 is for disabling info server
if (port < 0) return port;
String addr = this.conf.get("hbase.regionserver.info.bindAddress", "0.0.0.0");
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
index adbe6dd49bb..1c9a22a5d52 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
@@ -84,6 +84,7 @@ import org.apache.hadoop.hbase.ipc.RpcServer.BlockingServiceAndInterface;
import org.apache.hadoop.hbase.ipc.RpcServerInterface;
import org.apache.hadoop.hbase.ipc.ServerNotRunningYetException;
import org.apache.hadoop.hbase.ipc.ServerRpcController;
+import org.apache.hadoop.hbase.master.MasterRpcServices;
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.protobuf.RequestConverter;
import org.apache.hadoop.hbase.protobuf.ResponseConverter;
@@ -802,6 +803,10 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
String hostname = getHostname(rs.conf);
int port = rs.conf.getInt(HConstants.REGIONSERVER_PORT,
HConstants.DEFAULT_REGIONSERVER_PORT);
+ if(this instanceof MasterRpcServices) {
+ port = rs.conf.getInt(HConstants.MASTER_PORT,
+ HConstants.DEFAULT_MASTER_PORT);
+ }
// Creation of a HSA will force a resolve.
InetSocketAddress initialIsa = new InetSocketAddress(hostname, port);
InetSocketAddress bindAddress = new InetSocketAddress(