@Override
  public void setPeerState(String peerId, boolean enabled) throws ReplicationException {
    Path disabledFile = new Path(getPeerDir(peerId), DISABLED_FILE);
    try {
      if (enabled) {
        if (fs.exists(disabledFile) && !fs.delete(disabledFile, false)) {
          throw new IOException("Can not delete " + disabledFile);
        }
      } else {
        if (!fs.exists(disabledFile) && !fs.createNewFile(disabledFile)) {
          throw new IOException("Can not touch " + disabledFile);
        }
      }
    } catch (IOException e) {
      throw new ReplicationException(
        "Unable to change state of the peer with id=" + peerId + " to " + enabled, e);
    }
  }
A filesystem based replication peer storage. The implementation does not require atomic rename so
you can use it on cloud OSS.
<p/>
FileSystem layout:

<pre>
hbase
  |
  --peers
      |
      --&lt;peer_id&gt;
          |
          --peer_config
          |
          --disabled
          |
          --sync-rep-state
</pre>

Notice that, if the peer is enabled, we will not have a disabled file.
<p/>
And for other files, to avoid depending on atomic rename, we will use two files for storing the
content. When loading, we will try to read both the files and load the newer one. And when
writing, we will write to the older file.
hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/FSReplicationPeerStorage.java