You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by do...@apache.org on 2019/04/24 08:38:16 UTC
[incubator-iotdb] branch cluster updated: update script
This is an automated email from the ASF dual-hosted git repository.
dope pushed a commit to branch cluster
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/cluster by this push:
new 18962ba update script
18962ba is described below
commit 18962baac4ff50b9d744ba1e7ee71e442c5c32b2
Author: MyXOF <xu...@163.com>
AuthorDate: Wed Apr 24 16:38:05 2019 +0800
update script
---
cluster/script/deploy.sh | 14 ++--
cluster/script/stop.sh | 16 +++--
.../integration/IoTDBMetadataFetchRemoteIT.java | 78 +++++++++++-----------
.../cluster/utils/ClusterConfigureGenerator.java | 17 +++--
4 files changed, 71 insertions(+), 54 deletions(-)
diff --git a/cluster/script/deploy.sh b/cluster/script/deploy.sh
index 9873632..b842c80 100755
--- a/cluster/script/deploy.sh
+++ b/cluster/script/deploy.sh
@@ -21,18 +21,24 @@
## Only for test
nodes=$1
-if [ $nodes == "3" ]
+if [ $nodes == "1" ]
then
- iplist=('192.168.130.14' '192.168.130.16' '192.168.130.18')
+ iplist=('192.168.130.14')
+elif [ $nodes == "3" ]
+then
+ iplist=('192.168.130.12' '192.168.130.15' '192.168.130.14')
elif [ $nodes == "5" ]
then
iplist=('192.168.130.12' '192.168.130.13' '192.168.130.14' '192.168.130.16' '192.168.130.18')
elif [ $nodes == "7" ]
then
- iplist=('192.168.130.9' '192.168.130.12' '192.168.130.13' '192.168.130.14' '192.168.130.15' '192.168.130.16' '192.168.130.18')
+ iplist=('192.168.130.8' '192.168.130.12' '192.168.130.13' '192.168.130.14' '192.168.130.15' '192.168.130.16' '192.168.130.18')
+elif [ $nodes == "9" ]
+then
+ iplist=('192.168.130.6' '192.168.130.7' '192.168.130.8' '192.168.130.12' '192.168.130.13' '192.168.130.14' '192.168.130.15' '192.168.130.16' '192.168.130.18')
elif [ $nodes == "10" ]
then
- iplist=('192.168.130.8' '192.168.130.9' '192.168.130.10' '192.168.130.9' '192.168.130.12' '192.168.130.13' '192.168.130.14' '192.168.130.15' '192.168.130.16' '192.168.130.18')
+ iplist=('192.168.130.5' '192.168.130.6' '192.168.130.7' '192.168.130.8' '192.168.130.12' '192.168.130.13' '192.168.130.14' '192.168.130.15' '192.168.130.16' '192.168.130.18')
else
echo "node number error"
exit 1;
diff --git a/cluster/script/stop.sh b/cluster/script/stop.sh
index c54784b..583445c 100755
--- a/cluster/script/stop.sh
+++ b/cluster/script/stop.sh
@@ -20,18 +20,24 @@
## Only for test
nodes=$1
-if [ $nodes == "3" ]
+if [ $nodes == "1" ]
then
- iplist=('192.168.130.14' '192.168.130.16' '192.168.130.18')
+ iplist=('192.168.130.14')
+elif [ $nodes == "3" ]
+then
+ iplist=('192.168.130.12' '192.168.130.15' '192.168.130.14')
elif [ $nodes == "5" ]
then
iplist=('192.168.130.12' '192.168.130.13' '192.168.130.14' '192.168.130.16' '192.168.130.18')
elif [ $nodes == "7" ]
then
- iplist=('192.168.130.9' '192.168.130.12' '192.168.130.13' '192.168.130.14' '192.168.130.15' '192.168.130.16' '192.168.130.18')
+ iplist=('192.168.130.8' '192.168.130.12' '192.168.130.13' '192.168.130.14' '192.168.130.15' '192.168.130.16' '192.168.130.18')
+elif [ $nodes == "9" ]
+then
+ iplist=('192.168.130.6' '192.168.130.7' '192.168.130.8' '192.168.130.12' '192.168.130.13' '192.168.130.14' '192.168.130.15' '192.168.130.16' '192.168.130.18')
elif [ $nodes == "10" ]
then
- iplist=('192.168.130.8' '192.168.130.9' '192.168.130.10' '192.168.130.9' '192.168.130.12' '192.168.130.13' '192.168.130.14' '192.168.130.15' '192.168.130.16' '192.168.130.18')
+ iplist=('192.168.130.5' '192.168.130.6' '192.168.130.7' '192.168.130.8' '192.168.130.12' '192.168.130.13' '192.168.130.14' '192.168.130.15' '192.168.130.16' '192.168.130.18')
else
echo "node number error"
exit 1;
@@ -41,7 +47,7 @@ for ip in ${iplist[@]}
do
ssh fit@$ip "chmod a+x /home/fit/xuyi/incubator-iotdb/iotdb/iotdb/bin/stop-cluster.sh"
ssh fit@$ip "sh /home/fit/xuyi/incubator-iotdb/iotdb/iotdb/bin/stop-cluster.sh"
+ ssh fit@$ip "sh /home/fit/xuyi/incubator-iotdb/iotdb/iotdb/bin/stop-server.sh"
ssh fit@$ip "rm -rf /home/fit/xuyi/incubator-iotdb/iotdb/iotdb/data"
ssh fit@$ip "rm -rf /home/fit/xuyi/incubator-iotdb/iotdb/iotdb/logs"
done
-
diff --git a/cluster/src/test/java/org/apache/iotdb/cluster/integration/IoTDBMetadataFetchRemoteIT.java b/cluster/src/test/java/org/apache/iotdb/cluster/integration/IoTDBMetadataFetchRemoteIT.java
index 2e952ec..f601f14 100644
--- a/cluster/src/test/java/org/apache/iotdb/cluster/integration/IoTDBMetadataFetchRemoteIT.java
+++ b/cluster/src/test/java/org/apache/iotdb/cluster/integration/IoTDBMetadataFetchRemoteIT.java
@@ -29,41 +29,43 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-<<<<<<< HEAD
-//public class IoTDBMetadataFetchRemoteIT extends IoTDBMetadataFetchAbstract{
-// @BeforeClass
-// public static void setUp() throws Exception {
-// Class.forName(Config.JDBC_DRIVER_NAME);
-// ClusterConfigureGenerator.generateClusterConfigure();
-// }
-//
-// @AfterClass
-// public static void tearDown() throws Exception {
-// ClusterConfigureGenerator.deleteClusterConfigure();
-// }
-//
-// @Test
-// public void test() throws IOException {
-// String dir = Utils.getCurrentPath("pwd");
-//// startScript("sh", dir + File.separator + "script" + File.separator + "deploy.sh", "7", "1", dir);
-// startScript("sh", dir + File.separator + "script" + File.separator + "stop.sh", "7", "3", dir);
-// }
-//
-// private void startScript(String... command) throws IOException {
-// ProcessBuilder builder = new ProcessBuilder(command);
-// builder.redirectErrorStream(true);
-// Process p = builder.start();
-// BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
-// String line;
-// while (true) {
-// line = r.readLine();
-// if (line == null) {
-// break;
-// } else {
-// System.out.println(line);
-// }
-// }
-// r.close();
-// p.destroy();
-// }
-//}
\ No newline at end of file
+
+public class IoTDBMetadataFetchRemoteIT extends IoTDBMetadataFetchAbstract{
+ @BeforeClass
+ public static void setUp() throws Exception {
+ Class.forName(Config.JDBC_DRIVER_NAME);
+ ClusterConfigureGenerator.generateClusterConfigure();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ ClusterConfigureGenerator.deleteClusterConfigure();
+ }
+
+ @Test
+ public void test() throws IOException {
+ String dir = Utils.getCurrentPath("pwd");
+ String node = "3";
+ String replicator = "3";
+ startScript("sh", dir + File.separator + "script" + File.separator + "deploy.sh", node, replicator, dir);
+ startScript("sh", dir + File.separator + "script" + File.separator + "stop.sh", node, replicator, dir);
+ }
+
+ private void startScript(String... command) throws IOException {
+ ProcessBuilder builder = new ProcessBuilder(command);
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ System.out.println(line);
+ }
+ }
+ r.close();
+ p.destroy();
+ }
+}
\ No newline at end of file
diff --git a/cluster/src/test/java/org/apache/iotdb/cluster/utils/ClusterConfigureGenerator.java b/cluster/src/test/java/org/apache/iotdb/cluster/utils/ClusterConfigureGenerator.java
index 8668203..b03aa1b 100644
--- a/cluster/src/test/java/org/apache/iotdb/cluster/utils/ClusterConfigureGenerator.java
+++ b/cluster/src/test/java/org/apache/iotdb/cluster/utils/ClusterConfigureGenerator.java
@@ -34,7 +34,7 @@ public class ClusterConfigureGenerator {
+ File.separatorChar + "resources" + File.separatorChar + "conf";
private static Map<String, String> configMap = new HashMap<String, String>() {{
put("qp_task_timeout_ms", "10000");
- put("election_timeout_ms", "50000");
+// put("election_timeout_ms", "10000");
}};
public static void generateClusterConfigure() throws IOException {
@@ -42,14 +42,17 @@ public class ClusterConfigureGenerator {
File f = new File(TEST_CONF_PATH);
FileUtils.forceMkdir(f);
String[][] config = {
- {"192.168.130.14:8888,192.168.130.16:8888,192.168.130.18:8888", "1"},
- {"192.168.130.14:8888,192.168.130.16:8888,192.168.130.18:8888", "3"},
+ {"192.168.130.14:8888", "1"},
+ {"192.168.130.12:8888,192.168.130.14:8888,192.168.130.15:8888", "1"},
+ {"192.168.130.12:8888,192.168.130.14:8888,192.168.130.15:8888", "3"},
{"192.168.130.12:8888,192.168.130.13:8888,192.168.130.14:8888,192.168.130.16:8888,192.168.130.18:8888", "1"},
{"192.168.130.12:8888,192.168.130.13:8888,192.168.130.14:8888,192.168.130.16:8888,192.168.130.18:8888", "3"},
- {"192.168.130.9:8888,192.168.130.12:8888,192.168.130.13:8888,192.168.130.14:8888,192.168.130.15:8888,192.168.130.16:8888,192.168.130.18:8888", "1"},
- {"192.168.130.9:8888,192.168.130.12:8888,192.168.130.13:8888,192.168.130.14:8888,192.168.130.15:8888,192.168.130.16:8888,192.168.130.18:8888", "3"},
- {"192.168.130.8:8888,192.168.130.9:8888,192.168.130.10:8888,192.168.130.7:8888,192.168.130.12:8888,192.168.130.13:8888,192.168.130.14:8888,192.168.130.15:8888,192.168.130.16:8888,192.168.130.18:8888", "3"},
- {"192.168.130.8:8888,192.168.130.9:8888,192.168.130.10:8888,192.168.130.7:8888,192.168.130.12:8888,192.168.130.13:8888,192.168.130.14:8888,192.168.130.15:8888,192.168.130.16:8888,192.168.130.18:8888", "5"},
+ {"192.168.130.8:8888,192.168.130.12:8888,192.168.130.13:8888,192.168.130.14:8888,192.168.130.15:8888,192.168.130.16:8888,192.168.130.18:8888", "1"},
+ {"192.168.130.8:8888,192.168.130.12:8888,192.168.130.13:8888,192.168.130.14:8888,192.168.130.15:8888,192.168.130.16:8888,192.168.130.18:8888", "3"},
+ {"192.168.130.6:8888,192.168.130.7:8888,192.168.130.8:8888,192.168.130.12:8888,192.168.130.13:8888,192.168.130.14:8888,192.168.130.15:8888,192.168.130.16:8888,192.168.130.18:8888", "1"},
+ {"192.168.130.6:8888,192.168.130.7:8888,192.168.130.8:8888,192.168.130.12:8888,192.168.130.13:8888,192.168.130.14:8888,192.168.130.15:8888,192.168.130.16:8888,192.168.130.18:8888", "3"},
+ {"192.168.130.5:8888,192.168.130.6:8888,192.168.130.7:8888,192.168.130.8:8888,192.168.130.12:8888,192.168.130.13:8888,192.168.130.14:8888,192.168.130.15:8888,192.168.130.16:8888,192.168.130.18:8888", "3"},
+ {"192.168.130.5:8888,192.168.130.6:8888,192.168.130.7:8888,192.168.130.8:8888,192.168.130.12:8888,192.168.130.13:8888,192.168.130.14:8888,192.168.130.15:8888,192.168.130.16:8888,192.168.130.18:8888", "5"},
};
for(String[] c : config){
for(String node : c[0].split(",")){