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
commit 1a6ce0868abb6e73af01daa09d6c98afbe984fe7 Author: xiangdong huang <[email protected]> AuthorDate: Mon Feb 15 13:40:44 2021 +0800 fix merge conflict --- .../java/org/apache/iotdb/cluster/ClusterMain.java | 32 ++++------------ .../iotdb/cluster/client/DataClientProvider.java | 2 +- .../cluster/server/member/RaftMemberMBean.java | 2 +- .../apache/iotdb/cluster/utils/ClusterNode.java | 4 +- .../apache/iotdb/cluster/utils/ClusterUtils.java | 3 +- .../src/test/resources/iotdb-cluster-1.properties | 43 ++++++++++++++++++++++ .../src/test/resources/iotdb-cluster-2.properties | 43 ++++++++++++++++++++++ .../src/test/resources/iotdb-cluster-3.properties | 43 ++++++++++++++++++++++ .../src/test/resources/iotdb-engine-1.properties | 29 +++++++++++++++ .../src/test/resources/iotdb-engine-2.properties | 29 +++++++++++++++ .../src/test/resources/iotdb-engine-3.properties | 29 +++++++++++++++ 11 files changed, 230 insertions(+), 29 deletions(-) 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 224eace..236c38c 100644 --- a/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java +++ b/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java @@ -32,6 +32,7 @@ import org.apache.commons.cli.ParseException; import org.apache.iotdb.cluster.client.async.AsyncMetaClient; import org.apache.iotdb.cluster.client.sync.SyncClientAdaptor; import org.apache.iotdb.cluster.config.ClusterConfig; +import org.apache.iotdb.cluster.config.ClusterConstant; import org.apache.iotdb.cluster.config.ClusterDescriptor; import org.apache.iotdb.cluster.exception.ConfigInconsistentException; import org.apache.iotdb.cluster.exception.StartUpCheckFailureException; @@ -41,6 +42,7 @@ import org.apache.iotdb.cluster.rpc.thrift.Node; import org.apache.iotdb.cluster.server.MetaClusterServer; import org.apache.iotdb.cluster.server.Response; import org.apache.iotdb.cluster.utils.ClusterUtils; +import org.apache.iotdb.db.conf.IoTDBConstant; import org.apache.iotdb.db.conf.IoTDBDescriptor; import org.apache.iotdb.db.exception.StartupException; import org.apache.iotdb.db.exception.query.QueryProcessException; @@ -65,37 +67,18 @@ public class ClusterMain { // metaport-of-removed-node private static final String MODE_REMOVE = "-r"; - private static final String OPTION_INTERVAL_META_PORT = "internal_meta_port"; - private static final String OPTION_INTERVAL_DATA_PORT = "internal_data_port"; - private static final String OPTION_CLUSTER_RPC_PORT = "rpc_port"; - private static final String OPTION_SEED_NODES = "seed_nodes"; - private static final String OPTION_DEBUG_RPC_PORT = "debug_rpc_port"; - private static final String OPTION_CLUSTER_RPC_IP = "rpc_address"; - private static MetaClusterServer metaServer; public static void main(String[] args) { if (args.length < 1) { logger.error("Usage: <-s|-a|-r> " - + "[-{} <internal meta port>] " - + "[-{} <internal data port>] " - + "[-{} <cluster rpc port>] " - + "[-{} <cluster RPC address>]\n" - + "[-{} <node1:meta_port:data_port:cluster_rpc_port," - + "node2:meta_port:data_port:cluster_rpc_port," - + "...,noden:meta_port:data_port:cluster_rpc_port,>] " - + "[-{} <debug rpc port>]" + + "[-D{} <cluster module configure file>] " + + "[-D{} <server module configure file>] " + "-s: start the node as a seed\n" + "-a: start the node as a new node\n" - + "-r: remove the node out of the cluster\n" - + "or: set CLUSTER_CONF and IOTDB_CONF environment variable", - OPTION_INTERVAL_META_PORT, - OPTION_INTERVAL_DATA_PORT, - OPTION_CLUSTER_RPC_PORT, - OPTION_CLUSTER_RPC_IP, - OPTION_SEED_NODES, - //debug rpc is for starting another rpc port for the singleton IoTDB server. - OPTION_DEBUG_RPC_PORT + + "-r: remove the node out of the cluster\n", + ClusterConstant.CLUSTER_CONF, + IoTDBConstant.IOTDB_CONF ); return; @@ -105,6 +88,7 @@ public class ClusterMain { // the server's configuration. IoTDBDescriptor.getInstance().getConfig().setEnableRPCService(false); IoTDBDescriptor.getInstance().getConfig().setSyncEnable(false); + //auto create schema is took over by cluster module, so we disable it in the server module. IoTDBDescriptor.getInstance().getConfig().setAutoCreateSchemaEnabled(false); // params check diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/client/DataClientProvider.java b/cluster/src/main/java/org/apache/iotdb/cluster/client/DataClientProvider.java index df35039..9a1c4df 100644 --- a/cluster/src/main/java/org/apache/iotdb/cluster/client/DataClientProvider.java +++ b/cluster/src/main/java/org/apache/iotdb/cluster/client/DataClientProvider.java @@ -46,7 +46,7 @@ public class DataClientProvider { if (!ClusterDescriptor.getInstance().getConfig().isUseAsyncServer()) { dataSyncClientPool = new SyncClientPool(new SyncDataClient.FactorySync(factory)); } else { - dataAsyncClientPool = new AsyncClientPool("dataClientProvider", new FactoryAsync(factory)); + dataAsyncClientPool = new AsyncClientPool(new FactoryAsync(factory)); } } diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/server/member/RaftMemberMBean.java b/cluster/src/main/java/org/apache/iotdb/cluster/server/member/RaftMemberMBean.java index 87150b2..48af171 100644 --- a/cluster/src/main/java/org/apache/iotdb/cluster/server/member/RaftMemberMBean.java +++ b/cluster/src/main/java/org/apache/iotdb/cluster/server/member/RaftMemberMBean.java @@ -23,7 +23,7 @@ import java.util.List; import java.util.Map; import org.apache.iotdb.cluster.rpc.thrift.Node; import org.apache.iotdb.cluster.server.NodeCharacter; -import org.apache.iotdb.cluster.server.Peer; +import org.apache.iotdb.cluster.server.monitor.Peer; /** * interfaces that the mbean of RaftMember will use diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterNode.java b/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterNode.java index 1e5b15b..334c90f 100644 --- a/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterNode.java +++ b/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterNode.java @@ -32,8 +32,8 @@ public class ClusterNode extends Node { public ClusterNode() { } - public ClusterNode(String ip, int metaPort, int nodeIdentifier, int dataPort) { - super(ip, metaPort, nodeIdentifier, dataPort); + public ClusterNode(String ip, int metaPort, int nodeIdentifier, int dataPort, int clientPort) { + super(ip, metaPort, nodeIdentifier, dataPort, clientPort); } public ClusterNode(Node other) { diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterUtils.java b/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterUtils.java index cb8c0b6..7919595 100644 --- a/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterUtils.java +++ b/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterUtils.java @@ -282,8 +282,9 @@ public class ClusterUtils { int metaPort = Integer.parseInt(str.substring(metaPortFirstPos, metaPortLastPos)); int id = Integer.parseInt(str.substring(idFirstPos, idLastPos)); int dataPort = Integer.parseInt(str.substring(dataPortFirstPos, dataPortLastPos)); + int clientPort = Integer.parseInt(str.substring(clientPortFirstPos, clientPortLastPos)); //TODO hxd: we do not set values to all fields of a Node. - return new Node(ip, metaPort, id, dataPort); + return new Node(ip, metaPort, id, dataPort, clientPort); } public static Node parseNode(String nodeUrl) { diff --git a/cluster/src/test/resources/iotdb-cluster-1.properties b/cluster/src/test/resources/iotdb-cluster-1.properties new file mode 100644 index 0000000..996b347 --- /dev/null +++ b/cluster/src/test/resources/iotdb-cluster-1.properties @@ -0,0 +1,43 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +cluster_rpc_ip=127.0.0.1 +internal_ip=127.0.0.1 + +internal_meta_port=9003 +internal_data_port=40010 + +seed_nodes=127.0.0.1:9003:40010:6667,127.0.0.1:9005:40012:6668,127.0.0.1:9007:40014:6669 + +default_replica_num=2 +consistency_level=mid + +connection_timeout_ms=20000 +write_operation_timeout_ms=30000 +read_operation_timeout_ms=30000 +catch_up_timeout_ms=300000 +use_batch_in_catch_up=true +min_num_of_logs_in_mem=1000 +max_num_of_logs_in_mem=2000 +log_deletion_check_interval_second=-1 + + +is_use_async_server=false +is_use_async_applier=true +is_enable_raft_log_persistence=true diff --git a/cluster/src/test/resources/iotdb-cluster-2.properties b/cluster/src/test/resources/iotdb-cluster-2.properties new file mode 100644 index 0000000..ad0f09a --- /dev/null +++ b/cluster/src/test/resources/iotdb-cluster-2.properties @@ -0,0 +1,43 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +cluster_rpc_ip=127.0.0.1 +internal_ip=127.0.0.1 + +internal_meta_port=9005 +internal_data_port=40012 + +seed_nodes=127.0.0.1:9003:40010:6667,127.0.0.1:9005:40012:6668,127.0.0.1:9007:40014:6669 + +default_replica_num=2 +consistency_level=mid + +connection_timeout_ms=20000 +write_operation_timeout_ms=30000 +read_operation_timeout_ms=30000 +catch_up_timeout_ms=300000 +use_batch_in_catch_up=true +min_num_of_logs_in_mem=1000 +max_num_of_logs_in_mem=2000 +log_deletion_check_interval_second=-1 + + +is_use_async_server=false +is_use_async_applier=true +is_enable_raft_log_persistence=true diff --git a/cluster/src/test/resources/iotdb-cluster-3.properties b/cluster/src/test/resources/iotdb-cluster-3.properties new file mode 100644 index 0000000..7d7d94a --- /dev/null +++ b/cluster/src/test/resources/iotdb-cluster-3.properties @@ -0,0 +1,43 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +cluster_rpc_ip=127.0.0.1 +internal_ip=127.0.0.1 + +internal_meta_port=9007 +internal_data_port=40014 + +seed_nodes=127.0.0.1:9003:40010:6667,127.0.0.1:9005:40012:6668,127.0.0.1:9007:40014:6669 + +default_replica_num=2 +consistency_level=mid + +connection_timeout_ms=20000 +write_operation_timeout_ms=30000 +read_operation_timeout_ms=30000 +catch_up_timeout_ms=300000 +use_batch_in_catch_up=true +min_num_of_logs_in_mem=1000 +max_num_of_logs_in_mem=2000 +log_deletion_check_interval_second=-1 + + +is_use_async_server=false +is_use_async_applier=true +is_enable_raft_log_persistence=true diff --git a/cluster/src/test/resources/iotdb-engine-1.properties b/cluster/src/test/resources/iotdb-engine-1.properties new file mode 100644 index 0000000..f21cda6 --- /dev/null +++ b/cluster/src/test/resources/iotdb-engine-1.properties @@ -0,0 +1,29 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +# +#http://www.apache.org/licenses/LICENSE-2.0 +# +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. + + +base_dir=target/tmp1 +data_dirs=target/data1 +wal_dir=target/wal1 +index_root_dir=target/index1 +udf_root_dir=target/ext1 +tracing_dir=target/data/tracing1 + +rpc_port=6667 +metrics_port=8181 +sync_server_port=5555 +mqtt_port=1883 \ No newline at end of file diff --git a/cluster/src/test/resources/iotdb-engine-2.properties b/cluster/src/test/resources/iotdb-engine-2.properties new file mode 100644 index 0000000..ecdffea --- /dev/null +++ b/cluster/src/test/resources/iotdb-engine-2.properties @@ -0,0 +1,29 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +# +#http://www.apache.org/licenses/LICENSE-2.0 +# +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. + + +base_dir=target/tmp2 +data_dirs=target/data2 +wal_dir=target/wal2 +index_root_dir=target/index2 +udf_root_dir=target/ext2 +tracing_dir=target/data/tracing2 + +rpc_port=6668 +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 new file mode 100644 index 0000000..1269f45 --- /dev/null +++ b/cluster/src/test/resources/iotdb-engine-3.properties @@ -0,0 +1,29 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +# +#http://www.apache.org/licenses/LICENSE-2.0 +# +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. + + +base_dir=target/tmp3 +data_dirs=target/data3 +wal_dir=target/wal3 +index_root_dir=target/index3 +udf_root_dir=target/ext3 +tracing_dir=target/data/tracing3 + +rpc_port=6669 +metrics_port=8183 +sync_server_port=5557 +mqtt_port=1885 \ No newline at end of file
