Skip to main content

AINode Deployment

...About 7 min

AINode Deployment

Installation environment

Ubuntu, CentOS, MacOS

Runtime Environment

AINode currently requires Python 3.8 or higher with pip and venv tools.

For networked environments, AINode creates a virtual environment and downloads runtime dependencies automatically, no additional configuration is needed.

In case of a non-networked environment, you can download it from https://cloud.tsinghua.edu.cn/d/4c1342f6c272439aa96c/toopen in new window get the required dependencies and install them offline.

Installation steps

Users can download the AINode software installation package, download and unzip it to complete the installation of AINode. You can also download the source code from the code repository and compile it to get the installation package.

Software directory structure

After downloading and extracting the software package, you can get the following directory structure

|-- apache-iotdb-AINode-bin
    |-- lib # package binary executable with environment dependencies
    |-- conf # store configuration files
        - iotdb-AINode.properties
    |-- sbin # AINode related startup scripts
        - start-AINode.sh
        - start-AINode.bat
        - stop-AINode.sh
        - stop-AINode.bat
        - remove-AINode.sh
        - remove-AINode.bat
    |-- licenses
    - LICENSE
    - NOTICE
    - README.md
    - README_ZH.md
    - RELEASE_NOTES.md
  • lib: AINode's compiled binary executable and related code dependencies.
  • conf: contains AINode's configuration items, specifically the following configuration items
  • sbin: AINode's runtime script, which can start, remove and stop AINode.

Start AINode

After completing the deployment of Seed-ConfigNode, you can add an AINode node to support the model registration and inference functions. After specifying the information of IoTDB cluster in the configuration item, you can execute the corresponding commands to start AINode and join the IoTDB cluster.

Note: Starting AINode requires that the system environment contains a Python interpreter of 3.8 or above as the default interpreter, so users should check whether the Python interpreter exists in the environment variables and can be directly invoked through the python command before using it.

Direct Start

After obtaining the installation package files, you can directly start AINode for the first time.

The startup commands on Linux and MacOS are as follows:

> bash sbin/start-AINode.sh

The startup command on windows is as follows:

> sbin\start-AINode.bat

If start AINode for the first time and do not specify the path to the interpreter, the script will create a new venv virtual environment in the root directory of the program using the system Python interpreter, and install the third-party dependencies of AINode and the main program of AINode in this environment automatically and successively. This process will generate a virtual environment of about 1GB in size, so please reserve space for installation. On subsequent startups, if the path to the interpreter is not specified, the script will automatically look for the newly created venv environment above and start AINode without having to install the program and dependencies repeatedly.

Note that it is possible to activate reinstall with -r if you wish to force a reinstall of AINode proper on a certain startup, this parameter will reinstall AINode based on the files under lib.

Linux和MacOS:

> bash sbin/start-AINode.sh -r

Windows:

> sbin\start-AINode.bat -r

For example, a user replaces a newer version of the AINode installer in the lib, but the installer is not installed in the user's usual environment. In this case, you need to add the -r option at startup to instruct the script to force a reinstallation of the main AINode program in the virtual environment to update the version.

Specify a customized virtual environment

When starting AINode, you can specify a virtual environment interpreter path to install the AINode main program and its dependencies to a specific location. Specifically, you need to specify the value of the parameter ain_interpreter_dir.

Linux and MacOS:

> bash sbin/start-AINode.sh -i xxx/bin/python

Windows:

> sbin\start-AINode.bat -i xxx\Scripts\python.exe

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!

Join the cluster

The AINode startup process automatically adds the new AINode to the IoTDB cluster. After starting the AINode you can verify that the node was joined successfully by entering the SQL for the cluster query in IoTDB's cli command line.

IoTDB> show cluster
+------+----------+-------+---------------+------------+-------+-----------+
|NodeID|  NodeType| Status|InternalAddress|InternalPort|Version|  BuildInfo|
+------+----------+-------+---------------+------------+-------+-----------+
|     0|ConfigNode|Running|      127.0.0.1|       10710|UNKNOWN|190e303-dev|
|     1|  DataNode|Running|      127.0.0.1|       10730|UNKNOWN|190e303-dev|
|     2|    AINode|Running|      127.0.0.1|       10810|UNKNOWN|190e303-dev|
+------+----------+-------+---------------+------------+-------+-----------+

