use of org.apache.hadoop.hbase.replication.ReplicationPeerDescription in project hbase by apache.
the class TestAsyncReplicationAdminApi method testEnableDisablePeer.
@Test
public void testEnableDisablePeer() throws Exception {
ReplicationPeerConfig rpc1 = ReplicationPeerConfig.newBuilder().setClusterKey(KEY_ONE).build();
admin.addReplicationPeer(ID_ONE, rpc1).join();
List<ReplicationPeerDescription> peers = admin.listReplicationPeers().get();
assertEquals(1, peers.size());
assertTrue(peers.get(0).isEnabled());
admin.disableReplicationPeer(ID_ONE).join();
peers = admin.listReplicationPeers().get();
assertEquals(1, peers.size());
assertFalse(peers.get(0).isEnabled());
admin.removeReplicationPeer(ID_ONE).join();
}
use of org.apache.hadoop.hbase.replication.ReplicationPeerDescription in project hbase by apache.
the class TestAsyncReplicationAdminApi method testPeerConfig.
@Test
public void testPeerConfig() throws Exception {
ReplicationPeerConfig config = ReplicationPeerConfig.newBuilder().setClusterKey(KEY_ONE).putConfiguration("key1", "value1").putConfiguration("key2", "value2").build();
admin.addReplicationPeer(ID_ONE, config).join();
List<ReplicationPeerDescription> peers = admin.listReplicationPeers().get();
assertEquals(1, peers.size());
ReplicationPeerDescription peerOne = peers.get(0);
assertNotNull(peerOne);
assertEquals("value1", peerOne.getPeerConfig().getConfiguration().get("key1"));
assertEquals("value2", peerOne.getPeerConfig().getConfiguration().get("key2"));
admin.removeReplicationPeer(ID_ONE).join();
}
use of org.apache.hadoop.hbase.replication.ReplicationPeerDescription in project hbase by apache.
the class DumpReplicationQueues method dumpPeersState.
public String dumpPeersState(List<ReplicationPeerDescription> peers) throws Exception {
Map<String, String> currentConf;
StringBuilder sb = new StringBuilder();
for (ReplicationPeerDescription peer : peers) {
ReplicationPeerConfig peerConfig = peer.getPeerConfig();
sb.append("Peer: " + peer.getPeerId() + "\n");
sb.append(" " + "State: " + (peer.isEnabled() ? "ENABLED" : "DISABLED") + "\n");
sb.append(" " + "Cluster Name: " + peerConfig.getClusterKey() + "\n");
sb.append(" " + "Replication Endpoint: " + peerConfig.getReplicationEndpointImpl() + "\n");
currentConf = peerConfig.getConfiguration();
// Only show when we have a custom configuration for the peer
if (currentConf.size() > 1) {
sb.append(" " + "Peer Configuration: " + currentConf + "\n");
}
sb.append(" " + "Peer Table CFs: " + peerConfig.getTableCFsMap() + "\n");
sb.append(" " + "Peer Namespaces: " + peerConfig.getNamespaces() + "\n");
}
return sb.toString();
}
Aggregations