You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2021/02/19 06:32:49 UTC
[iotdb] branch change_rpc_port updated: merge with master ;
andd cluster test configure files
This is an automated email from the ASF dual-hosted git repository.
hxd pushed a commit to branch change_rpc_port
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/change_rpc_port by this push:
new 3497395 merge with master ; andd cluster test configure files
3497395 is described below
commit 34973950cab2b59ba4f0fabf0f1b18048c21b978
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Fri Feb 19 14:31:59 2021 +0800
merge with master ; andd cluster test configure files
---
.../resources/conf/iotdb-cluster.properties | 4 +
.../java/org/apache/iotdb/cluster/ClusterMain.java | 129 +--------------------
.../src/test/resources/iotdb-cluster-1.properties | 1 -
.../src/test/resources/iotdb-cluster-2.properties | 1 -
.../src/test/resources/iotdb-cluster-3.properties | 1 -
.../src/test/resources/iotdb-engine-2.properties | 2 +-
.../src/test/resources/iotdb-engine-3.properties | 2 +-
7 files changed, 12 insertions(+), 128 deletions(-)
diff --git a/cluster/src/assembly/resources/conf/iotdb-cluster.properties b/cluster/src/assembly/resources/conf/iotdb-cluster.properties
index 82ec45d..5f45800 100644
--- a/cluster/src/assembly/resources/conf/iotdb-cluster.properties
+++ b/cluster/src/assembly/resources/conf/iotdb-cluster.properties
@@ -33,6 +33,10 @@ internal_meta_port=9003
# port for data service
internal_data_port=40010
+# whether open port for server module (for debug purpose)
+# if true, the ip will be rpc_port (in iotdb-engines.properties) + 1
+open_server_rpc_port=true
+
# comma-separated {IP/DOMAIN}:meta_port:data_port:client_port pairs
# when used by start-node.sh(.bat), this configuration means the nodes that will form the initial
# cluster, some every node that use start-node.sh(.bat) should have the SAME SEED_NODES, or the
diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java b/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java
index d05a305..5fc806c 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java
@@ -92,15 +92,15 @@ public class ClusterMain {
IoTDBDescriptor.getInstance().getConfig().setAutoCreateSchemaEnabled(false);
// params check
- if (!checkConfig()) {
- return;
+ try {
+ ClusterDescriptor.getInstance().replaceHostnameWithIp();
+ } catch (Exception e) {
+ logger.error("replace hostname with ip failed, {}", e.getMessage());
+ return ;
}
String mode = args[0];
- if (args.length > 1) {
- String[] params = Arrays.copyOfRange(args, 1, args.length);
- replaceDefaultProps(params);
- }
+
logger.info("Running mode {}", mode);
if (MODE_START.equals(mode)) {
@@ -189,125 +189,8 @@ public class ClusterMain {
}
}
- /**
- * check the configuration is legal or not
- */
- private static boolean checkConfig() {
- // 0. first replace all hostname with ip
- try {
- ClusterDescriptor.getInstance().replaceHostnameWithIp();
- } catch (Exception e) {
- logger.error("replace hostname with ip failed, {}", e.getMessage());
- return false;
- }
-
- // 1. check the cluster_rpc_ip and seed_nodes consistent or not
- // when rpc_address is 127.0.0.1, the entire cluster must be start locally
- ClusterConfig config = ClusterDescriptor.getInstance().getConfig();
- String localhostIp = "127.0.0.1";
- String rpcIp = IoTDBDescriptor.getInstance().getConfig().getRpcAddress();
- List<String> seedNodes = config.getSeedNodeUrls();
- boolean isLocalCluster = localhostIp.equals(rpcIp);
- for (String seedNodeIP : seedNodes) {
- if ((isLocalCluster && !seedNodeIP.contains(localhostIp)) ||
- (!isLocalCluster && seedNodeIP.contains(localhostIp))) {
- logger.error(
- "rpc_ip={} and seed_nodes={} should be consistent, both use local ip or real ip please",
- rpcIp, seedNodes);
- return false;
- }
- }
- return true;
- }
-
-
- private static void replaceDefaultProps(String[] params) {
- Options options = new Options();
-// Option metaPort = new Option(OPTION_INTERVAL_META_PORT, OPTION_INTERVAL_META_PORT, true,
-// "port for metadata service");
-// metaPort.setRequired(false);
-// options.addOption(metaPort);
-//
-// Option dataPort = new Option(OPTION_INTERVAL_DATA_PORT, OPTION_INTERVAL_DATA_PORT, true,
-// "port for data service");
-// dataPort.setRequired(false);
-// options.addOption(dataPort);
-//
-// Option clusterRpcPort = new Option(OPTION_CLUSTER_RPC_PORT, OPTION_CLUSTER_RPC_PORT, true,
-// "port for client service");
-// clusterRpcPort.setRequired(false);
-// options.addOption(clusterRpcPort);
-//
-// Option clusterRpcIP = new Option(OPTION_CLUSTER_RPC_IP, OPTION_CLUSTER_RPC_IP, true,
-// "IP for client service");
-// clusterRpcIP.setRequired(false);
-// options.addOption(clusterRpcIP);
-//
-// Option seedNodes = new Option(OPTION_SEED_NODES, OPTION_SEED_NODES, true,
-// "comma-separated {IP/DOMAIN}:meta_port:data_port:client_port pairs");
-// seedNodes.setRequired(false);
-// options.addOption(seedNodes);
-//
-// Option debugRpcPort = new Option(OPTION_DEBUG_RPC_PORT, OPTION_DEBUG_RPC_PORT, true,
-// "port for debug client service (using single node mode)");
-// clusterRpcPort.setRequired(false);
-// options.addOption(debugRpcPort);
- CommandLine commandLine = parseCommandLine(options, params);
- if (commandLine == null) {
- logger.error("replaces properties failed, use default conf params");
- } else {
-// ClusterConfig clusterConfig = ClusterDescriptor.getInstance().getConfig();
-// if (commandLine.hasOption(OPTION_INTERVAL_META_PORT)) {
-// clusterConfig.setInternalMetaPort(Integer.parseInt(commandLine.getOptionValue(
-// OPTION_INTERVAL_META_PORT)));
-// logger.debug("replace local meta port with={}", clusterConfig.getInternalMetaPort());
-// }
-//
-// if (commandLine.hasOption(OPTION_INTERVAL_DATA_PORT)) {
-// clusterConfig.setInternalDataPort(Integer.parseInt(commandLine.getOptionValue(
-// OPTION_INTERVAL_DATA_PORT)));
-// logger.debug("replace local data port with={}", clusterConfig.getInternalDataPort());
-// }
-//
-// if (commandLine.hasOption(OPTION_CLUSTER_RPC_PORT)) {
-// clusterConfig.setClusterRpcPort(Integer.parseInt(commandLine.getOptionValue(
-// OPTION_CLUSTER_RPC_PORT)));
-// logger.debug("replace local cluster rpc port with={}", clusterConfig.getClusterRpcPort());
-// }
-//
-// if (commandLine.hasOption(OPTION_CLUSTER_RPC_IP)) {
-// IoTDBDescriptor.getInstance().getConfig()
-// .setRpcAddress(commandLine.getOptionValue(OPTION_CLUSTER_RPC_IP));
-// logger.debug("replace local cluster rpc port with={}", clusterConfig.getClusterRpcPort());
-// }
-//
-// if (commandLine.hasOption(OPTION_SEED_NODES)) {
-// String seedNodeUrls = commandLine.getOptionValue(OPTION_SEED_NODES);
-// clusterConfig.setSeedNodeUrls(ClusterDescriptor.getSeedUrlList(seedNodeUrls));
-// logger.debug("replace seed nodes with={}", clusterConfig.getSeedNodeUrls());
-// }
-//
-// if (commandLine.hasOption(OPTION_DEBUG_RPC_PORT)) {
-// IoTDBDescriptor.getInstance().getConfig().setRpcPort(Integer.parseInt(commandLine.getOptionValue(
-// OPTION_DEBUG_RPC_PORT)));
-// IoTDBDescriptor.getInstance().getConfig().setEnableRPCService(true);
-// logger.debug("replace local cluster (single node) rpc port with={}", commandLine.getOptionValue(
-// OPTION_DEBUG_RPC_PORT));
-// }
- }
- }
-
- private static CommandLine parseCommandLine(Options options, String[] params) {
- try {
- CommandLineParser parser = new DefaultParser();
- return parser.parse(options, params);
- } catch (ParseException e) {
- logger.error("parse conf params failed", e);
- return null;
- }
- }
private static void doRemoveNode(String[] args) throws IOException {
if (args.length != 3) {
diff --git a/cluster/src/test/resources/iotdb-cluster-1.properties b/cluster/src/test/resources/iotdb-cluster-1.properties
index 996b347..c22643a 100644
--- a/cluster/src/test/resources/iotdb-cluster-1.properties
+++ b/cluster/src/test/resources/iotdb-cluster-1.properties
@@ -17,7 +17,6 @@
# under the License.
#
-cluster_rpc_ip=127.0.0.1
internal_ip=127.0.0.1
internal_meta_port=9003
diff --git a/cluster/src/test/resources/iotdb-cluster-2.properties b/cluster/src/test/resources/iotdb-cluster-2.properties
index ad0f09a..9103d1c 100644
--- a/cluster/src/test/resources/iotdb-cluster-2.properties
+++ b/cluster/src/test/resources/iotdb-cluster-2.properties
@@ -17,7 +17,6 @@
# under the License.
#
-cluster_rpc_ip=127.0.0.1
internal_ip=127.0.0.1
internal_meta_port=9005
diff --git a/cluster/src/test/resources/iotdb-cluster-3.properties b/cluster/src/test/resources/iotdb-cluster-3.properties
index 7d7d94a..a5b88fb 100644
--- a/cluster/src/test/resources/iotdb-cluster-3.properties
+++ b/cluster/src/test/resources/iotdb-cluster-3.properties
@@ -17,7 +17,6 @@
# under the License.
#
-cluster_rpc_ip=127.0.0.1
internal_ip=127.0.0.1
internal_meta_port=9007
diff --git a/cluster/src/test/resources/iotdb-engine-2.properties b/cluster/src/test/resources/iotdb-engine-2.properties
index ecdffea..9ad8a44 100644
--- a/cluster/src/test/resources/iotdb-engine-2.properties
+++ b/cluster/src/test/resources/iotdb-engine-2.properties
@@ -23,7 +23,7 @@ index_root_dir=target/index2
udf_root_dir=target/ext2
tracing_dir=target/data/tracing2
-rpc_port=6668
+rpc_port=6669
metrics_port=8182
sync_server_port=5556
mqtt_port=1884
\ No newline at end of file
diff --git a/cluster/src/test/resources/iotdb-engine-3.properties b/cluster/src/test/resources/iotdb-engine-3.properties
index 1269f45..c2723d2 100644
--- a/cluster/src/test/resources/iotdb-engine-3.properties
+++ b/cluster/src/test/resources/iotdb-engine-3.properties
@@ -23,7 +23,7 @@ index_root_dir=target/index3
udf_root_dir=target/ext3
tracing_dir=target/data/tracing3
-rpc_port=6669
+rpc_port=6671
metrics_port=8183
sync_server_port=5557
mqtt_port=1885
\ No newline at end of file