Skip to content

Commit d663d16

Browse files
authored
AINode deployment (#821)
1 parent 4454c13 commit d663d16

File tree

3 files changed

+762
-3
lines changed

3 files changed

+762
-3
lines changed

src/zh/UserGuide/Master/Table/Deployment-and-Maintenance/AINode_Deployment_timecho.md

Lines changed: 254 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,102 @@
1+
<!--
2+
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
20+
-->
21+
# AINode 部署
22+
23+
## 1. AINode介绍
24+
25+
### 1.1 能力介绍
26+
27+
AINode 是 IoTDB 在 ConfigNode、DataNode 后提供的第三种内生节点,该节点通过与 IoTDB 集群的 DataNode、ConfigNode 的交互,扩展了对时间序列进行机器学习分析的能力,支持从外部引入已有机器学习模型进行注册,并使用注册的模型在指定时序数据上通过简单 SQL 语句完成时序分析任务的过程,将模型的创建、管理及推理融合在数据库引擎中。目前已提供常见时序分析场景(例如预测与异常检测)的机器学习算法或自研模型。
28+
29+
### 1.2 交付方式
30+
是 IoTDB 集群外的额外套件,独立安装包。
31+
32+
### 1.3 部署模式
33+
<div >
34+
<img src="/img/AINode%E9%83%A8%E7%BD%B21.png" alt="" style="width: 45%;"/>
35+
<img src="/img/AINode%E9%83%A8%E7%BD%B22.png" alt="" style="width: 45%;"/>
36+
</div>
37+
38+
## 2. 安装准备
39+
40+
### 2.1 安装包获取
41+
42+
AINode 安装包(`apache-iotdb-<version>-ainode-bin.zip`),安装包解压后目录结构如下:
43+
| **目录** | **类型** | **说明** |
44+
| ------------ | -------- | ------------------------------------------------ |
45+
| lib | 文件夹 | AINode编译后的二进制可执行文件以及相关的代码依赖 |
46+
| sbin | 文件夹 | AINode的运行脚本,可以启动,移除和停止AINode |
47+
| conf | 文件夹 | 包含AINode的配置项,具体包含以下配置项 |
48+
| LICENSE | 文件 | 证书 |
49+
| NOTICE | 文件 | 提示 |
50+
| README_ZH.md | 文件 | markdown格式的中文版说明 |
51+
| `README.md` | 文件 | 使用说明 |
52+
53+
### 2.2 环境准备
54+
55+
1. 建议操作环境: Ubuntu, CentOS, MacOS
56+
2. IoTDB 版本:>= V 2.0.5.1
57+
3. 运行环境
58+
- Python 版本在 3.9 ~3.12,且带有 pip 和 venv 工具;
59+
60+
61+
## 3. 安装部署及使用
62+
63+
### 3.1 安装 AINode
64+
65+
1. 保证 Python 版本介于 3.9 ~3.12
66+
67+
```shell
68+
python --version
69+
#
70+
python3 --version
71+
```
72+
2. 下载导入 AINode 到专用文件夹,切换到专用文件夹并解压安装包
73+
74+
```shell
75+
unzip timechodb-2.0.5.1-ainode-bin.zip
76+
```
77+
78+
3. 创建虚拟环境(在 ainode 目录下执行):
79+
80+
```shell
81+
python3 -m venv venv
82+
```
83+
84+
4. 激活虚拟环境:
85+
86+
```shell
87+
source venv/bin/activate
88+
```
89+
90+
5. 更新 pip 并安装 AINode 依赖
91+
```shell
92+
python -m pip install --upgrade pip
93+
poetry lock
94+
poetry install
95+
```
96+
97+
### 3.2 配置项修改
98+
AINode 支持修改一些必要的参数。可以在 `conf/iotdb-ainode.properties` 文件中找到下列参数并进行持久化的修改:
99+
1100
| **名称** | **描述** | **类型** | **默认值** |
2101
| ------------------------------ | ------------------------------------------------------------ | -------- | ------------------ |
3102
| cluster_name | AINode 要加入集群的标识 | string | defaultCluster |
@@ -11,4 +110,158 @@
11110
| ain_inference_rpc_port | AINode 提供服务与通信的端口 | String | 10810 |
12111
| ain_system_dir | AINode 元数据存储路径,相对路径的起始目录与操作系统相关,建议使用绝对路径 | String | data/AINode/system |
13112
| ain_models_dir | AINode 存储模型文件的路径,相对路径的起始目录与操作系统相关,建议使用绝对路径 | String | data/AINode/models |
14-
| ain_thrift_compression_enabled | AINode 是否启用 thrift 的压缩机制,0-不启动、1-启动 | Boolean | 0 |
113+
| ain_thrift_compression_enabled | AINode 是否启用 thrift 的压缩机制,0-不启动、1-启动 | Boolean | 0 |
114+
115+
### 3.3 启动 AINode
116+
117+
在完成 Seed-ConfigNode 的部署后,可以通过添加 AINode 节点来支持模型的注册和推理功能。在配置项中指定 IoTDB 集群的信息后,可以执行相应的指令来启动 AINode,加入 IoTDB 集群。
118+
119+
#### 联网环境启动
120+
121+
##### 启动命令
122+
123+
```shell
124+
# 启动命令
125+
# Linux 和 MacOS 系统
126+
bash sbin/start-ainode.sh
127+
128+
# Windows 系统
129+
sbin\start-ainode.bat
130+
131+
# 后台启动命令(长期运行推荐)
132+
# Linux 和 MacOS 系统
133+
nohup bash sbin/start-ainode.sh > myout.file 2>& 1 &
134+
135+
# Windows 系统
136+
nohup bash sbin\start-ainode.bat > myout.file 2>& 1 &
137+
```
138+
139+
#### 示例
140+
141+
```shell
142+
# 启动命令
143+
# Linux 和 MacOS 系统
144+
bash sbin/start-ainode.sh
145+
# Windows 系统
146+
sbin\start-ainode.bat
147+
148+
149+
# 后台启动命令(长期运行推荐)
150+
# Linux 和 MacOS 系统
151+
nohup bash sbin/start-ainode.sh > myout.file 2>& 1 &
152+
# Windows 系统
153+
nohup bash sbin\start-ainode.bat > myout.file 2>& 1 &
154+
```
155+
156+
### 3.4 检测 AINode 节点状态
157+
158+
AINode 启动过程中会自动将新的 AINode 加入 IoTDB 集群。启动 AINode 后可以在 命令行中输入 SQL 来查询,集群中看到 AINode 节点,其运行状态为 Running(如下展示)表示加入成功。
159+
160+
```shell
161+
IoTDB> show cluster
162+
+------+----------+-------+---------------+------------+-------+-----------+
163+
|NodeID| NodeType| Status|InternalAddress|InternalPort|Version| BuildInfo|
164+
+------+----------+-------+---------------+------------+-------+-----------+
165+
| 0|ConfigNode|Running| 127.0.0.1| 10710|UNKNOWN|190e303-dev|
166+
| 1| DataNode|Running| 127.0.0.1| 10730|UNKNOWN|190e303-dev|
167+
| 2| AINode|Running| 127.0.0.1| 10810|UNKNOWN|190e303-dev|
168+
+------+----------+-------+---------------+------------+-------+-----------+
169+
```
170+
171+
### 3.5 停止 AINode
172+
173+
如果需要停止正在运行的 AINode 节点,则执行相应的关闭脚本。
174+
175+
#### 停止命令
176+
177+
```shell
178+
# Linux / MacOS
179+
bash sbin/stop-ainode.sh
180+
181+
#Windows
182+
sbin\stop-ainode.bat
183+
```
184+
185+
#### 示例
186+
```shell
187+
# Linux / MacOS
188+
bash sbin/stop-ainode.sh
189+
190+
# Windows
191+
sbin\stop-ainode.bat
192+
```
193+
停止 AINode 后,还可以在集群中看到 AINode 节点,其运行状态为 UNKNOWN(如下展示),此时无法使用 AINode 功能。
194+
195+
```shell
196+
IoTDB> show cluster
197+
+------+----------+-------+---------------+------------+-------+-----------+
198+
|NodeID| NodeType| Status|InternalAddress|InternalPort|Version| BuildInfo|
199+
+------+----------+-------+---------------+------------+-------+-----------+
200+
| 0|ConfigNode|Running| 127.0.0.1| 10710|UNKNOWN|190e303-dev|
201+
| 1| DataNode|Running| 127.0.0.1| 10730|UNKNOWN|190e303-dev|
202+
| 2| AINode|UNKNOWN| 127.0.0.1| 10790|UNKNOWN|190e303-dev|
203+
+------+----------+-------+---------------+------------+-------+-----------+
204+
```
205+
如果需要重新启动该节点,需重新执行启动脚本。
206+
207+
208+
209+
## 4. 常见问题
210+
211+
### 4.1 启动AINode时出现找不到venv模块的报错
212+
213+
当使用默认方式启动 AINode 时,会在安装包目录下创建一个 python 虚拟环境并安装依赖,因此要求安装 venv 模块。通常来说 python3.10 及以上的版本会自带 venv,但对于一些系统自带的 python 环境可能并不满足这一要求。出现该报错时有两种解决方案(二选一):
214+
215+
在本地安装 venv 模块,以 ubuntu 为例,可以通过运行以下命令来安装 python 自带的 venv 模块。或者从 python 官网安装一个自带 venv 的 python 版本。
216+
217+
```shell
218+
apt-get install python3.10-venv
219+
```
220+
安装 3.10.0 版本的 venv 到 AINode 里面 在 AINode 路径下
221+
222+
```shell
223+
../Python-3.10.0/python -m venv venv(文件夹名)
224+
```
225+
在运行启动脚本时通过 `-i` 指定已有的 python 解释器路径作为 AINode 的运行环境,这样就不再需要创建一个新的虚拟环境。
226+
227+
### 4.2 python中的SSL模块没有被正确安装和配置,无法处理HTTPS资源
228+
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
229+
可以安装 OpenSSLS 后,再重新构建 python 来解决这个问题
230+
> Currently Python versions 3.6 to 3.9 are compatible with OpenSSL 1.0.2, 1.1.0, and 1.1.1.
231+
232+
Python 要求我们的系统上安装有 OpenSSL,具体安装方法可见[链接](https://stackoverflow.com/questions/56552390/how-to-fix-ssl-module-in-python-is-not-available-in-centos)
233+
234+
```shell
235+
sudo apt-get install build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev uuid-dev lzma-dev liblzma-dev
236+
sudo -E ./configure --with-ssl
237+
make
238+
sudo make install
239+
```
240+
241+
### 4.3 pip版本较低
242+
243+
windows下出现类似“error:Microsoft Visual C++ 14.0 or greater is required...”的编译问题
244+
245+
出现对应的报错,通常是 c++版本或是 setuptools 版本不足,可以在
246+
247+
```shell
248+
./python -m pip install --upgrade pip
249+
./python -m pip install --upgrade setuptools
250+
```
251+
252+
253+
### 4.4 安装编译python
254+
255+
使用以下指定从官网下载安装包并解压:
256+
```shell
257+
.wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tar.xz
258+
tar Jxf Python-3.10.0.tar.xz
259+
```
260+
编译安装对应的 python 包:
261+
```shell
262+
cd Python-3.10.0
263+
./configure prefix=/usr/local/python3
264+
make
265+
sudo make install
266+
python3 --version
267+
```

0 commit comments

Comments
 (0)