Search in sources :

Example 41 with ReplicationPeerConfig

use of org.apache.hadoop.hbase.replication.ReplicationPeerConfig in project hbase by apache.

the class HMaster method getReplicationPeerConfig.

@Override
public ReplicationPeerConfig getReplicationPeerConfig(String peerId) throws ReplicationException, IOException {
    if (cpHost != null) {
        cpHost.preGetReplicationPeerConfig(peerId);
    }
    final ReplicationPeerConfig peerConfig = this.replicationManager.getPeerConfig(peerId);
    LOG.info(getClientIdAuditPrefix() + " get replication peer config, id=" + peerId + ", config=" + peerConfig);
    if (cpHost != null) {
        cpHost.postGetReplicationPeerConfig(peerId);
    }
    return peerConfig;
}
Also used : ReplicationPeerConfig(org.apache.hadoop.hbase.replication.ReplicationPeerConfig)

Example 42 with ReplicationPeerConfig

use of org.apache.hadoop.hbase.replication.ReplicationPeerConfig in project hbase by apache.

the class VerifyReplication method getPeerQuorumConfig.

private static Pair<ReplicationPeerConfig, Configuration> getPeerQuorumConfig(final Configuration conf) throws IOException {
    ZooKeeperWatcher localZKW = null;
    ReplicationPeerZKImpl peer = null;
    try {
        localZKW = new ZooKeeperWatcher(conf, "VerifyReplication", new Abortable() {

            @Override
            public void abort(String why, Throwable e) {
            }

            @Override
            public boolean isAborted() {
                return false;
            }
        });
        ReplicationPeers rp = ReplicationFactory.getReplicationPeers(localZKW, conf, localZKW);
        rp.init();
        Pair<ReplicationPeerConfig, Configuration> pair = rp.getPeerConf(peerId);
        if (pair == null) {
            throw new IOException("Couldn't get peer conf!");
        }
        return pair;
    } catch (ReplicationException e) {
        throw new IOException("An error occurred while trying to connect to the remove peer cluster", e);
    } finally {
        if (peer != null) {
            peer.close();
        }
        if (localZKW != null) {
            localZKW.close();
        }
    }
}
Also used : ReplicationPeerConfig(org.apache.hadoop.hbase.replication.ReplicationPeerConfig) Configuration(org.apache.hadoop.conf.Configuration) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) ZooKeeperWatcher(org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher) Abortable(org.apache.hadoop.hbase.Abortable) ReplicationPeerZKImpl(org.apache.hadoop.hbase.replication.ReplicationPeerZKImpl) ReplicationException(org.apache.hadoop.hbase.replication.ReplicationException) IOException(java.io.IOException) ReplicationPeers(org.apache.hadoop.hbase.replication.ReplicationPeers)

Aggregations

ReplicationPeerConfig (org.apache.hadoop.hbase.replication.ReplicationPeerConfig)42 Test (org.junit.Test)18 ReplicationException (org.apache.hadoop.hbase.replication.ReplicationException)11 IOException (java.io.IOException)10 ArrayList (java.util.ArrayList)10 List (java.util.List)10 TableName (org.apache.hadoop.hbase.TableName)10 HashMap (java.util.HashMap)8 HashSet (java.util.HashSet)7 Configuration (org.apache.hadoop.conf.Configuration)7 ReplicationAdmin (org.apache.hadoop.hbase.client.replication.ReplicationAdmin)7 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)6 ReplicationPeerNotFoundException (org.apache.hadoop.hbase.ReplicationPeerNotFoundException)6 ZooKeeperWatcher (org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher)6 TreeMap (java.util.TreeMap)5 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)5 HBaseTestingUtility (org.apache.hadoop.hbase.HBaseTestingUtility)5 Map (java.util.Map)4 HColumnDescriptor (org.apache.hadoop.hbase.HColumnDescriptor)4 ReplicationPeerDescription (org.apache.hadoop.hbase.replication.ReplicationPeerDescription)4