[AINode] Remove remove-ainode scripts (#16023)

This commit is contained in:
Yongzao 2025-07-24 18:24:39 +08:00 committed by GitHub
parent 08ab2c9dcd
commit d2ee52ee14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 0 additions and 227 deletions

View File

@ -76,14 +76,5 @@
</includes>
<fileMode>0755</fileMode>
</fileSet>
<fileSet>
<directory>${project.basedir}/../../scripts/tools</directory>
<outputDirectory>tools</outputDirectory>
<includes>
<include>*ainode.*</include>
<include>**/*ainode.*</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
</assembly>

View File

@ -1,111 +0,0 @@
#!/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 [ "$#" -eq 1 ] && [ "$1" == "--help" ]; then
echo "The script will remove an AINode."
echo "When it is necessary to move an already connected AINode out of the cluster, the corresponding removal script can be executed."
echo "Usage:"
echo "Remove the AINode with ainode_id"
echo "./sbin/remove-ainode.sh -t [ainode_id]"
echo ""
echo "Options:"
echo " -t = ainode_id"
echo " -i = When specifying the Python interpreter please enter the address of the executable file of the Python interpreter in the virtual environment. Currently AINode supports virtual environments such as venv, conda, etc. Inputting the system Python interpreter as the installation location is not supported. In order to ensure that scripts are recognized properly, please use absolute paths whenever possible!"
exit 0
fi
echo ---------------------------
echo Removing IoTDB AINode
echo ---------------------------
IOTDB_AINODE_HOME="$(cd "`dirname "$0"`"/../..; pwd)"
echo "IOTDB_AINODE_HOME: $IOTDB_AINODE_HOME"
chmod u+x $IOTDB_AINODE_HOME/conf/ainode-env.sh
ain_interpreter_dir=$(sed -n 's/^ain_interpreter_dir=\(.*\)$/\1/p' $IOTDB_AINODE_HOME/conf/ainode-env.sh)
ain_system_dir=$(sed -n 's/^ain_system_dir=\(.*\)$/\1/p' $IOTDB_AINODE_HOME/conf/iotdb-ainode.properties)
bash $IOTDB_AINODE_HOME/conf/ainode-env.sh $*
if [ $? -eq 1 ]; then
echo "Environment check failed. Exiting..."
exit 1
fi
# fetch parameters with names
while getopts "i:t:rn" opt; do
case $opt in
i) p_ain_interpreter_dir="$OPTARG"
;;
r) p_ain_force_reinstall="$OPTARG"
;;
t) p_ain_remove_target="$OPTARG"
;;
n)
;;
\?) echo "Invalid option -$OPTARG" >&2
exit 1
;;
esac
done
# If ain_interpreter_dir in parameters is empty:
if [ -z "$p_ain_interpreter_dir" ]; then
# If ain_interpreter_dir in ../conf/ainode-env.sh is empty, set default value to ../venv/bin/python3
if [ -z "$ain_interpreter_dir" ]; then
ain_interpreter_dir="$IOTDB_AINODE_HOME/venv/bin/python3"
fi
else
# If ain_interpreter_dir in parameters is not empty, set ain_interpreter_dir to the value in parameters
ain_interpreter_dir="$p_ain_interpreter_dir"
fi
# If ain_system_dir is empty, set default value to ../data/ainode/system
if [ -z "$ain_system_dir" ]
then
ain_system_dir="$IOTDB_AINODE_HOME/data/ainode/system"
fi
echo "Script got parameters: ain_interpreter_dir: $ain_interpreter_dir, ain_system_dir: $ain_system_dir"
# check if ain_interpreter_dir is an absolute path
if [[ "$ain_interpreter_dir" != /* ]]; then
ain_interpreter_dir="$IOTDB_AINODE_HOME/$ain_interpreter_dir"
fi
# Change the working directory to the parent directory
cd "$IOTDB_AINODE_HOME"
ain_ainode_dir=$(dirname "$ain_interpreter_dir")/ainode
if [ -z "$p_ain_remove_target" ]; then
echo No target AINode set, use system.properties
$ain_ainode_dir remove
else
$ain_ainode_dir remove $p_ain_remove_target
fi
if [ $? -eq 1 ]; then
echo "Remove AINode failed. Exiting..."
exit 1
fi
bash $IOTDB_AINODE_HOME/sbin/stop-ainode.sh $*
# Remove system directory
rm -rf $ain_system_dir

View File

@ -1,107 +0,0 @@
@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
IF "%~1"=="--help" (
echo The script will remove an AINode.
echo When it is necessary to move an already connected AINode out of the cluster, the corresponding removal script can be executed.
echo Usage:
echo Remove the AINode with ainode_id
echo ./tools/windows/ops/remove-ainode.bat -t [ainode_id]
echo.
echo Options:
echo ^ ^ -t = ainode_id
echo ^ ^ -i = When specifying the Python interpreter please enter the address of the executable file of the Python interpreter in the virtual environment. Currently AINode supports virtual environments such as venv, conda, etc. Inputting the system Python interpreter as the installation location is not supported. In order to ensure that scripts are recognized properly, please use absolute paths whenever possible!
EXIT /B 0
)
echo ```````````````````````````
echo Removing IoTDB AINode
echo ```````````````````````````
pushd %~dp0..\..\..
if NOT DEFINED IOTDB_AINODE_HOME set IOTDB_AINODE_HOME=%cd%
popd
call %IOTDB_AINODE_HOME%\\conf\\windows\\ainode-env.bat %*
if %errorlevel% neq 0 (
echo Environment check failed. Exiting...
exit /b 1
)
:initial
if "%1"=="" goto interpreter
set aux=%1
if "%aux:~0,1%"=="-" (
set nome=%aux:~1,250%
) else (
set "%nome%=%1"
set nome=
)
shift
goto initial
for /f "tokens=2 delims==" %%a in ('findstr /i /c:"^ain_interpreter_dir" "%IOTDB_AINODE_HOME%\\conf\\windows\\\ainode-env.bat"') do (
set _ain_interpreter_dir=%%a
goto :interpreter
)
:interpreter
if "%i%"=="" (
if "%_ain_interpreter_dir%"=="" (
set _ain_interpreter_dir=%IOTDB_AINODE_HOME%\\venv\\Scripts\\python.exe
)
) else (
set _ain_interpreter_dir=%i%
)
for /f "tokens=2 delims==" %%a in ('findstr /i /c:"^ain_system_dir" "%IOTDB_AINODE_HOME%\\conf\\iotdb-\ainode.properties"') do (
set _ain_system_dir=%%a
goto :system
)
:system
if "%_ain_system_dir%"=="" (
set _ain_system_dir=%IOTDB_AINODE_HOME%\\data\\\ainode\\system
)
echo Script got parameters: ain_interpreter_dir: %_ain_interpreter_dir%, ain_system_dir: %_ain_system_dir%
cd %IOTDB_AINODE_HOME%
for %%i in ("%_ain_interpreter_dir%") do set "parent=%%~dpi"
set ain_\ainode_dir=%parent%\\\ainode.exe
if "%t%"=="" (
echo No target AINode set, use system.properties
%ain_\ainode_dir% remove
) else (
%ain_\ainode_dir% remove %t%
)
if %errorlevel% neq 0 (
echo Remove AINode failed. Exiting...
exit /b 1
)
call %IOTDB_AINODE_HOME%\\sbin\\windows\\stop-\ainode.bat %*
rd /s /q %_ain_system_dir%
pause