HBASE-1639 clean checkout with empty hbase-site.xml, zk won't start
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@793123 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
10c178fcb0
commit
99f1faf30b
|
@ -256,6 +256,7 @@ Release 0.20.0 - Unreleased
|
|||
(Doğacan Güney via Stack)
|
||||
HBASE-1644 Result.row is cached in getRow; this breaks MapReduce
|
||||
(Doğacan Güney via Stack)
|
||||
HBASE-1639 clean checkout with empty hbase-site.xml, zk won't start
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-1089 Add count of regions on filesystem to master UI; add percentage
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.net.DNS;
|
||||
import org.apache.hadoop.util.StringUtils;
|
||||
import org.apache.zookeeper.server.ServerConfig;
|
||||
import org.apache.zookeeper.server.ZooKeeperServerMain;
|
||||
import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
|
||||
|
@ -85,6 +86,19 @@ public class HQuorumPeer implements HConstants {
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean addressIsLocalHost(String address) {
|
||||
return address.equals("localhost") || address.equals("127.0.0.1");
|
||||
}
|
||||
|
||||
private static boolean hostEquals(String addrA, String addrB) {
|
||||
if (addrA.contains(".") && addrB.contains(".")) {
|
||||
return addrA.equals(addrB);
|
||||
}
|
||||
String hostA = StringUtils.simpleHostname(addrA);
|
||||
String hostB = StringUtils.simpleHostname(addrB);
|
||||
return hostA.equals(hostB);
|
||||
}
|
||||
|
||||
private static void writeMyID(Properties properties) throws UnknownHostException, IOException {
|
||||
HBaseConfiguration conf = new HBaseConfiguration();
|
||||
String myAddress = DNS.getDefaultHost(
|
||||
|
@ -101,7 +115,9 @@ public class HQuorumPeer implements HConstants {
|
|||
long id = Long.parseLong(key.substring(dot + 1));
|
||||
String[] parts = value.split(":");
|
||||
String address = parts[0];
|
||||
if (myAddress.equals(address)) {
|
||||
if (addressIsLocalHost(address) || hostEquals(myAddress, address)) {
|
||||
LOG.debug("found my address: " + myAddress + ", in list: " + address +
|
||||
", setting myId to " + id);
|
||||
myId = id;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue