This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 5e26face893 Add the iotdb-cluster.properties configuration file and
start stop cleanup script (#11788)
5e26face893 is described below
commit 5e26face893c02c2078973517774f8c4348d33e4
Author: Summer <[email protected]>
AuthorDate: Wed Jan 3 10:32:02 2024 +0800
Add the iotdb-cluster.properties configuration file and start stop cleanup
script (#11788)
---
.../resources/conf/iotdb-cluster.properties | 30 +++
.../src/assembly/resources/sbin/clean-all.bat | 38 ++++
.../src/assembly/resources/sbin/clean-all.sh | 95 ++++++++++
.../assembly/resources/sbin/clean-confignode.bat | 82 +++++++++
.../assembly/resources/sbin/clean-confignode.sh | 55 ++++++
.../src/assembly/resources/sbin/clean-datanode.bat | 203 +++++++++++++++++++++
.../src/assembly/resources/sbin/clean-datanode.sh | 70 +++++++
.../src/assembly/resources/sbin/start-all.sh | 81 ++++++++
.../src/assembly/resources/sbin/stop-all.sh | 79 ++++++++
9 files changed, 733 insertions(+)
diff --git
a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-cluster.properties
b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-cluster.properties
new file mode 100644
index 00000000000..1e0d07d5d28
--- /dev/null
+++
b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-cluster.properties
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+
+# Configure ConfigNodes machine addresses separated by ,
+confignode_address_list=
+# Configure DataNodes machine addresses separated by ,
+datanode_address_list=
+# User name for logging in to the deployment machine using ssh
+ssh_account=root
+# ssh login port
+ssh_port=22
+# iotdb deployment directory (iotdb will be deployed to the target node in
this folder)
+confignode_deploy_path=
+datanode_deploy_path=
\ No newline at end of file
diff --git a/iotdb-core/node-commons/src/assembly/resources/sbin/clean-all.bat
b/iotdb-core/node-commons/src/assembly/resources/sbin/clean-all.bat
new file mode 100644
index 00000000000..b470f994b23
--- /dev/null
+++ b/iotdb-core/node-commons/src/assembly/resources/sbin/clean-all.bat
@@ -0,0 +1,38 @@
+@REM
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM
+
+@echo off
+
+SET /P CLEAN_SERVICE="Do you want to clean all the data in the IoTDB ? y/n
(default n): "
+IF NOT "%CLEAN_SERVICE%"=="y" IF NOT "%CLEAN_SERVICE%"=="Y" (
+ ECHO Exiting...
+ EXIT 0
+)
+
+pushd %~dp0..
+if NOT DEFINED IOTDB_HOME set IOTDB_HOME=%cd%
+popd
+
+rmdir /s /q "%IOTDB_HOME%\\data\\"
+
+start cmd /c "%IOTDB_HOME%\\sbin\\clean-datanode.bat -f"
+start cmd /c "%IOTDB_HOME%\\sbin\\clean-confignode.bat -f"
+
+ECHO Cluster cleanup complete ...
+exit 0
\ No newline at end of file
diff --git a/iotdb-core/node-commons/src/assembly/resources/sbin/clean-all.sh
b/iotdb-core/node-commons/src/assembly/resources/sbin/clean-all.sh
new file mode 100644
index 00000000000..c90f960c858
--- /dev/null
+++ b/iotdb-core/node-commons/src/assembly/resources/sbin/clean-all.sh
@@ -0,0 +1,95 @@
+#!/bin/bash
+#
+# 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.
+#
+
+read -p "Do you want to clean all the data in the IoTDB ? y/n (default n): "
CLEAN_SERVICE
+if [[ "$CLEAN_SERVICE" != "y" && "$CLEAN_SERVICE" != "Y" ]]; then
+ echo "Exiting..."
+ exit 0
+fi
+
+export IOTDB_HOME="`dirname "$0"`/.."
+IOTDB_CLUSTER_PATH="${IOTDB_HOME}"/conf/iotdb-cluster.properties
+if [ ! -f ${IOTDB_CLUSTER_PATH} ]; then
+ exec rm -rf ${IOTDB_HOME}/data/
+ exec ${IOTDB_HOME}/sbin/clean-datanode.sh -f >/dev/null 2>&1 &
+ exec ${IOTDB_HOME}/sbin/clean-confignode.sh -f >/dev/null 2>&1 &
+ exit 0
+else
+ confignodeStr=$(sed '/^confignode_address_list=/!d;s/.*=//'
"${IOTDB_CLUSTER_PATH}")
+ confignodeIps=(${confignodeStr//,/ })
+ datanodeStr=$(sed '/^datanode_address_list=/!d;s/.*=//'
"${IOTDB_CLUSTER_PATH}")
+ datanodeIps=(${datanodeStr//,/ })
+ serverPort=$(sed '/^ssh_port=/!d;s/.*=//' "${IOTDB_CLUSTER_PATH}")
+ confignodePath=$(sed '/^confignode_deploy_path=/!d;s/.*=//'
"${IOTDB_CLUSTER_PATH}")
+ datanodePath=$(sed '/^datanode_deploy_path=/!d;s/.*=//'
"${IOTDB_CLUSTER_PATH}")
+ account=$(sed '/^ssh_account=/!d;s/.*=//' "${IOTDB_CLUSTER_PATH}")
+fi
+
+function validateParam() {
+ if [[ -z $1 || -z $2 || -z $3 || -z $4 || -z $5 || -z $6 ]]; then
+ echo "The iotdb-cluster.properties file is incomplete, the current 1C1D
will be cleaned ... "
+ exec rm -rf ${IOTDB_HOME}/data/
+ exec ${IOTDB_HOME}/sbin/clean-datanode.sh -f >/dev/null 2>&1 &
+ exec ${IOTDB_HOME}/sbin/clean-confignode.sh -f >/dev/null 2>&1 &
+ exit
+ fi
+}
+
+validateParam $confignodeIps $datanodeIps $confignodePath $datanodePath
$account $serverPort
+
+if [ "$IOTDB_SSH_OPTS" = "" ]; then
+ IOTDB_SSH_OPTS="-o StrictHostKeyChecking=no"
+fi
+
+unique_array=($(awk -v RS=' ' '!a[$1]++' <<< ${datanodeIps[@]}))
+for datanodeIP in ${unique_array[@]};do
+ hasConfigNode="false"
+ for ((i=0; i<${#confignodeIps[@]}; i++))
+ do
+ if [[ "${confignodeIps[$i]}" == *"$datanodeIP"* ]]; then
+ hasConfigNode="true"
+ unset 'confignodeIps[$i]'
+ break
+ fi
+ done
+ if [[ "$hasConfigNode" == "true" ]]; then
+ echo "The system starts to clean data of DataNodes and ConfigNode of
$datanodeIP"
+ ssh $IOTDB_SSH_OPTS -p $serverPort ${account}@$datanodeIP "
+ nohup bash $datanodePath/sbin/clean-datanode.sh -f >/dev/null 2>&1 &
+ sleep 3
+ nohup bash $confignodePath/sbin/clean-confignode.sh -f >/dev/null
2>&1 &
+ "
+ else
+ echo "The system starts to clean data of DataNodes of $datanodeIP"
+ ssh $IOTDB_SSH_OPTS -p $serverPort ${account}@$datanodeIP "
+ nohup bash $datanodePath/sbin/clean-datanode.sh -f >/dev/null 2>&1
& >/dev/null 2>&1 &
+ "
+ fi
+done
+
+unique_array=($(awk -v RS=' ' '!a[$1]++' <<< ${confignodeIps[@]}))
+for confignodeIP in ${unique_array[@]};do
+ echo "The system starts to clear data of ConfigNodes of $confignodeIP"
+ ssh $IOTDB_SSH_OPTS -p $serverPort ${account}@$confignodeIP "
+ nohup bash $confignodePath/sbin/clean-confignode.sh -f >/dev/null 2>&1 &
+ "
+done
+
+echo "Cluster cleanup complete ..."
diff --git
a/iotdb-core/node-commons/src/assembly/resources/sbin/clean-confignode.bat
b/iotdb-core/node-commons/src/assembly/resources/sbin/clean-confignode.bat
new file mode 100644
index 00000000000..f43ae1a0347
--- /dev/null
+++ b/iotdb-core/node-commons/src/assembly/resources/sbin/clean-confignode.bat
@@ -0,0 +1,82 @@
+@REM
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM
+@echo off
+
+pushd %~dp0..
+if NOT DEFINED IOTDB_HOME set IOTDB_HOME=%cd%
+popd
+
+set "reCheck=%1"
+if not "%reCheck%" == "-f" (
+ echo -n "Do you want to clean all the data in the IoTDB ? y/n (default n):
"
+ set /p CLEAN_SERVICE=
+)
+
+if not "%CLEAN_SERVICE%"=="y" if not "%CLEAN_SERVICE%"=="Y" (
+ echo "Exiting..."
+ exit 0
+)
+
+rmdir /s /q "%IOTDB_HOME%\data\confignode\" 2>nul
+set IOTDB_CONFIGNODE_CONFIG=%IOTDB_HOME%\conf\iotdb-confignode.properties
+set "delimiter=,;"
+for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "^cn_system_dir"
+ %IOTDB_CONFIGNODE_CONFIG%') do (
+ set cn_system_dir=%%i
+)
+if "%cn_system_dir%"=="" (
+ set "cn_system_dir=data\confignode\system"
+)
+
+setlocal enabledelayedexpansion
+set "cn_system_dir=!cn_system_dir:%delimiter%= !"
+for %%i in (%cn_system_dir%) do (
+ set "var=%%i"
+ if "!var:~0,2!"=="\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else if "!var:~1,3!"==":\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else (
+ rmdir /s /q "%IOTDB_HOME%\%%i" 2>nul
+ )
+)
+
+for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "^cn_consensus_dir"
+ %IOTDB_CONFIGNODE_CONFIG%') do (
+ set cn_consensus_dir=%%i
+)
+if "%cn_consensus_dir%"=="" (
+set "cn_consensus_dir=data\confignode\consensus"
+)
+
+set "cn_consensus_dir=!cn_consensus_dir:%delimiter%= !"
+for %%i in (%cn_consensus_dir%) do (
+ set "var=%%i"
+ if "!var:~0,2!"=="\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else if "!var:~1,3!"==":\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else (
+ rmdir /s /q "%IOTDB_HOME%\%%i" 2>nul
+ )
+)
+
+endlocal
+
+echo "ConfigNode clean done ..."
\ No newline at end of file
diff --git
a/iotdb-core/node-commons/src/assembly/resources/sbin/clean-confignode.sh
b/iotdb-core/node-commons/src/assembly/resources/sbin/clean-confignode.sh
new file mode 100644
index 00000000000..2e3239a3502
--- /dev/null
+++ b/iotdb-core/node-commons/src/assembly/resources/sbin/clean-confignode.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+#
+# 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.
+#
+
+if [ -z "${IOTDB_HOME}" ]; then
+ export IOTDB_HOME="$(cd "`dirname "$0"`"/..; pwd)"
+fi
+
+reCheck=$1
+if [[ "$reCheck" != "-f" ]]; then
+ read -p "Do you want to clean all the data in the IoTDB ? y/n (default n): "
CLEAN_SERVICE
+ if [[ "$CLEAN_SERVICE" != "y" && "$CLEAN_SERVICE" != "Y" ]]; then
+ echo "Exiting..."
+ exit 0
+ fi
+fi
+
+rm -rf ${IOTDB_HOME}/data/confignode/ >/dev/null 2>&1 &
+
+IOTDB_CONFIGNODE_CONFIG=${IOTDB_HOME}/conf/iotdb-confignode.properties
+cn_system_dir=$(echo $(grep '^cn_system_dir=' ${IOTDB_CONFIGNODE_CONFIG} ||
echo "data/confignode/system") | sed 's/.*=//')
+cn_consensus_dir=$(echo $(grep '^cn_consensus_dir=' ${IOTDB_CONFIGNODE_CONFIG}
|| echo "data/confignode/consensus") | sed 's/.*=//')
+
+function clearPath {
+ path_name=$1
+ if [ -n "$path_name" ]; then
+ path_name="${path_name#"${path_name%%[![:space:]]*}"}"
+ if [[ $path_name == /* ]]; then
+ rm -rf $path_name >/dev/null 2>&1 &
+ else
+ rm -rf ${IOTDB_HOME}/$path_name >/dev/null 2>&1 &
+ fi
+ fi
+}
+clearPath $cn_system_dir
+clearPath $cn_consensus_dir
+
+exit
+echo "ConfigNode clean done ..."
\ No newline at end of file
diff --git
a/iotdb-core/node-commons/src/assembly/resources/sbin/clean-datanode.bat
b/iotdb-core/node-commons/src/assembly/resources/sbin/clean-datanode.bat
new file mode 100644
index 00000000000..8f876061008
--- /dev/null
+++ b/iotdb-core/node-commons/src/assembly/resources/sbin/clean-datanode.bat
@@ -0,0 +1,203 @@
+@REM
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM
+@echo off
+
+pushd %~dp0..
+if NOT DEFINED IOTDB_HOME set IOTDB_HOME=%cd%
+popd
+
+set "reCheck=%1"
+echo %reCheck%
+if not "%reCheck%" == "-f" (
+ echo -n "Do you want to clean all the data in the IoTDB ? y/n (default n):
"
+ set /p CLEAN_SERVICE=
+)
+
+if not "%CLEAN_SERVICE%"=="y" if not "%CLEAN_SERVICE%"=="Y" (
+ echo "Exiting..."
+ exit 0
+)
+
+rmdir /s /q "%IOTDB_HOME%\data\datanode\" 2>nul
+set IOTDB_DATANODE_CONFIG=%IOTDB_HOME%\conf\iotdb-datanode.properties
+set "delimiter=,;"
+for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "^dn_system_dir"
+ %IOTDB_DATANODE_CONFIG%') do (
+ set dn_system_dir=%%i
+)
+if "%dn_system_dir%"=="" (
+ set "dn_system_dir=data\confignode\system"
+)
+setlocal enabledelayedexpansion
+set "dn_system_dir=!dn_system_dir:%delimiter%= !"
+for %%i in (%dn_system_dir%) do (
+ set "var=%%i"
+ if "!var:~0,2!"=="\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else if "!var:~1,3!"==":\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else (
+ rmdir /s /q "%IOTDB_HOME%\%%i" 2>nul
+ )
+)
+
+for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "^dn_data_dirs"
+ %IOTDB_DATANODE_CONFIG%') do (
+ set dn_data_dirs=%%i
+)
+if "%dn_data_dirs%"=="" (
+ set "dn_data_dirs=data\\datanode\\data"
+)
+
+set "dn_data_dirs=!dn_data_dirs:%delimiter%= !"
+for %%i in (%dn_data_dirs%) do (
+ set "var=%%i"
+ if "!var:~0,2!"=="\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else if "!var:~1,3!"==":\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else (
+ rmdir /s /q "%IOTDB_HOME%\%%i" 2>nul
+ )
+)
+
+for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "^dn_consensus_dir"
+ %IOTDB_DATANODE_CONFIG%') do (
+ set dn_consensus_dir=%%i
+)
+if "%dn_consensus_dir%"=="" (
+ set "dn_consensus_dir=data\\datanode\\consensus"
+)
+
+set "dn_consensus_dir=!dn_consensus_dir:%delimiter%= !"
+for %%i in (%dn_consensus_dir%) do (
+ set "var=%%i"
+ if "!var:~0,2!"=="\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else if "!var:~1,3!"==":\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else (
+ rmdir /s /q "%IOTDB_HOME%\%%i" 2>nul
+ )
+)
+
+for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "^dn_wal_dirs"
+ %IOTDB_DATANODE_CONFIG%') do (
+ set dn_wal_dirs=%%i
+)
+if "%dn_wal_dirs%"=="" (
+ set "dn_wal_dirs=data\\datanode\\wal"
+)
+
+set "dn_wal_dirs=!dn_wal_dirs:%delimiter%= !"
+for %%i in (%dn_wal_dirs%) do (
+ set "var=%%i"
+ if "!var:~0,2!"=="\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else if "!var:~1,3!"==":\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else (
+ rmdir /s /q "%IOTDB_HOME%\%%i" 2>nul
+ )
+)
+
+for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "^dn_tracing_dir"
+ %IOTDB_DATANODE_CONFIG%') do (
+ set dn_tracing_dir=%%i
+)
+if "%dn_tracing_dir%"=="" (
+ set "dn_tracing_dir=data\\datanode\\wal"
+)
+set "dn_tracing_dir=%dn_tracing_dir:"=%"
+
+set "dn_tracing_dir=!dn_tracing_dir:%delimiter%= !"
+for %%i in (%dn_tracing_dir%) do (
+ set "var=%%i"
+ if "!var:~0,2!"=="\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else if "!var:~1,3!"==":\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else (
+ rmdir /s /q "%IOTDB_HOME%\%%i" 2>nul
+ )
+)
+
+for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "^dn_sync_dir"
+ %IOTDB_DATANODE_CONFIG%') do (
+ set dn_sync_dir=%%i
+)
+if "%dn_sync_dir%"=="" (
+ set "dn_sync_dir=data\\datanode\\sync"
+)
+set "dn_sync_dir=%dn_sync_dir:"=%"
+
+set "dn_sync_dir=!dn_sync_dir:%delimiter%= !"
+for %%i in (%dn_sync_dir%) do (
+ set "var=%%i"
+ if "!var:~0,2!"=="\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else if "!var:~1,3!"==":\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else (
+ rmdir /s /q "%IOTDB_HOME%\%%i" 2>nul
+ )
+)
+
+for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "^pipe_receiver_file_dir"
+ %IOTDB_DATANODE_CONFIG%') do (
+ set pipe_receiver_file_dir=%%i
+)
+if "%pipe_receiver_file_dir%"=="" (
+ set "pipe_receiver_file_dir=data\\datanode\\system\\pipe\\receiver"
+)
+
+set "pipe_receiver_file_dir=!pipe_receiver_file_dir:%delimiter%= !"
+for %%i in (%pipe_receiver_file_dir%) do (
+ set "var=%%i"
+ if "!var:~0,2!"=="\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else if "!var:~1,3!"==":\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else (
+ rmdir /s /q "%IOTDB_HOME%\%%i" 2>nul
+ )
+)
+
+for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "^sort_tmp_dir"
+ %IOTDB_DATANODE_CONFIG%') do (
+ set sort_tmp_dir=%%i
+)
+if "%sort_tmp_dir%"=="" (
+ set "sort_tmp_dir=data\\datanode\\tmp"
+)
+
+set "sort_tmp_dir=!sort_tmp_dir:%delimiter%= !"
+for %%i in (%sort_tmp_dir%) do (
+ set "var=%%i"
+ if "!var:~0,2!"=="\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else if "!var:~1,3!"==":\\" (
+ rmdir /s /q "%%i" 2>nul
+ ) else (
+ rmdir /s /q "%IOTDB_HOME%\%%i" 2>nul
+ )
+)
+
+endlocal
+echo "DataNode clean done ..."
\ No newline at end of file
diff --git
a/iotdb-core/node-commons/src/assembly/resources/sbin/clean-datanode.sh
b/iotdb-core/node-commons/src/assembly/resources/sbin/clean-datanode.sh
new file mode 100644
index 00000000000..cb0542b8ced
--- /dev/null
+++ b/iotdb-core/node-commons/src/assembly/resources/sbin/clean-datanode.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+#
+# 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.
+#
+
+reCheck=$1
+echo $reCheck
+if [[ "$reCheck" != "-f" ]]; then
+ read -p "Do you want to clean all the data in the IoTDB ? y/n (default n): "
CLEAN_SERVICE
+ if [[ "$CLEAN_SERVICE" != "y" && "$CLEAN_SERVICE" != "Y" ]]; then
+ echo "Exiting..."
+ exit 0
+ fi
+fi
+
+if [ -z "${IOTDB_HOME}" ]; then
+ export IOTDB_HOME="$(cd "`dirname "$0"`"/..; pwd)"
+fi
+
+rm -rf ${IOTDB_HOME}/data/datanode/ >/dev/null 2>&1 &
+IOTDB_DATANODE_CONFIG=${IOTDB_HOME}/conf/iotdb-datanode.properties
+dn_system_dir=$(echo $(grep '^dn_system_dir=' ${IOTDB_DATANODE_CONFIG} || echo
"data/datanode/system") | sed 's/.*=//')
+dn_data_dirs=$(echo $(grep '^dn_data_dirs=' ${IOTDB_DATANODE_CONFIG} || echo
"data/datanode/data") | sed 's/.*=//')
+dn_consensus_dir=$(echo $(grep '^dn_consensus_dir=' ${IOTDB_DATANODE_CONFIG}
|| echo "data/datanode/consensus") | sed 's/.*=//')
+dn_wal_dirs=$(echo $(grep '^dn_wal_dirs=' ${IOTDB_DATANODE_CONFIG} || echo
"data/datanode/wal") | sed 's/.*=//')
+dn_tracing_dir=$(echo $(grep '^dn_tracing_dir=' ${IOTDB_DATANODE_CONFIG} ||
echo "datanode/tracing") | sed 's/.*=//')
+dn_sync_dir=$(echo $(grep '^dn_sync_dir=' ${IOTDB_DATANODE_CONFIG} || echo
"data/datanode/sync") | sed 's/.*=//')
+pipe_receiver_file_dirs=$(echo $(grep '^pipe_receiver_file_dirs='
${IOTDB_DATANODE_CONFIG} || echo "data/datanode/system/pipe/receiver") | sed
's/.*=//')
+sort_tmp_dir=$(echo $(grep '^sort_tmp_dir=' ${IOTDB_DATANODE_CONFIG} || echo
"data/datanode/tmp") | sed 's/.*=//')
+
+function clearPath {
+ path_name=$1
+ if [ -n "$path_name" ]; then
+ path_name="${path_name#"${path_name%%[![:space:]]*}"}"
+ IFS=';,' read -r -a paths <<< "$path_name"
+ for path_name in "${paths[@]}"
+ do
+ if [[ $path_name == /* ]]; then
+ rm -rf $path_name >/dev/null 2>&1 &
+ else
+ rm -rf ${IOTDB_HOME}/$path_name >/dev/null 2>&1 &
+ fi
+ done
+ fi
+}
+clearPath $dn_system_dir
+clearPath $dn_data_dirs
+clearPath $dn_consensus_dir
+clearPath $dn_wal_dirs
+clearPath $dn_tracing_dir
+clearPath $dn_sync_dir
+clearPath $pipe_receiver_file_dirs
+clearPath $sort_tmp_dir
+
+echo "DataNode clean done ..."
\ No newline at end of file
diff --git a/iotdb-core/node-commons/src/assembly/resources/sbin/start-all.sh
b/iotdb-core/node-commons/src/assembly/resources/sbin/start-all.sh
new file mode 100644
index 00000000000..c7d8e948008
--- /dev/null
+++ b/iotdb-core/node-commons/src/assembly/resources/sbin/start-all.sh
@@ -0,0 +1,81 @@
+#!/bin/bash
+#
+# 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.
+#
+
+if [ -z "${IOTDB_HOME}" ]; then
+ export IOTDB_HOME="`dirname "$0"`/.."
+fi
+IOTDB_CLUSTER_PATH="${IOTDB_HOME}"/conf/iotdb-cluster.properties
+if [ ! -f ${IOTDB_CLUSTER_PATH} ]; then
+ exec ${IOTDB_HOME}/sbin/start-standalone.sh
+else
+ confignodeStr=$(sed '/^confignode_address_list=/!d;s/.*=//'
"${IOTDB_CLUSTER_PATH}")
+ confignodeIps=(${confignodeStr//,/ })
+ datanodeStr=$(sed '/^datanode_address_list=/!d;s/.*=//'
"${IOTDB_CLUSTER_PATH}")
+ datanodeIps=(${datanodeStr//,/ })
+ serverPort=$(sed '/^ssh_port=/!d;s/.*=//' "${IOTDB_CLUSTER_PATH}")
+ confignodePath=$(sed '/^confignode_deploy_path=/!d;s/.*=//'
"${IOTDB_CLUSTER_PATH}")
+ datanodePath=$(sed '/^datanode_deploy_path=/!d;s/.*=//'
"${IOTDB_CLUSTER_PATH}")
+ account=$(sed '/^ssh_account=/!d;s/.*=//' "${IOTDB_CLUSTER_PATH}")
+fi
+
+function validateParam() {
+ if [[ -z $1 || -z $2 || -z $3 || -z $4 || -z $5 || -z $6 ]]; then
+ echo "The iotdb-cluster.properties file is incomplete, the current 1C1D
will be started ... "
+ exec ${IOTDB_HOME}/sbin/start-standalone.sh
+ exit
+ fi
+}
+validateParam $confignodeIps $datanodeIps $confignodePath $datanodePath
$account $serverPort
+
+if [ "$IOTDB_SSH_OPTS" = "" ]; then
+ IOTDB_SSH_OPTS="-o StrictHostKeyChecking=no"
+fi
+
+for confignodeIP in ${confignodeIps[@]};do
+ hasDataNode="false"
+ for ((i=0; i<${#datanodeIps[@]}; i++))
+ do
+ if [[ "${datanodeIps[$i]}" == *"$confignodeIP"* ]]; then
+ hasDataNode="true"
+ unset 'datanodeIps[$i]'
+ break
+ fi
+ done
+ if [[ "$hasDataNode" == "true" ]]; then
+ echo "The system starts the ConfigNode And DataNode of $confignodeIP"
+ ssh $IOTDB_SSH_OPTS -p $serverPort ${account}@$confignodeIP "
+ nohup bash $confignodePath/sbin/start-confignode.sh >/dev/null 2>&1 &
+ sleep 3
+ nohup bash $datanodePath/sbin/start-datanode.sh >/dev/null 2>&1 &
+ "
+ else
+ echo "The system starts the ConfigNode of $confignodeIP"
+ ssh $IOTDB_SSH_OPTS -p $serverPort ${account}@$confignodeIP "nohup bash
$confignodePath/sbin/start-confignode.sh >/dev/null 2>&1 &"
+ fi
+ sleep 3
+done
+
+for datanodeIP in ${datanodeIps[@]};do
+ echo "The system starts the DataNode of $datanodeIP"
+ ssh $IOTDB_SSH_OPTS -p $serverPort ${account}@$datanodeIP "nohup bash
$datanodePath/sbin/start-datanode.sh >/dev/null 2>&1 &"
+ sleep 3
+done
+
+echo "Cluster startup complete ..."
diff --git a/iotdb-core/node-commons/src/assembly/resources/sbin/stop-all.sh
b/iotdb-core/node-commons/src/assembly/resources/sbin/stop-all.sh
new file mode 100644
index 00000000000..b59f03e9a82
--- /dev/null
+++ b/iotdb-core/node-commons/src/assembly/resources/sbin/stop-all.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+#
+# 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.
+#
+
+if [ -z "${IOTDB_HOME}" ]; then
+ export IOTDB_HOME="`dirname "$0"`/.."
+fi
+IOTDB_CLUSTER_PATH="${IOTDB_HOME}"/conf/iotdb-cluster.properties
+if [ ! -f ${IOTDB_CLUSTER_PATH} ]; then
+ exec ${IOTDB_HOME}/sbin/stop-standalone.sh
+else
+ confignodeStr=$(sed '/^confignode_address_list=/!d;s/.*=//'
"${IOTDB_CLUSTER_PATH}")
+ confignodeIps=(${confignodeStr//,/ })
+ datanodeStr=$(sed '/^datanode_address_list=/!d;s/.*=//'
"${IOTDB_CLUSTER_PATH}")
+ datanodeIps=(${datanodeStr//,/ })
+ serverPort=$(sed '/^ssh_port=/!d;s/.*=//' "${IOTDB_CLUSTER_PATH}")
+ confignodePath=$(sed '/^confignode_deploy_path=/!d;s/.*=//'
"${IOTDB_CLUSTER_PATH}")
+ datanodePath=$(sed '/^datanode_deploy_path=/!d;s/.*=//'
"${IOTDB_CLUSTER_PATH}")
+ account=$(sed '/^ssh_account=/!d;s/.*=//' "${IOTDB_CLUSTER_PATH}")
+ echo $confignodeIps $datanodeIps $confignodePaths $datanodePaths $account
$serverPort
+fi
+
+function validateParam() {
+ if [[ -z $1 || -z $2 || -z $3 || -z $4 || -z $5 || -z $6 ]]; then
+ echo "The iotdb-cluster.properties file is incomplete, the current 1C1D
will be stopped ... "
+ exec ${IOTDB_HOME}/sbin/stop-standalone.sh
+ fi
+}
+validateParam $confignodeIps $datanodeIps $confignodePath $datanodePath
$account $serverPort
+
+if [ "$IOTDB_SSH_OPTS" = "" ]; then
+ IOTDB_SSH_OPTS="-o StrictHostKeyChecking=no"
+fi
+
+for datanodeIP in ${datanodeIps[@]};do
+ hasConfigNode="false"
+ for ((i=0; i<${#confignodeIps[@]}; i++))
+ do
+ if [[ "${confignodeIps[$i]}" == *"$datanodeIP"* ]]; then
+ hasConfigNode="true"
+ unset 'confignodeIps[$i]'
+ break
+ fi
+ done
+ if [[ "$hasConfigNode" == "true" ]]; then
+ echo "The system stops the DataNode and ConfigNode of $datanodeIP"
+ ssh $IOTDB_SSH_OPTS -p $serverPort ${account}@$datanodeIP "
+ nohup bash $datanodePath/sbin/stop-datanode.sh
+ sleep 3
+ nohup bash $confignodePath/sbin/stop-confignode.sh
+ "
+ else
+ echo "The system stops the DataNode of $datanodeIP"
+ ssh $IOTDB_SSH_OPTS -p $serverPort ${account}@$datanodeIP "nohup bash
$datanodePath/sbin/stop-datanode.sh"
+ fi
+done
+
+for confignodeIP in ${confignodeIps[@]};do
+ echo "The system stops the ConfigNode of $confignodeIP"
+ ssh $IOTDB_SSH_OPTS -p $serverPort ${account}@$confignodeIP "nohup bash
$confignodePath/sbin/stop-confignode.sh"
+done
+
+echo "Cluster stop complete ..."
\ No newline at end of file