HBASE-23764: Switch to IP address for ZK ensemble #1106
Tests showed that using IP address is much faster for mini cluster and a lot less flakier. See the jira for more details.
This commit is contained in:
parent
7b4b90aef5
commit
4de06915b8
@ -72,7 +72,10 @@ possible configurations would overwhelm and obscure the important.
|
|||||||
</property>
|
</property>
|
||||||
<property>
|
<property>
|
||||||
<name>hbase.zookeeper.quorum</name>
|
<name>hbase.zookeeper.quorum</name>
|
||||||
<value>localhost</value>
|
<!--Ideally we should be using a hostname here instead of IP address. Please refer to
|
||||||
|
https://issues.apache.org/jira/browse/HBASE-23764 for why we switched to IP address. Should be
|
||||||
|
changed once we fix the underlying ZK issue.-->
|
||||||
|
<value>127.0.0.1</value>
|
||||||
<description>Comma separated list of servers in the ZooKeeper ensemble
|
<description>Comma separated list of servers in the ZooKeeper ensemble
|
||||||
(This config. should have been named hbase.zookeeper.ensemble).
|
(This config. should have been named hbase.zookeeper.ensemble).
|
||||||
For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com".
|
For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com".
|
||||||
|
@ -101,7 +101,7 @@ public class TestZKAsyncRegistry {
|
|||||||
public void testIndependentZKConnections() throws IOException {
|
public void testIndependentZKConnections() throws IOException {
|
||||||
try (ReadOnlyZKClient zk1 = REGISTRY.getZKClient()) {
|
try (ReadOnlyZKClient zk1 = REGISTRY.getZKClient()) {
|
||||||
Configuration otherConf = new Configuration(TEST_UTIL.getConfiguration());
|
Configuration otherConf = new Configuration(TEST_UTIL.getConfiguration());
|
||||||
otherConf.set(HConstants.ZOOKEEPER_QUORUM, "127.0.0.1");
|
otherConf.set(HConstants.ZOOKEEPER_QUORUM, "localhost");
|
||||||
try (ZKAsyncRegistry otherRegistry = new ZKAsyncRegistry(otherConf)) {
|
try (ZKAsyncRegistry otherRegistry = new ZKAsyncRegistry(otherConf)) {
|
||||||
ReadOnlyZKClient zk2 = otherRegistry.getZKClient();
|
ReadOnlyZKClient zk2 = otherRegistry.getZKClient();
|
||||||
assertNotSame("Using a different configuration / quorum should result in different " +
|
assertNotSame("Using a different configuration / quorum should result in different " +
|
||||||
|
@ -19,7 +19,7 @@ package org.apache.hadoop.hbase.master;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.apache.hadoop.hbase.HConstants.ZOOKEEPER_QUORUM;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
@ -312,7 +312,7 @@ public class TestMasterNoCluster {
|
|||||||
@Test
|
@Test
|
||||||
public void testMasterInitWithSameClientServerZKQuorum() throws Exception {
|
public void testMasterInitWithSameClientServerZKQuorum() throws Exception {
|
||||||
Configuration conf = new Configuration(TESTUTIL.getConfiguration());
|
Configuration conf = new Configuration(TESTUTIL.getConfiguration());
|
||||||
conf.set(HConstants.CLIENT_ZOOKEEPER_QUORUM, HConstants.LOCALHOST);
|
conf.set(HConstants.CLIENT_ZOOKEEPER_QUORUM, conf.get(ZOOKEEPER_QUORUM));
|
||||||
conf.setInt(HConstants.CLIENT_ZOOKEEPER_CLIENT_PORT, TESTUTIL.getZkCluster().getClientPort());
|
conf.setInt(HConstants.CLIENT_ZOOKEEPER_CLIENT_PORT, TESTUTIL.getZkCluster().getClientPort());
|
||||||
HMaster master = new HMaster(conf);
|
HMaster master = new HMaster(conf);
|
||||||
master.start();
|
master.start();
|
||||||
|
@ -74,7 +74,7 @@ public class TestHQuorumPeer {
|
|||||||
assertEquals(dataDir.toString(), (String)properties.get("dataDir"));
|
assertEquals(dataDir.toString(), (String)properties.get("dataDir"));
|
||||||
assertEquals(Integer.valueOf(PORT_NO),
|
assertEquals(Integer.valueOf(PORT_NO),
|
||||||
Integer.valueOf(properties.getProperty("clientPort")));
|
Integer.valueOf(properties.getProperty("clientPort")));
|
||||||
assertEquals("localhost:2888:3888", properties.get("server.0"));
|
assertEquals("127.0.0.1:2888:3888", properties.get("server.0"));
|
||||||
assertNull(properties.get("server.1"));
|
assertNull(properties.get("server.1"));
|
||||||
|
|
||||||
String oldValue = conf.get(HConstants.ZOOKEEPER_QUORUM);
|
String oldValue = conf.get(HConstants.ZOOKEEPER_QUORUM);
|
||||||
|
@ -101,7 +101,7 @@ public class TestZKMainServer {
|
|||||||
public void testHostPortParse() {
|
public void testHostPortParse() {
|
||||||
ZKMainServer parser = new ZKMainServer();
|
ZKMainServer parser = new ZKMainServer();
|
||||||
Configuration c = HBaseConfiguration.create();
|
Configuration c = HBaseConfiguration.create();
|
||||||
assertEquals("localhost:" + c.get(HConstants.ZOOKEEPER_CLIENT_PORT), parser.parse(c));
|
assertEquals("127.0.0.1:" + c.get(HConstants.ZOOKEEPER_CLIENT_PORT), parser.parse(c));
|
||||||
final String port = "1234";
|
final String port = "1234";
|
||||||
c.set(HConstants.ZOOKEEPER_CLIENT_PORT, port);
|
c.set(HConstants.ZOOKEEPER_CLIENT_PORT, port);
|
||||||
c.set("hbase.zookeeper.quorum", "example.com");
|
c.set("hbase.zookeeper.quorum", "example.com");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user