HBASE-1279 Fix the way hostnames and IPs are handled
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@771387 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
06bbb86c20
commit
3c35c00cf9
|
@ -102,6 +102,7 @@ Release 0.20.0 - Unreleased
|
|||
HBASE-1347 HTable.incrementColumnValue does not take negative 'amount'
|
||||
(Evgeny Ryabitskiy via Stack)
|
||||
HBASE-1365 Typo in TableInputFormatBase.setInputColums (Jon Gray via Stack)
|
||||
HBASE-1279 Fix the way hostnames and IPs are handled
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-1089 Add count of regions on filesystem to master UI; add percentage
|
||||
|
|
|
@ -218,6 +218,21 @@
|
|||
unstable region servers caused by an OOME.
|
||||
</description>
|
||||
</property>
|
||||
<property>
|
||||
<name>hbase.regionserver.dns.interface</name>
|
||||
<value>default</value>
|
||||
<description>The name of the Network Interface from which a region server
|
||||
should report its IP address.
|
||||
</description>
|
||||
</property>
|
||||
<property>
|
||||
<name>hbase.regionserver.dns.nameserver</name>
|
||||
<value>default</value>
|
||||
<description>The host name or IP address of the name server (DNS)
|
||||
which a region server should use to determine the host name used by the
|
||||
master for communication and display purposes.
|
||||
</description>
|
||||
</property>
|
||||
<property>
|
||||
<name>hbase.regionserver.globalMemcache.upperLimit</name>
|
||||
<value>0.4</value>
|
||||
|
|
|
@ -39,6 +39,7 @@ public class HServerInfo implements WritableComparable<HServerInfo> {
|
|||
private HServerLoad load;
|
||||
private int infoPort;
|
||||
private transient volatile String serverName = null;
|
||||
private String name;
|
||||
|
||||
/** default constructor - used by Writable */
|
||||
public HServerInfo() {
|
||||
|
@ -135,6 +136,22 @@ public class HServerInfo implements WritableComparable<HServerInfo> {
|
|||
return this.serverName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the hostname of the server
|
||||
* @return hostname
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the hostname of the server
|
||||
* @param name hostname
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
|
@ -177,6 +194,7 @@ public class HServerInfo implements WritableComparable<HServerInfo> {
|
|||
this.startCode = in.readLong();
|
||||
this.load.readFields(in);
|
||||
this.infoPort = in.readInt();
|
||||
this.name = in.readUTF();
|
||||
}
|
||||
|
||||
public void write(DataOutput out) throws IOException {
|
||||
|
@ -184,6 +202,7 @@ public class HServerInfo implements WritableComparable<HServerInfo> {
|
|||
out.writeLong(this.startCode);
|
||||
this.load.write(out);
|
||||
out.writeInt(this.infoPort);
|
||||
out.writeUTF(name);
|
||||
}
|
||||
|
||||
public int compareTo(HServerInfo o) {
|
||||
|
|
|
@ -563,10 +563,15 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
|
|||
*/
|
||||
public MapWritable regionServerStartup(final HServerInfo serverInfo)
|
||||
throws IOException {
|
||||
// Set the address for now even tho it will not be persisted on HRS side.
|
||||
// Set the address for now even tho it will not be persisted on HRS side
|
||||
// If the address given is not the default one,
|
||||
// use the IP given by the user.
|
||||
if (serverInfo.getServerAddress().getBindAddress().equals(
|
||||
DEFAULT_HOST)) {
|
||||
String rsAddress = HBaseServer.getRemoteAddress();
|
||||
serverInfo.setServerAddress(new HServerAddress(rsAddress,
|
||||
serverInfo.getServerAddress().getPort()));
|
||||
}
|
||||
// Register with server manager
|
||||
this.serverManager.regionServerStartup(serverInfo);
|
||||
// Send back some config info
|
||||
|
|
|
@ -101,6 +101,7 @@ import org.apache.hadoop.hbase.util.Threads;
|
|||
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper;
|
||||
import org.apache.hadoop.io.MapWritable;
|
||||
import org.apache.hadoop.io.Writable;
|
||||
import org.apache.hadoop.net.DNS;
|
||||
import org.apache.hadoop.util.Progressable;
|
||||
import org.apache.hadoop.util.StringUtils;
|
||||
import org.apache.zookeeper.WatchedEvent;
|
||||
|
@ -289,9 +290,13 @@ public class HRegionServer implements HConstants, HRegionInterface,
|
|||
// Address is givin a default IP for the moment. Will be changed after
|
||||
// calling the master.
|
||||
this.serverInfo = new HServerInfo(new HServerAddress(
|
||||
new InetSocketAddress(DEFAULT_HOST,
|
||||
new InetSocketAddress(address.getBindAddress(),
|
||||
this.server.getListenerAddress().getPort())), System.currentTimeMillis(),
|
||||
this.conf.getInt("hbase.regionserver.info.port", 60030));
|
||||
String machineName = DNS.getDefaultHost(
|
||||
conf.get("hbase.regionserver.dns.interface","default"),
|
||||
conf.get("hbase.regionserver.dns.nameserver","default"));
|
||||
this.serverInfo.setName(machineName);
|
||||
if (this.serverInfo.getServerAddress() == null) {
|
||||
throw new NullPointerException("Server address cannot be null; " +
|
||||
"hbase-958 debugging");
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
Arrays.sort(serverNames);
|
||||
for (String serverName: serverNames) {
|
||||
HServerInfo hsi = serverToServerInfos.get(serverName);
|
||||
String hostname = hsi.getServerAddress().getHostname() + ":" + hsi.getInfoPort();
|
||||
String hostname = hsi.getName() + ":" + hsi.getInfoPort();
|
||||
String url = "http://" + hostname + "/";
|
||||
totalRegions += hsi.getLoad().getNumberOfRegions();
|
||||
totalRequests += hsi.getLoad().getNumberOfRequests() / interval;
|
||||
|
|
Loading…
Reference in New Issue