This is an automated email from the ASF dual-hosted git repository.
yongzao pushed a commit to branch refactor-ain-config
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/refactor-ain-config by this
push:
new ca40e86d821 finish
ca40e86d821 is described below
commit ca40e86d821d064b9a7dca6b8b7d6adbbf355115
Author: Yongzao <[email protected]>
AuthorDate: Mon Jul 21 21:20:02 2025 +0800
finish
---
.../main/DockerCompose/docker-compose-ainode.yml | 30 +++++++---
.../docker-compose-cluster-1c1d1a.yml | 4 +-
docker/src/main/Dockerfile-1.0.0-ainode | 3 -
.../iotdb/it/env/cluster/node/AINodeWrapper.java | 2 +-
iotdb-core/ainode/ainode/core/ainode.py | 10 ++--
iotdb-core/ainode/ainode/core/config.py | 68 ++++++++++------------
iotdb-core/ainode/ainode/core/constant.py | 52 ++++++++---------
iotdb-core/ainode/ainode/core/rpc/service.py | 4 +-
iotdb-core/ainode/ainode/core/script.py | 6 +-
iotdb-core/ainode/pyproject.toml | 2 +-
.../ainode/resources/conf/iotdb-ainode.properties | 20 +++----
scripts/sbin/stop-ainode.sh | 22 +++----
scripts/sbin/windows/stop-ainode.bat | 18 +++---
13 files changed, 118 insertions(+), 123 deletions(-)
diff --git a/docker/src/main/DockerCompose/docker-compose-ainode.yml
b/docker/src/main/DockerCompose/docker-compose-ainode.yml
index a570b9ac38d..f89862600b0 100644
--- a/docker/src/main/DockerCompose/docker-compose-ainode.yml
+++ b/docker/src/main/DockerCompose/docker-compose-ainode.yml
@@ -17,16 +17,30 @@
# under the License.
#
+volumes:
+ ainode-data:
+ driver: local
+ driver_opts:
+ type: none
+ device: /data/ainode
+ o: bind
+
services:
iotdb-ainode:
- image: apache/iotdb:2.0.5-SNAPSHOT-ainode
- hostname: iotdb-ainode
+ image: apache/iotdb:<version>-ainode
container_name: iotdb-ainode
- ports:
- - "10810:10810"
+ network_mode: host
environment:
- - ain_seed_config_node=iotdb-confignode:10710
- - ain_inference_rpc_address=iotdb-ainode
- - ain_inference_rpc_port=10810
+ - cluster_name=defaultCluster
+ - ain_seed_config_node=<iotdb-confignode>:10710
+ - ain_rpc_address=<iotdb-ainode>
+ - ain_rpc_port=10810
+ - ain_cluster_ingress_address=<iotdb-datanode>
+ - ain_cluster_ingress_port=6667
+ - ain_cluster_ingress_username=root
+ - ain_cluster_ingress_password=root
+ - ain_cluster_ingress_time_zone=UTC+8
volumes:
- - ./logs/ainode:/ainode/logs
\ No newline at end of file
+ - ainode-data:/ainode/data
+ - ./logs/ainode:/ainode/logs
+ # - ./lib/ainode:/ainode/lib # Uncomment for rolling upgrade
\ No newline at end of file
diff --git a/docker/src/main/DockerCompose/docker-compose-cluster-1c1d1a.yml
b/docker/src/main/DockerCompose/docker-compose-cluster-1c1d1a.yml
index c8453b28eef..b6a1b63c573 100644
--- a/docker/src/main/DockerCompose/docker-compose-cluster-1c1d1a.yml
+++ b/docker/src/main/DockerCompose/docker-compose-cluster-1c1d1a.yml
@@ -55,8 +55,8 @@ services:
container_name: iotdb-ainode
environment:
- ain_seed_config_node=iotdb-service:10710
- - ain_inference_rpc_address=iotdb-ainode
- - ain_inference_rpc_port=10810
+ - ain_rpc_address=iotdb-ainode
+ - ain_rpc_port=10810
volumes:
- ./logs/ainode:/ainode/logs
networks:
diff --git a/docker/src/main/Dockerfile-1.0.0-ainode
b/docker/src/main/Dockerfile-1.0.0-ainode
index e1726f896b4..7e315c64939 100644
--- a/docker/src/main/Dockerfile-1.0.0-ainode
+++ b/docker/src/main/Dockerfile-1.0.0-ainode
@@ -62,8 +62,5 @@ ENV
PATH="${IOTDB_AINODE_HOME}/sbin/:${IOTDB_AINODE_HOME}/tools/:${PATH}"
RUN bash start-ainode.sh || true
RUN rm -r ${IOTDB_AINODE_HOME}/logs/*
-EXPOSE 10810
-VOLUME $IOTDB_AINODE_HOME/logs
-
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["bash", "-c", "entrypoint.sh ainode"]
diff --git
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/AINodeWrapper.java
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/AINodeWrapper.java
index 8da2437aed6..86d70155649 100644
---
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/AINodeWrapper.java
+++
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/AINodeWrapper.java
@@ -111,7 +111,7 @@ public class AINodeWrapper extends AbstractNodeWrapper {
// set attribute
replaceAttribute(
- new String[] {"ain_seed_config_node", "ain_inference_rpc_port"},
+ new String[] {"ain_seed_config_node", "ain_rpc_port"},
new String[] {this.seedConfigNode, Integer.toString(getPort())},
propertiesFile);
diff --git a/iotdb-core/ainode/ainode/core/ainode.py
b/iotdb-core/ainode/ainode/core/ainode.py
index 6380094b98a..d18ac21464e 100644
--- a/iotdb-core/ainode/ainode/core/ainode.py
+++ b/iotdb-core/ainode/ainode/core/ainode.py
@@ -43,8 +43,8 @@ def _generate_configuration() -> TAINodeConfiguration:
location = TAINodeLocation(
AINodeDescriptor().get_config().get_ainode_id(),
TEndPoint(
- AINodeDescriptor().get_config().get_ain_inference_rpc_address(),
- AINodeDescriptor().get_config().get_ain_inference_rpc_port(),
+ AINodeDescriptor().get_config().get_ain_rpc_address(),
+ AINodeDescriptor().get_config().get_ain_rpc_port(),
),
)
resource = TNodeResource(int(psutil.cpu_count()),
int(psutil.virtual_memory()[0]))
@@ -76,10 +76,8 @@ def _generate_system_properties(ainode_id: int):
"cluster_name": AINodeDescriptor().get_config().get_cluster_name(),
"iotdb_version": AINodeDescriptor().get_config().get_version_info(),
"commit_id": AINodeDescriptor().get_config().get_build_info(),
- "ain_rpc_address": AINodeDescriptor()
- .get_config()
- .get_ain_inference_rpc_address(),
- "ain_rpc_port":
AINodeDescriptor().get_config().get_ain_inference_rpc_port(),
+ "ain_rpc_address":
AINodeDescriptor().get_config().get_ain_rpc_address(),
+ "ain_rpc_port": AINodeDescriptor().get_config().get_ain_rpc_port(),
"config_node_list": AINodeDescriptor()
.get_config()
.get_ain_target_config_node_list(),
diff --git a/iotdb-core/ainode/ainode/core/config.py
b/iotdb-core/ainode/ainode/core/config.py
index 6f0336ad6ae..d347379570b 100644
--- a/iotdb-core/ainode/ainode/core/config.py
+++ b/iotdb-core/ainode/ainode/core/config.py
@@ -31,12 +31,12 @@ from ainode.core.constant import (
AINODE_CONF_GIT_FILE_NAME,
AINODE_CONF_POM_FILE_NAME,
AINODE_INFERENCE_BATCH_INTERVAL_IN_MS,
- AINODE_INFERENCE_RPC_ADDRESS,
- AINODE_INFERENCE_RPC_PORT,
AINODE_LOG_DIR,
AINODE_MODELS_DIR,
AINODE_ROOT_CONF_DIRECTORY_NAME,
AINODE_ROOT_DIR,
+ AINODE_RPC_ADDRESS,
+ AINODE_RPC_PORT,
AINODE_SYSTEM_DIR,
AINODE_SYSTEM_FILE_NAME,
AINODE_TARGET_CONFIG_NODE_LIST,
@@ -53,9 +53,22 @@ logger = Logger()
class AINodeConfig(object):
def __init__(self):
- # Used for connection of DataNode/ConfigNode clients
- self._ain_inference_rpc_address: str = AINODE_INFERENCE_RPC_ADDRESS
- self._ain_inference_rpc_port: int = AINODE_INFERENCE_RPC_PORT
+ self._version_info = AINODE_VERSION_INFO
+ self._build_info = AINODE_BUILD_INFO
+
+ # Cluster configuration
+ self._ainode_id = 0
+ self._cluster_name = AINODE_CLUSTER_NAME
+ self._ain_target_config_node_list: TEndPoint =
AINODE_TARGET_CONFIG_NODE_LIST
+ self._ain_rpc_address: str = AINODE_RPC_ADDRESS
+ self._ain_rpc_port: int = AINODE_RPC_PORT
+ self._ain_cluster_ingress_address = AINODE_CLUSTER_INGRESS_ADDRESS
+ self._ain_cluster_ingress_port = AINODE_CLUSTER_INGRESS_PORT
+ self._ain_cluster_ingress_username = AINODE_CLUSTER_INGRESS_USERNAME
+ self._ain_cluster_ingress_password = AINODE_CLUSTER_INGRESS_PASSWORD
+ self._ain_cluster_ingress_time_zone = AINODE_CLUSTER_INGRESS_TIME_ZONE
+
+ # Inference configuration
self._ain_inference_batch_interval_in_ms: int = (
AINODE_INFERENCE_BATCH_INTERVAL_IN_MS
)
@@ -77,23 +90,6 @@ class AINodeConfig(object):
# Cache number of model storage to avoid repeated loading
self._ain_model_storage_cache_size = 30
- # Target ConfigNode to be connected by AINode
- self._ain_target_config_node_list: TEndPoint =
AINODE_TARGET_CONFIG_NODE_LIST
-
- # use for node management
- self._ainode_id = 0
- self._cluster_name = AINODE_CLUSTER_NAME
-
- # connect IoTDB cluster
- self._ain_cluster_ingress_address = AINODE_CLUSTER_INGRESS_ADDRESS
- self._ain_cluster_ingress_port = AINODE_CLUSTER_INGRESS_PORT
- self._ain_cluster_ingress_username = AINODE_CLUSTER_INGRESS_USERNAME
- self._ain_cluster_ingress_password = AINODE_CLUSTER_INGRESS_PASSWORD
- self._ain_cluster_ingress_time_zone = AINODE_CLUSTER_INGRESS_TIME_ZONE
-
- self._version_info = AINODE_VERSION_INFO
- self._build_info = AINODE_BUILD_INFO
-
def get_cluster_name(self) -> str:
return self._cluster_name
@@ -124,17 +120,17 @@ class AINodeConfig(object):
def set_version_info(self, version_info: str) -> None:
self._version_info = version_info
- def get_ain_inference_rpc_address(self) -> str:
- return self._ain_inference_rpc_address
+ def get_ain_rpc_address(self) -> str:
+ return self._ain_rpc_address
- def set_ain_inference_rpc_address(self, ain_inference_rpc_address: str) ->
None:
- self._ain_inference_rpc_address = ain_inference_rpc_address
+ def set_ain_rpc_address(self, ain_rpc_address: str) -> None:
+ self._ain_rpc_address = ain_rpc_address
- def get_ain_inference_rpc_port(self) -> int:
- return self._ain_inference_rpc_port
+ def get_ain_rpc_port(self) -> int:
+ return self._ain_rpc_port
- def set_ain_inference_rpc_port(self, ain_inference_rpc_port: int) -> None:
- self._ain_inference_rpc_port = ain_inference_rpc_port
+ def set_ain_rpc_port(self, ain_rpc_port: int) -> None:
+ self._ain_rpc_port = ain_rpc_port
def get_ain_inference_batch_interval_in_ms(self) -> int:
return self._ain_inference_batch_interval_in_ms
@@ -275,15 +271,11 @@ class AINodeDescriptor(object):
config_keys = file_configs.keys()
- if "ain_inference_rpc_address" in config_keys:
- self._config.set_ain_inference_rpc_address(
- file_configs["ain_inference_rpc_address"]
- )
+ if "ain_rpc_address" in config_keys:
+
self._config.set_ain_rpc_address(file_configs["ain_rpc_address"])
- if "ain_inference_rpc_port" in config_keys:
- self._config.set_ain_inference_rpc_port(
- int(file_configs["ain_inference_rpc_port"])
- )
+ if "ain_rpc_port" in config_keys:
+
self._config.set_ain_rpc_port(int(file_configs["ain_rpc_port"]))
if "ain_inference_batch_interval_in_ms" in config_keys:
self._config.set_ain_inference_batch_interval_in_ms(
diff --git a/iotdb-core/ainode/ainode/core/constant.py
b/iotdb-core/ainode/ainode/core/constant.py
index 1521ca52fe2..bd414ce1253 100644
--- a/iotdb-core/ainode/ainode/core/constant.py
+++ b/iotdb-core/ainode/ainode/core/constant.py
@@ -23,6 +23,8 @@ from typing import List
from ainode.thrift.common.ttypes import TEndPoint
+AINODE_VERSION_INFO = "UNKNOWN"
+AINODE_BUILD_INFO = "UNKNOWN"
AINODE_CONF_DIRECTORY_NAME = "conf"
AINODE_ROOT_CONF_DIRECTORY_NAME = "conf"
AINODE_CONF_FILE_NAME = "iotdb-ainode.properties"
@@ -30,33 +32,33 @@ AINODE_CONF_GIT_FILE_NAME = "git.properties"
AINODE_CONF_POM_FILE_NAME = "pom.properties"
AINODE_SYSTEM_FILE_NAME = "system.properties"
-# inference_rpc_address
-AINODE_INFERENCE_RPC_ADDRESS = "127.0.0.1"
-AINODE_INFERENCE_RPC_PORT = 10810
+# AINode cluster configuration
+AINODE_CLUSTER_NAME = "defaultCluster"
+AINODE_TARGET_CONFIG_NODE_LIST = TEndPoint("127.0.0.1", 10710)
+AINODE_RPC_ADDRESS = "127.0.0.1"
+AINODE_RPC_PORT = 10810
+AINODE_CLUSTER_INGRESS_ADDRESS = "127.0.0.1"
+AINODE_CLUSTER_INGRESS_PORT = 6667
+AINODE_CLUSTER_INGRESS_USERNAME = "root"
+AINODE_CLUSTER_INGRESS_PASSWORD = "root"
+AINODE_CLUSTER_INGRESS_TIME_ZONE = "UTC+8"
+
+# RPC config
+AINODE_THRIFT_COMPRESSION_ENABLED = False
+DEFAULT_RECONNECT_TIMEOUT = 20
+DEFAULT_RECONNECT_TIMES = 3
+
+# AINode inference configuration
AINODE_INFERENCE_BATCH_INTERVAL_IN_MS = 15
# AINode folder structure
+AINODE_ROOT_DIR = os.path.dirname(
+ os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
+)
AINODE_MODELS_DIR = "data/ainode/models"
AINODE_BUILTIN_MODELS_DIR = "data/ainode/models/weights" # For built-in
models, we only need to store their weights and config.
AINODE_SYSTEM_DIR = "data/ainode/system"
AINODE_LOG_DIR = "logs"
-AINODE_THRIFT_COMPRESSION_ENABLED = False
-
-# use for node management
-AINODE_CLUSTER_NAME = "defaultCluster"
-AINODE_VERSION_INFO = "UNKNOWN"
-AINODE_BUILD_INFO = "UNKNOWN"
-AINODE_ROOT_DIR = os.path.dirname(
- os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
-)
-
-# connect IoTDB cluster
-AINODE_CLUSTER_INGRESS_ADDRESS = "127.0.0.1"
-AINODE_CLUSTER_INGRESS_PORT = 6667
-AINODE_CLUSTER_INGRESS_USERNAME = "root"
-AINODE_CLUSTER_INGRESS_PASSWORD = "root"
-AINODE_CLUSTER_INGRESS_TIME_ZONE = "UTC+8"
-AINODE_TARGET_CONFIG_NODE_LIST = TEndPoint("127.0.0.1", 10710)
# AINode log
AINODE_LOG_FILE_NAMES = [
@@ -66,21 +68,15 @@ AINODE_LOG_FILE_NAMES = [
"log_ainode_error.log",
]
AINODE_LOG_FILE_LEVELS = [logging.DEBUG, logging.INFO, logging.WARNING,
logging.ERROR]
+STD_LEVEL = logging.INFO
-TRIAL_ID_PREFIX = "__trial_"
-DEFAULT_TRIAL_ID = TRIAL_ID_PREFIX + "0"
-
+# AINode model management
MODEL_WEIGHTS_FILE_IN_SAFETENSORS = "model.safetensors"
MODEL_CONFIG_FILE_IN_JSON = "config.json"
DEFAULT_MODEL_FILE_NAME = "model.pt"
DEFAULT_CONFIG_FILE_NAME = "config.yaml"
DEFAULT_CHUNK_SIZE = 8192
-DEFAULT_RECONNECT_TIMEOUT = 20
-DEFAULT_RECONNECT_TIMES = 3
-
-STD_LEVEL = logging.INFO
-
class TSStatusCode(Enum):
SUCCESS_STATUS = 200
diff --git a/iotdb-core/ainode/ainode/core/rpc/service.py
b/iotdb-core/ainode/ainode/core/rpc/service.py
index 72bd38c4ade..946fb53abda 100644
--- a/iotdb-core/ainode/ainode/core/rpc/service.py
+++ b/iotdb-core/ainode/ainode/core/rpc/service.py
@@ -71,8 +71,8 @@ class AINodeRPCService(threading.Thread):
self._handler = handler
processor = IAINodeRPCService.Processor(handler=self._handler)
transport = TSocket.TServerSocket(
-
host=AINodeDescriptor().get_config().get_ain_inference_rpc_address(),
- port=AINodeDescriptor().get_config().get_ain_inference_rpc_port(),
+ host=AINodeDescriptor().get_config().get_ain_rpc_address(),
+ port=AINodeDescriptor().get_config().get_ain_rpc_port(),
)
transport_factory = TTransport.TFramedTransportFactory()
if
AINodeDescriptor().get_config().get_ain_thrift_compression_enabled():
diff --git a/iotdb-core/ainode/ainode/core/script.py
b/iotdb-core/ainode/ainode/core/script.py
index a03f2807221..8cccfec5d17 100644
--- a/iotdb-core/ainode/ainode/core/script.py
+++ b/iotdb-core/ainode/ainode/core/script.py
@@ -39,10 +39,8 @@ def remove_ainode(arguments):
# Delete the current node
if len(arguments) == 2:
target_ainode_id = AINodeDescriptor().get_config().get_ainode_id()
- target_rpc_address = (
- AINodeDescriptor().get_config().get_ain_inference_rpc_address()
- )
- target_rpc_port =
AINodeDescriptor().get_config().get_ain_inference_rpc_port()
+ target_rpc_address =
AINodeDescriptor().get_config().get_ain_rpc_address()
+ target_rpc_port = AINodeDescriptor().get_config().get_ain_rpc_port()
# Delete the node with a given id
elif len(arguments) == 3:
diff --git a/iotdb-core/ainode/pyproject.toml b/iotdb-core/ainode/pyproject.toml
index 3be9760651f..30ba0297307 100644
--- a/iotdb-core/ainode/pyproject.toml
+++ b/iotdb-core/ainode/pyproject.toml
@@ -21,7 +21,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "apache-iotdb-ainode"
-version = "2.0.5.dev"
+version = "2.0.6.dev"
description = "Apache IoTDB AINode"
readme = "README.md"
authors = ["Apache Software Foundation <[email protected]>"]
diff --git a/iotdb-core/ainode/resources/conf/iotdb-ainode.properties
b/iotdb-core/ainode/resources/conf/iotdb-ainode.properties
index db1f9358480..b31079ce00d 100644
--- a/iotdb-core/ainode/resources/conf/iotdb-ainode.properties
+++ b/iotdb-core/ainode/resources/conf/iotdb-ainode.properties
@@ -26,6 +26,16 @@ cluster_name=defaultCluster
# Datatype: String
ain_seed_config_node=127.0.0.1:10710
+# Used for connection of DataNode/ConfigNode clients
+# Could set 127.0.0.1(for local test) or ipv4 address
+# Datatype: String
+ain_rpc_address=127.0.0.1
+
+# Used for connection of DataNode/ConfigNode clients
+# Bind with MN_RPC_ADDRESS
+# Datatype: String
+ain_rpc_port=10810
+
# The DataNode address for fetching IoTDB data
# Datatype: String
ain_cluster_ingress_address=127.0.0.1
@@ -46,16 +56,6 @@ ain_cluster_ingress_password=root
# Datatype: String
ain_cluster_ingress_time_zone=UTC+8
-# Used for connection of DataNode/ConfigNode clients
-# Could set 127.0.0.1(for local test) or ipv4 address
-# Datatype: String
-ain_inference_rpc_address=127.0.0.1
-
-# Used for connection of DataNode/ConfigNode clients
-# Bind with MN_RPC_ADDRESS
-# Datatype: String
-ain_inference_rpc_port=10810
-
# The AINode metadata storage path.
# The starting directory of the relative path is related to the operating
system.
# It is recommended to use an absolute path.
diff --git a/scripts/sbin/stop-ainode.sh b/scripts/sbin/stop-ainode.sh
index d6560d98f8d..74d27f3b9fc 100644
--- a/scripts/sbin/stop-ainode.sh
+++ b/scripts/sbin/stop-ainode.sh
@@ -20,14 +20,14 @@
AINODE_CONF="`dirname "$0"`/../conf"
if [ -f "${AINODE_CONF}/iotdb-ainode.properties" ]; then
- ain_inference_rpc_port=$(sed '/^ain_inference_rpc_port=/!d;s/.*=//'
"${AINODE_CONF}"/iotdb-ainode.properties)
+ ain_rpc_port=$(sed '/^ain_rpc_port=/!d;s/.*=//'
"${AINODE_CONF}"/iotdb-ainode.properties)
# trim the port
- ain_inference_rpc_port=$(echo "$ain_inference_rpc_port" | sed -e
's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
+ ain_rpc_port=$(echo "$ain_rpc_port" | sed -e 's/^[[:space:]]*//' -e
's/[[:space:]]*$//')
fi
-if [ -z "$ain_inference_rpc_port" ]; then
- echo "WARNING: ain_inference_rpc_port not found in the configuration file.
Using default value ain_inference_rpc_port=10810"
- ain_inference_rpc_port=10810
+if [ -z "$ain_rpc_port" ]; then
+ echo "WARNING: ain_rpc_port not found in the configuration file. Using
default value ain_rpc_port=10810"
+ ain_rpc_port=10810
fi
# fetch parameters with names
@@ -45,18 +45,18 @@ while getopts "i:t:r" opt; do
esac
done
-# If p_ain_remove_target exists, take the value after the colon of
p_ain_remove_target as ain_inference_rpc_port
+# If p_ain_remove_target exists, take the value after the colon of
p_ain_remove_target as ain_rpc_port
if [ -n "$p_ain_remove_target" ]; then
- ain_inference_rpc_port=${p_ain_remove_target#*:}
+ ain_rpc_port=${p_ain_remove_target#*:}
fi
-echo "Check whether the rpc_port is used..., port is" $ain_inference_rpc_port
+echo "Check whether the rpc_port is used..., port is" $ain_rpc_port
if type lsof > /dev/null 2>&1 ; then
- echo $(lsof -t -i:"${ain_inference_rpc_port}" -sTCP:LISTEN)
- PID=$(lsof -t -i:"${ain_inference_rpc_port}" -sTCP:LISTEN)
+ echo $(lsof -t -i:"${ain_rpc_port}" -sTCP:LISTEN)
+ PID=$(lsof -t -i:"${ain_rpc_port}" -sTCP:LISTEN)
elif type netstat > /dev/null 2>&1 ; then
- PID=$(netstat -anp 2>/dev/null | grep ":${ain_inference_rpc_port} " | grep '
LISTEN ' | awk '{print $NF}' | sed "s|/.*||g" )
+ PID=$(netstat -anp 2>/dev/null | grep ":${ain_rpc_port} " | grep ' LISTEN '
| awk '{print $NF}' | sed "s|/.*||g" )
else
echo ""
echo " Error: No necessary tool."
diff --git a/scripts/sbin/windows/stop-ainode.bat
b/scripts/sbin/windows/stop-ainode.bat
index 8bcc462b746..94307403a1f 100644
--- a/scripts/sbin/windows/stop-ainode.bat
+++ b/scripts/sbin/windows/stop-ainode.bat
@@ -35,27 +35,27 @@ shift
goto initial
:done
-for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "^ain_inference_rpc_port"
+for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "^ain_rpc_port"
%IOTDB_AINODE_HOME%\conf\iotdb-ainode.properties') do (
- set ain_inference_rpc_port=%%i
+ set ain_rpc_port=%%i
)
-echo Check whether the rpc_port is used..., port is %ain_inference_rpc_port%
+echo Check whether the rpc_port is used..., port is %ain_rpc_port%
-for /f "eol=# tokens=2 delims==" %%i in ('findstr /i
"ain_inference_rpc_address"
+for /f "eol=# tokens=2 delims==" %%i in ('findstr /i "ain_rpc_address"
%IOTDB_AINODE_HOME%\conf\iotdb-ainode.properties') do (
- set ain_inference_rpc_address=%%i
+ set ain_rpc_address=%%i
)
if defined t (
- for /f "tokens=2 delims=/" %%a in ("%t%") do set "ain_inference_rpc=%%a"
+ for /f "tokens=2 delims=/" %%a in ("%t%") do set "ain_rpc=%%a"
) else (
- set ain_inference_rpc=%ain_inference_rpc_address%:%ain_inference_rpc_port%
+ set ain_rpc=%ain_rpc_address%:%ain_rpc_port%
)
-echo Target AINode to be stopped: %ain_inference_rpc%
+echo Target AINode to be stopped: %ain_rpc%
-for /f "tokens=5" %%a in ('netstat /ano ^| findstr /r /c:"^ *TCP
*%ain_inference_rpc%.*$"') do (
+for /f "tokens=5" %%a in ('netstat /ano ^| findstr /r /c:"^ *TCP
*%ain_rpc%.*$"') do (
taskkill /f /pid %%a
echo Close AINode, PID: %%a
)