org.apache.hadoop.hbase.zookeeper.ZKConfig.getZooKeeperClusterKey()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.apache.hadoop.hbase.zookeeper.ZKConfig.getZooKeeperClusterKey()方法的一些代码示例,展示了ZKConfig.getZooKeeperClusterKey()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKConfig.getZooKeeperClusterKey()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.zookeeper.ZKConfig
类名称:ZKConfig
方法名:getZooKeeperClusterKey

ZKConfig.getZooKeeperClusterKey介绍

[英]Get the key to the ZK ensemble for this configuration without adding a name at the end
[中]获取此配置的ZK集合的密钥,而无需在末尾添加名称

代码示例

代码示例来源:origin: apache/hbase

/**
 * Get the key to the ZK ensemble for this configuration without
 * adding a name at the end
 * @param conf Configuration to use to build the key
 * @return ensemble key without a name
 */
public static String getZooKeeperClusterKey(Configuration conf) {
 return getZooKeeperClusterKey(conf, null);
}

代码示例来源:origin: apache/hbase

@Test
public void testGetZooKeeperClusterKey() {
 Configuration conf = HBaseConfiguration.create();
 conf.set(HConstants.ZOOKEEPER_QUORUM, "\tlocalhost\n");
 conf.set(HConstants.ZOOKEEPER_CLIENT_PORT, "3333");
 conf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "hbase");
 String clusterKey = ZKConfig.getZooKeeperClusterKey(conf, "test");
 assertTrue(!clusterKey.contains("\t") && !clusterKey.contains("\n"));
 assertEquals("localhost:3333:hbase,test", clusterKey);
}

代码示例来源:origin: apache/hbase

/**
 * Create replication peer for replicating to region replicas if needed.
 * @param conf configuration to use
 * @throws IOException
 */
public static void setupRegionReplicaReplication(Configuration conf) throws IOException {
 if (!isRegionReplicaReplicationEnabled(conf)) {
  return;
 }
 Admin admin = ConnectionFactory.createConnection(conf).getAdmin();
 ReplicationPeerConfig peerConfig = null;
 try {
  peerConfig = admin.getReplicationPeerConfig(REGION_REPLICA_REPLICATION_PEER);
 } catch (ReplicationPeerNotFoundException e) {
  LOG.warn("Region replica replication peer id=" + REGION_REPLICA_REPLICATION_PEER
    + " not exist", e);
 }
 try {
  if (peerConfig == null) {
   LOG.info("Region replica replication peer id=" + REGION_REPLICA_REPLICATION_PEER
     + " not exist. Creating...");
   peerConfig = new ReplicationPeerConfig();
   peerConfig.setClusterKey(ZKConfig.getZooKeeperClusterKey(conf));
   peerConfig.setReplicationEndpointImpl(RegionReplicaReplicationEndpoint.class.getName());
   admin.addReplicationPeer(REGION_REPLICA_REPLICATION_PEER, peerConfig);
  }
 } finally {
  admin.close();
 }
}

代码示例来源:origin: apache/hbase

@Before
public void setUp() {
 zkTimeoutCount = 0;
 rqs = ReplicationStorageFactory.getReplicationQueueStorage(zkw, conf);
 rp = ReplicationFactory.getReplicationPeers(zkw, conf);
 OUR_KEY = ZKConfig.getZooKeeperClusterKey(conf);
}

代码示例来源:origin: apache/hbase

private static String initPeerClusterState(String baseZKNode)
  throws IOException, KeeperException {
 // Add a dummy region server and set up the cluster id
 Configuration testConf = new Configuration(conf);
 testConf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, baseZKNode);
 ZKWatcher zkw1 = new ZKWatcher(testConf, "test1", null);
 String fakeRs = ZNodePaths.joinZNode(zkw1.getZNodePaths().rsZNode,
     "hostname1.example.org:1234");
 ZKUtil.createWithParents(zkw1, fakeRs);
 ZKClusterId.setClusterId(zkw1, new ClusterId());
 return ZKConfig.getZooKeeperClusterKey(testConf);
}

代码示例来源:origin: apache/hbase

@Test (expected=IOException.class)
public void testWALEntryFilterAddValidation() throws Exception {
 ReplicationPeerConfig rpc =  new ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))
   .setReplicationEndpointImpl(ReplicationEndpointWithWALEntryFilter.class.getName());
 //test that we can create mutliple WALFilters reflectively
 rpc.getConfiguration().put(BaseReplicationEndpoint.REPLICATION_WALENTRYFILTER_CONFIG_KEY,
   "IAmNotARealWalEntryFilter");
 admin.addPeer("testWALEntryFilterAddValidation", rpc);
}

代码示例来源:origin: apache/hbase

@Test (expected=IOException.class)
public void testWALEntryFilterUpdateValidation() throws Exception {
 ReplicationPeerConfig rpc =  new ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))
   .setReplicationEndpointImpl(ReplicationEndpointWithWALEntryFilter.class.getName());
 //test that we can create mutliple WALFilters reflectively
 rpc.getConfiguration().put(BaseReplicationEndpoint.REPLICATION_WALENTRYFILTER_CONFIG_KEY,
   "IAmNotARealWalEntryFilter");
 admin.updatePeerConfig("testWALEntryFilterUpdateValidation", rpc);
}

代码示例来源:origin: apache/hbase

