public static Configuration getPeerClusterConfiguration(Configuration conf,
    ReplicationPeerConfig peerConfig) throws IOException {
    Configuration otherConf;
    if (ConnectionRegistryFactory.tryParseAsConnectionURI(peerConfig.getClusterKey()) != null) {
      otherConf = HBaseConfiguration.create(conf);
    } else {
      // only need to apply cluster key for old style cluster key
      otherConf = HBaseConfiguration.createClusterConf(conf, peerConfig.getClusterKey());
    }

    if (!peerConfig.getConfiguration().isEmpty()) {
      CompoundConfiguration compound = new CompoundConfiguration();
      compound.add(otherConf);
      compound.addStringMap(peerConfig.getConfiguration());
      return compound;
    }
    return otherConf;
  }
Returns the configuration needed to talk to the remote slave cluster.
@param conf       the base configuration
@param peerConfig the peer config of replication peer
@return the configuration for the peer cluster, null if it was unable to get the configuration
@throws IOException when create peer cluster configuration failed
hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationPeerConfigUtil.java