IoTDB> show cluster details
+------+----------+-------+---------------+------------+-------------------+----------+-------+-------+-------------------+-----------------+-------+-----------+
|NodeID|  NodeType| Status|InternalAddress|InternalPort|ConfigConsensusPort|RpcAddress|RpcPort|MppPort|SchemaConsensusPort|DataConsensusPort|Version|  BuildInfo|
+------+----------+-------+---------------+------------+-------------------+----------+-------+-------+-------------------+-----------------+-------+-----------+
|     0|ConfigNode|Running|      127.0.0.1|       10710|              10720|          |       |       |                   |                 |UNKNOWN|190e303-dev|
|     1|  DataNode|Running|      127.0.0.1|       10730|                   |   0.0.0.0|   6667|  10740|              10750|            10760|UNKNOWN|190e303-dev|
|     2|    AINode|Running|      127.0.0.1|       10810|                   |   0.0.0.0|  10810|       |                   |                 |UNKNOWN|190e303-dev|
+------+----------+-------+---------------+------------+-------------------+----------+-------+-------+-------------------+-----------------+-------+-----------+

IoTDB> show AINodes
+------+-------+----------+-------+
|NodeID| Status|RpcAddress|RpcPort|
+------+-------+----------+-------+
|     2|Running| 127.0.0.1|  10810|
+------+-------+----------+-------+

Remove AINode

When it is necessary to move an already connected AINode out of the cluster, the corresponding removal script can be executed.

The commands on Linux and MacOS are as follows:

> bash sbin/remove-AINode.sh

The startup command on windows is as follows:

> sbin/remove-AINode.bat

After removing the node, information about the node will not be available.

IoTDB> show cluster
+------+----------+-------+---------------+------------+-------+-----------+
|NodeID|  NodeType| Status|InternalAddress|InternalPort|Version|  BuildInfo|
+------+----------+-------+---------------+------------+-------+-----------+
|     0|ConfigNode|Running|      127.0.0.1|       10710|UNKNOWN|190e303-dev|
|     1|  DataNode|Running|      127.0.0.1|       10730|UNKNOWN|190e303-dev|
+------+----------+-------+---------------+------------+-------+-----------+

In addition, if the location of the AINode installation was previously customized, then the remove script should be called with the corresponding path as an argument:

Linux and MacOS:

> bash sbin/remove-AINode.sh -i xxx/bin/python

Windows:

> sbin\remove-AINode.bat -i 1 xxx\Scripts\python.exe

Similarly, script parameters that are persistently modified in the env script will also take effect when the removal is performed.

If a user loses a file in the data folder, AINode may not be able to remove itself locally, and requires the user to specify the node number, address and port number for removal, in which case we support the user to enter parameters for removal as follows

Linux and MacOS:

> bash sbin/remove-AINode.sh -t <AINode-id>/<ip>:<rpc-port>

Windows:

> sbin\remove-AINode.bat -t <AINode-id>/<ip>:<rpc-port>

Stop AINode

If you need to stop a running AINode node, execute the appropriate shutdown script.

The commands on Linux and MacOS are as follows:

> bash sbin/stop-AINode.sh

The startup command on windows is as follows:

> sbin/stop-AINode.bat

At this point the exact state of the node is not available and the corresponding management and reasoning functions cannot be used. If you need to restart the node, just execute the startup script again.

IoTDB> show cluster
+------+----------+-------+---------------+------------+-------+-----------+
|NodeID|  NodeType| Status|InternalAddress|InternalPort|Version|  BuildInfo|
+------+----------+-------+---------------+------------+-------+-----------+
|     0|ConfigNode|Running|      127.0.0.1|       10710|UNKNOWN|190e303-dev|
|     1|  DataNode|Running|      127.0.0.1|       10730|UNKNOWN|190e303-dev|
|     2|    AINode|UNKNOWN|      127.0.0.1|       10790|UNKNOWN|190e303-dev|
+------+----------+-------+---------------+------------+-------+-----------+

Script parameter details

Two parameters are supported during AINode startup, and their specific roles are shown below:

