HBASE-1515 Address part of config option hbase.regionserver unnecessary

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@786913 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nitay Joffe 2009-06-20 22:03:46 +00:00
parent 8fb6662aea
commit f8046be708
8 changed files with 28 additions and 43 deletions

View File

@ -379,6 +379,7 @@ Release 0.20.0 - Unreleased
HBASE-1552 provide version running on cluster via getClusterStatus
HBASE-1550 hbase-daemon.sh stop should provide more information when stop
command fails
HBASE-1515 Address part of config option hbase.regionserver unnecessary
OPTIMIZATIONS
HBASE-1412 Change values for delete column and column family in KeyValue

View File

@ -87,9 +87,9 @@
period.</description>
</property>
<property>
<name>hbase.regionserver</name>
<value>0.0.0.0:60020</value>
<description>The host and port a HBase region server runs at.
<name>hbase.regionserver.port</name>
<value>60020</value>
<description>The port an HBase region server binds to.
</description>
</property>
<property>

View File

@ -66,6 +66,9 @@ public interface HConstants {
/** default host address */
static final String DEFAULT_HOST = "0.0.0.0";
/** Parameter name for port master listens on. */
static final String MASTER_PORT = "hbase.master.port";
/** default port that the master listens on */
static final int DEFAULT_MASTER_PORT = 60000;
@ -85,11 +88,11 @@ public interface HConstants {
/** Default ZooKeeper pause value. In milliseconds. */
static final int DEFAULT_ZOOKEEPER_PAUSE = 2 * 1000;
/** Parameter name for hbase.regionserver address. */
static final String REGIONSERVER_ADDRESS = "hbase.regionserver";
/** Default region server address */
static final String DEFAULT_REGIONSERVER_ADDRESS = DEFAULT_HOST + ":60020";
/** Parameter name for port region server listens on. */
static final String REGIONSERVER_PORT = "hbase.regionserver.port";
/** Default port region server listens on. */
static final int DEFAULT_REGIONSERVER_PORT = 60020;
/** default port for region server web api */
static final int DEFAULT_REGIONSERVER_INFOPORT = 60030;

View File

@ -95,7 +95,7 @@ public class LocalHBaseCluster implements HConstants {
// Start the HRegionServers. Always have region servers come up on
// port '0' so there won't be clashes over default port as unit tests
// start/stop ports at different times during the life of the test.
conf.set(REGIONSERVER_ADDRESS, DEFAULT_HOST + ":0");
conf.set(REGIONSERVER_PORT, "0");
this.regionThreads = new ArrayList<RegionServerThread>();
regionServerClass = (Class<? extends HRegionServer>) conf.getClass(HConstants.REGION_SERVER_IMPL, HRegionServer.class);
for (int i = 0; i < noRegionServers; i++) {

View File

@ -168,7 +168,7 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
conf.get("hbase.master.dns.interface","default"),
conf.get("hbase.master.dns.nameserver","default"));
addressStr += ":" +
conf.get("hbase.master.port", Integer.toString(DEFAULT_MASTER_PORT));
conf.get(MASTER_PORT, Integer.toString(DEFAULT_MASTER_PORT));
HServerAddress address = new HServerAddress(addressStr);
LOG.info("My address is " + address);
@ -1077,8 +1077,7 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
*/
private static void printUsageAndExit() {
System.err.println("Usage: java org.apache.hbase.HMaster " +
"[--bind=hostname:port] start|stop");
System.err.println("Usage: java org.apache.hbase.HMaster start|stop");
System.exit(0);
}

View File

@ -234,25 +234,22 @@ public class HRegionServer implements HConstants, HRegionInterface,
// doing a restart() to prevent closing of HDFS.
private final AtomicBoolean shutdownHDFS = new AtomicBoolean(true);
private final String machineName;
/**
* Starts a HRegionServer at the default location
* @param conf
* @throws IOException
*/
public HRegionServer(HBaseConfiguration conf) throws IOException {
this(new HServerAddress(conf.get(REGIONSERVER_ADDRESS,
DEFAULT_REGIONSERVER_ADDRESS)), conf);
}
/**
* Starts a HRegionServer at the specified location
* @param address
* @param conf
* @throws IOException
*/
public HRegionServer(HServerAddress address, HBaseConfiguration conf)
throws IOException {
this.address = address;
machineName = DNS.getDefaultHost(
conf.get("hbase.regionserver.dns.interface","default"),
conf.get("hbase.regionserver.dns.nameserver","default"));
String addressStr = machineName + ":" +
conf.get(REGIONSERVER_PORT, Integer.toString(DEFAULT_REGIONSERVER_PORT));
this.address = new HServerAddress(addressStr);
LOG.info("My address is " + address);
this.abortRequested = false;
this.fsOk = true;
this.conf = conf;
@ -295,9 +292,6 @@ public class HRegionServer implements HConstants, HRegionInterface,
address.getPort(), conf.getInt("hbase.regionserver.handler.count", 10),
false, conf);
this.server.setErrorHandler(this);
String machineName = DNS.getDefaultHost(
conf.get("hbase.regionserver.dns.interface","default"),
conf.get("hbase.regionserver.dns.nameserver","default"));
// Address is givin a default IP for the moment. Will be changed after
// calling the master.
this.serverInfo = new HServerInfo(new HServerAddress(
@ -2340,8 +2334,7 @@ public class HRegionServer implements HConstants, HRegionInterface,
if (message != null) {
System.err.println(message);
}
System.err.println("Usage: java " +
"org.apache.hbase.HRegionServer [--bind=hostname:port] start");
System.err.println("Usage: java org.apache.hbase.HRegionServer start|stop");
System.exit(0);
}
@ -2359,13 +2352,7 @@ public class HRegionServer implements HConstants, HRegionInterface,
// Process command-line args. TODO: Better cmd-line processing
// (but hopefully something not as painful as cli options).
final String addressArgKey = "--bind=";
for (String cmd: args) {
if (cmd.startsWith(addressArgKey)) {
conf.set(REGIONSERVER_ADDRESS, cmd.substring(addressArgKey.length()));
continue;
}
if (cmd.equals("start")) {
try {
// If 'local', don't start a region server here. Defer to

View File

@ -62,10 +62,10 @@ public class MiniHBaseCluster implements HConstants {
hbaseCluster.startup();
} catch (BindException e) {
//this port is already in use. try to use another (for multiple testing)
int port = conf.getInt("hbase.master.port", DEFAULT_MASTER_PORT);
int port = conf.getInt(MASTER_PORT, DEFAULT_MASTER_PORT);
LOG.info("Failed binding Master to port: " + port, e);
port++;
conf.setInt("hbase.master.port", port);
conf.setInt(MASTER_PORT, port);
continue;
}
break;

View File

@ -40,11 +40,6 @@ public class OOMERegionServer extends HRegionServer {
public OOMERegionServer(HBaseConfiguration conf) throws IOException {
super(conf);
}
public OOMERegionServer(HServerAddress address, HBaseConfiguration conf)
throws IOException {
super(address, conf);
}
public void put(byte [] regionName, Put put)
throws IOException {