@Override
  public void addRemotePeer(ConsensusGroupId groupId, Peer peer) throws ConsensusException {
    RaftGroupId raftGroupId = Utils.fromConsensusGroupIdToRaftGroupId(groupId);

    RaftGroup group = getGroupInfo(raftGroupId);
    // pre-conditions: group exists and myself in this group
    if (group == null || !group.getPeers().contains(myself)) {
      throw new ConsensusGroupNotExistException(groupId);
    }

    RaftPeer peerToAdd = Utils.fromPeerAndPriorityToRaftPeer(peer, DEFAULT_PRIORITY);
    // pre-condition: peer not in this group
    if (group.getPeers().stream()
        .anyMatch(
            p ->
                p.getId().equals(peerToAdd.getId())
                    || p.getAddress().equals(peerToAdd.getAddress()))) {
      logger.warn(
          "{}: try to add a peer {} with conflicting id or address in {}",
          this,
          peerToAdd,
          group.getPeers());
      throw new PeerAlreadyInConsensusGroupException(groupId, peer);
    }

    List<RaftPeer> newConfig = new ArrayList<>(group.getPeers());
    newConfig.add(peerToAdd);

    sendReconfiguration(RaftGroup.valueOf(raftGroupId, newConfig));
  }
Add a new IConsensus Peer into ConsensusGroup with groupId

<p>underlying Ratis will 1. call the AdminApi to notify group leader of this configuration
change
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java