@Test
public void testWALEntryFilterFromReplicationEndpoint() throws Exception {
 ReplicationPeerConfig rpc =  new ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))
   .setReplicationEndpointImpl(ReplicationEndpointWithWALEntryFilter.class.getName());
 //test that we can create mutliple WALFilters reflectively
 rpc.getConfiguration().put(BaseReplicationEndpoint.REPLICATION_WALENTRYFILTER_CONFIG_KEY,
   EverythingPassesWALEntryFilter.class.getName() +
     "," + EverythingPassesWALEntryFilterSubclass.class.getName());
 admin.addPeer("testWALEntryFilterFromReplicationEndpoint", rpc);
 // now replicate some data.
 try (Connection connection = ConnectionFactory.createConnection(conf1)) {
  doPut(connection, Bytes.toBytes("row1"));
  doPut(connection, row);
  doPut(connection, Bytes.toBytes("row2"));
 }
 Waiter.waitFor(conf1, 60000, new Waiter.Predicate<Exception>() {
  @Override
  public boolean evaluate() throws Exception {
   return ReplicationEndpointForTest.replicateCount.get() >= 1;
  }
 });
 Assert.assertNull(ReplicationEndpointWithWALEntryFilter.ex.get());
 //make sure our reflectively created filter is in the filter chain
 Assert.assertTrue(EverythingPassesWALEntryFilter.hasPassedAnEntry());
 admin.removePeer("testWALEntryFilterFromReplicationEndpoint");
}

代码示例来源:origin: apache/hbase

final String id = "testReplicationEndpointReturnsFalseOnReplicate";
admin.addPeer(id,
 new ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))
  .setReplicationEndpointImpl(ReplicationEndpointReturningFalse.class.getName()), null);

代码示例来源:origin: apache/hbase

new ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))
  .setReplicationEndpointImpl(ReplicationEndpointForTest.class.getName()), null);

代码示例来源:origin: apache/hbase

assertEquals(zkClusterKey.getZnodeParent(), conf.get(HConstants.ZOOKEEPER_ZNODE_PARENT));
String reconstructedKey = ZKConfig.getZooKeeperClusterKey(conf);
if (multiplePortSupport) {
 String key2 = ensemble2 + ":" + port + ":" + znode;

代码示例来源:origin: apache/hbase

new ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf2))
  .setReplicationEndpointImpl(InterClusterReplicationEndpointForTest.class.getName()),
null);

代码示例来源:origin: apache/hbase

assertEquals(peerConfig.getClusterKey(), ZKConfig.getZooKeeperClusterKey(
  HTU.getConfiguration()));
assertEquals(RegionReplicaReplicationEndpoint.class.getName(),

代码示例来源:origin: apache/hbase

assertEquals(peerConfig.getClusterKey(), ZKConfig.getZooKeeperClusterKey(
  HTU.getConfiguration()));
assertEquals(RegionReplicaReplicationEndpoint.class.getName(),

代码示例来源:origin: org.apache.hbase/hbase-common

/**
 * Get the key to the ZK ensemble for this configuration without
 * adding a name at the end
 * @param conf Configuration to use to build the key
 * @return ensemble key without a name
 */
public static String getZooKeeperClusterKey(Configuration conf) {
 return getZooKeeperClusterKey(conf, null);
}

代码示例来源:origin: com.aliyun.hbase/alihbase-common

/**
 * Get the key to the ZK ensemble for this configuration without
 * adding a name at the end
 * @param conf Configuration to use to build the key
 * @return ensemble key without a name
 */
public static String getZooKeeperClusterKey(Configuration conf) {
 return getZooKeeperClusterKey(conf, null);
}

代码示例来源:origin: apache/hbase

assertNumberOfPeers(2);
assertEquals(KEY_ONE, ZKConfig.getZooKeeperClusterKey(ReplicationUtils
  .getPeerClusterConfiguration(rp.getPeerStorage().getPeerConfig(ID_ONE), rp.getConf())));
rp.getPeerStorage().removePeer(ID_ONE);

代码示例来源:origin: org.apache.hbase/hbase-common

@Test
public void testGetZooKeeperClusterKey() {
 Configuration conf = HBaseConfiguration.create();
 conf.set(HConstants.ZOOKEEPER_QUORUM, "\tlocalhost\n");
 conf.set(HConstants.ZOOKEEPER_CLIENT_PORT, "3333");
 conf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "hbase");
 String clusterKey = ZKConfig.getZooKeeperClusterKey(conf, "test");
 assertTrue(!clusterKey.contains("\t") && !clusterKey.contains("\n"));
 assertEquals("localhost:3333:hbase,test", clusterKey);
}

代码示例来源:origin: org.apache.hbase/hbase-server

@Test (expected=IOException.class)
public void testWALEntryFilterUpdateValidation() throws Exception {
 ReplicationPeerConfig rpc =  new ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))
   .setReplicationEndpointImpl(ReplicationEndpointWithWALEntryFilter.class.getName());
 //test that we can create mutliple WALFilters reflectively
 rpc.getConfiguration().put(BaseReplicationEndpoint.REPLICATION_WALENTRYFILTER_CONFIG_KEY,
   "IAmNotARealWalEntryFilter");
 admin.updatePeerConfig("testWALEntryFilterUpdateValidation", rpc);
}

代码示例来源:origin: org.apache.hbase/hbase-server

@Test (expected=IOException.class)
public void testWALEntryFilterAddValidation() throws Exception {
 ReplicationPeerConfig rpc =  new ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))
   .setReplicationEndpointImpl(ReplicationEndpointWithWALEntryFilter.class.getName());
 //test that we can create mutliple WALFilters reflectively
 rpc.getConfiguration().put(BaseReplicationEndpoint.REPLICATION_WALENTRYFILTER_CONFIG_KEY,
   "IAmNotARealWalEntryFilter");
 admin.addPeer("testWALEntryFilterAddValidation", rpc);
}

相关文章