public static void main(final String[] args) throws Exception {

        if (args == null || args.length != 3) {
            System.out.println("Parameter error. Need 3 params : \n"
                    + "1) replication group name,\n"
                    + "2) replication group helperHost(ip:port),\n"
                    + "3) node name in replication group to be removed.");
            return;
        }

        Set<InetSocketAddress> helpers = new HashSet<>();
        String group = args[0];
        String[] hostAndPort = args[1].split(":");
        if (hostAndPort.length != 2) {
            System.out.println("replication group helperHost(ip:port) format error.");
            return;
        }
        String nodeName2Remove = args[2];
        InetSocketAddress helper =
                new InetSocketAddress(hostAndPort[0], Integer.parseInt(hostAndPort[1]));
        helpers.add(helper);
        ReplicationGroupAdmin rga = new ReplicationGroupAdmin(group, helpers);

        try {
            // print node information before remove
            Set<String> nodeNames = new HashSet<>();
            for (ReplicationNode repNode : rga.getGroup().getNodes()) {
                nodeNames.add(repNode.getName());
            }
            System.out.println("Before remove, " + group
                    + " has " + nodeNames.size() + " nodes :" + nodeNames);

            // do remove node
            rga.removeMember(nodeName2Remove);
            System.out.print("Remove " + nodeName2Remove + "successfully.");

            // print node information after remove
            nodeNames.clear();
            for (ReplicationNode repNode : rga.getGroup().getNodes()) {
                nodeNames.add(repNode.getName());
            }
            System.out.println("After remove, " + group
                    + " has " + nodeNames.size() + " nodes :" + nodeNames);

        } catch (UnknownMasterException e) {
            System.out.println("Can't find active master node.");
        } catch (MemberNotFoundException e) {
            System.out.println("Node name to remove is unknown to the replication group,"
                    + " please use the correct node name.");
        } catch (MasterStateException e) {
            System.out.println("Master node is not allowed to remove. To remove the active Master, "
                    + "either shut it down or wait until it transitions to the Replica state.");
        } catch (EnvironmentFailureException e) {
            System.out.println("Replication group environment failed.");
        }
    }
Remove a node from a BDB-JE replication group.
@param args   Startup parameter array, including the following parts:
              The 1st parameter is replication group name;
              The 2nd parameter is helperHost address, format is ip:port;
              The 3nd parameter is need remove node name.
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/tools/BdbGroupAdmin.java