private void setUpRPCService() throws StartupException {

    registerInternalRPCService();

    // Notice: During the period between starting the internal RPC service
    // and starting the client RPC service , some requests may fail because
    // DataNode is not marked as RUNNING by ConfigNode-leader yet.

    // Start client RPCService to indicate that the current DataNode provide external services
    IoTDBDescriptor.getInstance()
        .getConfig()
        .setRpcImplClassName(getClientRPCServiceImplClassName());
    if (config.isEnableRpcService()) {
      registerManager.register(ExternalRPCService.getInstance());
    }
    // init service protocols
    initProtocols();
  }
Set up RPC and protocols after DataNode is available
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNode.java