Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ for /f "eol=; tokens=2,2 delims==" %%i in ('findstr /i "^cn_internal_port"
"%config_file%"') do (
set cn_internal_port=%%i
)
@REM trim the port
:delLeft1
if "%cn_internal_port:~0,1%"==" " (
set "cn_internal_port=%cn_internal_port:~1%"
goto delLeft1
)

:delRight1
if "%cn_internal_port:~-1%"==" " (
set "cn_internal_port=%cn_internal_port:~0,-1%"
goto delRight1
)

if not defined cn_internal_port (
echo "WARNING: cn_internal_port not found in the configuration file. Using default value cn_internal_port = 10710"
Expand All @@ -45,17 +57,8 @@ if not defined cn_internal_port (

echo "check whether the cn_internal_port is used..., port is %cn_internal_port%"

for /f "eol=; tokens=2,2 delims==" %%i in ('findstr /i "cn_internal_address"
"%config_file%"') do (
set cn_internal_address=%%i
)

if not defined cn_internal_address (
echo "WARNING: cn_internal_address not found in the configuration file. Using default value cn_internal_address = 127.0.0.1"
set cn_internal_address=127.0.0.1
)

for /f "tokens=5" %%a in ('netstat /ano ^| findstr %cn_internal_address%:%cn_internal_port% ^| findstr LISTENING ') do (
echo %cn_internal_address%:%cn_internal_port%;
for /f "tokens=5" %%a in ('netstat /ano ^| findstr :%cn_internal_port% ^| findstr LISTENING ') do (
taskkill /f /pid %%a
echo "close ConfigNode, PID:" %%a
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ CONFIGNODE_CONF="$(dirname "$0")/../conf"

if [ -f "${CONFIGNODE_CONF}/iotdb-system.properties" ]; then
cn_internal_port=$(sed '/^cn_internal_port=/!d;s/.*=//' "${CONFIGNODE_CONF}"/iotdb-system.properties)
# trim the port
cn_internal_port=$(echo "$cn_internal_port" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
else
cn_internal_port=$(sed '/^cn_internal_port=/!d;s/.*=//' "${CONFIGNODE_CONF}"/iotdb-confignode.properties)
# trim the port
cn_internal_port=$(echo "$cn_internal_port" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
fi

if [ -z "$cn_internal_port" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ get_first_data_dir() {
data_dir_value=$(echo "$data_dir_value" | cut -d',' -f1)
fi

# trim the dir
data_dir_value=$(echo "$data_dir_value" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')

if [[ "$data_dir_value" == /* ]]; then
echo "$data_dir_value"
else
Expand Down
23 changes: 12 additions & 11 deletions iotdb-core/datanode/src/assembly/resources/sbin/stop-datanode.bat
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "^dn_rpc_port"
"%config_file%"') do (
set dn_rpc_port=%%i
)
@REM trim the port
:delLeft1
if "%dn_rpc_port:~0,1%"==" " (
set "dn_rpc_port=%dn_rpc_port:~1%"
goto delLeft1
)
:delRight1
if "%dn_rpc_port:~-1%"==" " (
set "dn_rpc_port=%dn_rpc_port:~0,-1%"
goto delRight1
)

if not defined dn_rpc_port (
echo "WARNING: dn_rpc_port not found in the configuration file. Using default value dn_rpc_port = 6667"
Expand All @@ -50,17 +61,7 @@ if not defined dn_rpc_port (

echo Check whether the rpc_port is used..., port is %dn_rpc_port%

for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "dn_rpc_address"
"%config_file%"') do (
set dn_rpc_address=%%i
)

if not defined dn_rpc_address (
echo "WARNING: dn_rpc_address not found in the configuration file. Using default value dn_rpc_address = 0.0.0.0"
set dn_rpc_address=0.0.0.0
)

for /f "tokens=5" %%a in ('netstat /ano ^| findstr %dn_rpc_address%:%dn_rpc_port%') do (
for /f "tokens=5" %%a in ('netstat /ano ^| findstr :%dn_rpc_port% ') do (
taskkill /f /pid %%a
echo Close DataNode, PID: %%a
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ DATANODE_CONF="`dirname "$0"`/../conf"

if [ -f "${DATANODE_CONF}/iotdb-system.properties" ]; then
dn_rpc_port=`sed '/^dn_rpc_port=/!d;s/.*=//' ${DATANODE_CONF}/iotdb-system.properties`
# trim the port
dn_rpc_port=$(echo "$dn_rpc_port" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
else
dn_rpc_port=`sed '/^dn_rpc_port=/!d;s/.*=//' ${DATANODE_CONF}/iotdb-datanode.properties`
# trim the port
dn_rpc_port=$(echo "$dn_rpc_port" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
fi

if [ -z "$dn_rpc_port" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,9 @@ private String[][] parseDataDirs(String dataDirs) {
String[][] tierDataDirs = new String[tiers.length][];
for (int i = 0; i < tiers.length; ++i) {
tierDataDirs[i] = tiers[i].split(",");
for (int j = 0; j < tierDataDirs[i].length; j++) {
tierDataDirs[i][j] = tierDataDirs[i][j].trim();
}
}
return tierDataDirs;
}
Expand Down
Loading