NameAction ScriptTagDescriptionTypeDefault ValueInput Method
ain_interpreter_dirstart remove env-iThe path to the interpreter of the virtual environment in which AINode is installed; absolute paths are required.StringRead environment variables by defaultInput on call + persistent modifications
ain_remove_targetremove stop-tAINode shutdown can specify the Node ID, address, and port number of the target AINode to be removed, in the format of <AINode-id>/<ip>:<rpc-port>StringNullInput on call
ain_force_reinstallstart remove env-rThis script checks the version of the AINode installation, and if it does, it forces the installation of the whl package in lib if the version is not correct.BoolfalseInput on call
ain_no_dependenciesstart remove env-nSpecifies whether to install dependencies when installing AINode, if so only the main AINode program will be installed without dependencies.BoolfalseInput on call

Besides passing in the above parameters when executing the script as described above, it is also possible to modify some of the parameters persistently in the AINode-env.sh and AINode-env.bat scripts in the conf folder.

AINode-env.sh

# The defaulte venv environment is used if ain_interpreter_dir is not set. Please use absolute path without quotation mark
# ain_interpreter_dir=

AINode-env.bat

@REM The defaulte venv environment is used if ain_interpreter_dir is not set. Please use absolute path without quotation mark
@REM set ain_interpreter_dir=

Uncomment the corresponding line after writing the parameter value and save it to take effect the next time you execute the script.

AINode configuration items

AINode supports modifying some necessary parameters. The following parameters can be found in the conf/iotdb-AINode.properties file and modified for persistence:

NameDescriptionTypeDefault ValueModified Mode of Effect
ain_seed_config_nodeConfigNode address registered at AINode startupString10710Only allow to modify before the first startup
ain_inference_rpc_addressAddresses where AINode provides services and communicationsString127.0.0.1Effective after reboot
ain_inference_rpc_portAINode provides services and communication portsString10810Effective after reboot
ain_system_dirAINode metadata storage path, the starting directory of the relative path is related to the operating system, it is recommended to use the absolute path.Stringdata/AINode/systemEffective after reboot
ain_models_dirAINode stores the path to the model file. The starting directory of the relative path is related to the operating system, and an absolute path is recommended.Stringdata/AINode/modelsEffective after reboot
ain_logs_dirThe path where AINode stores the logs. The starting directory of the relative path is related to the operating system, and it is recommended to use the absolute path.Stringlogs/AINodeEffective after reboot

Frequently Asked Questions

  1. Not found venv module error when starting AINode

When starting AINode using the default method, a python virtual environment is created in the installation package directory and dependencies are installed, thus requiring the installation of the venv module. Generally speaking, python 3.8 and above will come with venv, but for some systems that come with python environment may not fulfill this requirement. There are two solutions when this error occurs (either one or the other):

  • Install venv module locally, take ubuntu as an example, you can run the following command to install the venv module that comes with python. Or install a version of python that comes with venv from the python website.
apt-get install python3.8-venv 
  • Specify the path to an existing python interpreter as the AINode runtime environment via -i when running the startup script, so that you no longer need to create a new virtual environment.
  1. Compiling the python environment in CentOS7

The new environment in centos7 (comes with python3.6) does not meet the requirements to start mlnode, you need to compile python3.8+ by yourself (python is not provided as a binary package in centos7)

  • Install OpenSSL

Currently Python versions 3.6 to 3.9 are compatible with OpenSSL 1.0.2, 1.1.0, and 1.1.1.

Python requires that we have OpenSSL installed on our system, which can be found at https://stackoverflow.com/questions/56552390/how-to-fix-ssl-module-in-python-is-not-available-in-centosopen in new window

  • Installation and compilation of python

Download the installation package from the official website and extract it using the following specifications

wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
tar -zxvf Python-3.8.1.tgz

Compile and install the corresponding python packages.

./configure prefix=/usr/local/python3 -with-openssl=/usr/local/openssl 
make && make install
  1. Windows compilation problem like "error: Microsoft Visual C++ 14.0 or greater is required..." compilation problem on windows.

The corresponding error is usually caused by an insufficient version of c++ or setuptools, you can find the appropriate solution at https://stackoverflow.com/questions/44951456/pip-error-microsoft-visual-c-14-0-is-requiredopen in new window
you can find a suitable solution there.

Copyright © 2024 The Apache Software Foundation.
Apache IoTDB, IoTDB, Apache, the Apache feather logo, and the Apache IoTDB project logo are either registered trademarks or trademarks of The Apache Software Foundation in all countries

Have a question? Connect with us on QQ, WeChat, or Slack. Join the community now.