Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
helm add readme.md
  • Loading branch information
2b3c511 committed Nov 25, 2024
commit bbfb19eb967a675ac8e5a909636843ca3f89d9e7
148 changes: 148 additions & 0 deletions helm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<!--

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.

-->

# IoTDB CLuster on Kubernetes

## Deployment

### Deployment environment preparation

Make sure that the current environment has the following tools installed and can successfully connect to the corresponding Kubernetes cluster.

* kubectl
* helm (version >= v3.0.0)

### Parameter Configuration

Modify the configuration parameters in the `helm/values.yaml` file according to the corresponding requirements. Specifically:

1. Verify the current cluster's storage medium and specify the corresponding `storageClass`. IoTDB will create a `pv` on the corresponding data storage medium based on the `storageClass`.

```
storage:
className: local-storage # Set this value to the storage medium available in the current Kubernetes environment
```

2. Confirm the scale of the cluster
```
datanode:
# The number of DataNodes nodeCount: 3
nodeCount: 3
# The size of each datanode's corresponding data directory needs to be specified based on the designed data volume, and it cannot be modified afterward. In production environments, it is recommended to provide sufficient space based on the size of the data.
storageCapacity: 20Gi

confignode:
# The number of ConfigNodes nodeCount: 3
nodeCount: 3
#The size of the PVC used by confignode is generally not more than 10Gi, and the default value can be used directly.
storageCapacity: 10Gi
```

3. Verify the number of replicas

The IoTDB cluster can provide the ability to store multiple copies of data. You can choose a flexible storage medium based on your own usage. For example, if the storage medium corresponding to the storageClass does not provide data replication capabilities, you can set the metadata replication to 3 and the data replication to 3 to ensure data availability. If the storage medium corresponding to the storageClass has data redundancy, no data replication is needed at the IoTDB cluster level, and the metadata replication can be set to 1, and the data replication can be set to 1 or 2.

```
confignode:
# Number of metadata replicas
schemaReplicationFactor: 1
# Number of data replicas
dataReplicationFactor: 2
```


### Start the deployment

Go to the `./helm/` directory and exec `install` command to install the IoTDB Cluster in a Kubernetes environment.

```
helm install iotdb-cluster .
```

### Wait for the deployment to complete

You can use the `kubectl` command to view the progress of the deployment. When all the pods are in the Running state, the system is considered to be in a healthy state, as shown in the following figure: <img src='../images/getpods.png'>

## Connect to the cluster

### To connect to a cluster in a Kubernetes environment

The address of a DataNode is `datanode-<N>.datanode-svc.iotdb-cluster`,with port number `6667`,You need to modify the value of `<N>` in the address according to the index of the DataNode you want to connect to. For example, `datanode-0.datanode-svc.iotdb-cluster` represents the address of DataNode-0.

### Connect to the cluster from outside the cluster

If you want to connect to the cluster from outside via a program, you need to map the datanode-svc in the cluster to an address that can be accessed from outside the cluster; this may depend on the cloud characteristics of the current Kubernetes cluster.
For example, if your Kubernetes cluster has the "LoadBalancer" feature, you can map the 6667 port of the datanode to the outside of the cluster.

If you only need to perform local testing, you can map the 6667 port of the node datanode to a certain port on a Kubernetes cluster node through the `nodePort` method, and connect to the datanode by the mapped port and the IP address of the node. You can refer to
```
# node-port.yaml
apiVersion: v1
kind: Service
metadata:
namespace: iotdb-cluster
name: datanode-nodeport
spec:
type: NodePort
ports:
- port: 6667
targetPort: 6667
nodePort: 32667
selector:
app: datanode
```

## Demonstration Effects

### Cluster Deployment and Operational Status

We will show the operation status of each component in the cluster after deploying with 3 ConfigNodes and 3 DataNodes as an example.

1. Status of Pods

<img src='../images/getpods.png'>

2. Use of PVC

<img src='../images/getpvc.png'>

Each confignode and datanode will use a separate PVC and persist its data to the corresponding PVC.

### Connect and access the cluster within the cluster

1. Use the CLI to establish a connection to the cluster's internal address of the datanode.

<img src='../images/logininner.png'>


2. Show the node status in the cluster.

<img src='../images/showcluster.png'>

It can be seen that the node addresses in the cluster are all internal FQDNs in Kubernetes.

3. Show the top 10 time series in the cluster (after test data has been written)

<img src='../images/showtimeseries.png'>

3. Perform data queries

<img src='../images/select10.png'>
154 changes: 154 additions & 0 deletions helm/README_zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<!--

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.

-->

# IoTDB CLuster on Kubernetes

## 部署方法

### 部署环境准备

确保当前环境安装了以下工具并能成功连接到对应的 Kubernetes 集群

* kubectl
* helm (version >= v3.0.0)

### 参数配置

根据对应的需求修改 `helm/values.yaml` 里的配置参数。具体为:

1. 确认当前集群的存储介质,并指定相应的`storageClass`。IoTDB 将会根据`storageClass` 在对应的数据存储介质上创建`pv`

```
storage:
className: local-storage # 将该值指定为当前Kubernetes 中可用的存储介质
```

2. 确认集群规模
```
datanode:
# datanode 的节点数量
nodeCount: 3
# 每个 datanode 对应的数据目录的大小,需要根据设计的数据量指定,且指定后不可修改,生产环境中,建议根据数据量的大小给定充足的空间
storageCapacity: 20Gi

confignode:
# confignode 的节点数量
nodeCount: 3
# confignode 使用的pvc的大小,一般不会超过10Gi,可直接使用默认值
storageCapacity: 10Gi
```

3. 确认数据副本数

IoTDB 集群可以提供数据的多副本存储能力。可根据自身使用的存储介质进行灵活的选择。例如,storageClass对应的数据存储介质本身不提供数据的副本能力,则可以将元数据的副本设置为3、数据的副本也设置为3的方式来保证数据的可用性;如果storageClass对应的数据存储介质做了数据冗余,那无需在IoTDB 集群层面进行数据的多副本存储,可将元数据副本数置为1,数据副本数置为1或2。

```
confignode:
# 元数据副本数
schemaReplicationFactor: 1
# 数据副本数
dataReplicationFactor: 2
```


### 启动部署

进入 ./helm/ 目录,执行install 命令,将 IoTDB Cluster 安装到 Kubernetes 环境中

```
helm install iotdb-cluster .
```

### 等待部署完毕

可以通过`kubectl` 命令来查看部署的进展,当所有pod 为 Running 状态时,系统就处于可以状态了, 如下图所示
<img src='../images/getpods.png'>


## 连接到集群

### 在 Kubernetes 环境中来连接集群

DataNode 的地址为 `datanode-<N>.datanode-svc.iotdb-cluster`, 端口号为`6667`;需要根据想要连接的datanode的序号,修改地址中\<N\> 的值; 例如,`datanode-0.datanode-svc.iotdb-cluster` 表示datanode-0 的地址。

### 在集群外部连接到集群

如果希望通过集群外部的程序连接到集群,则需要将集群中的 datanode-svc 映射到集群外可以访问的地址;这可能取决于当前 Kubernetes 集群的云特性。

例如,如果您的 Kubernetes 集群具有`LoadBalancer` 的功能,则您可以将 datanode 的6667端口映射到集群外部;

如果仅仅是为了进行本地测试,则可以通过`nodePort` 的方式将节点datanode的6667端口映射到Kubernetes集群节点的某一端口,并通过映射后的端口和节点的ip地址对datanode进行连接。可参考

```
# node-port.yaml
apiVersion: v1
kind: Service
metadata:
namespace: iotdb-cluster
name: datanode-nodeport
spec:
type: NodePort
ports:
- port: 6667
targetPort: 6667
nodePort: 32667
selector:
app: datanode
```


## 演示效果

### 集群部署及运行状态

下面,以3个ConfigNode、3个DataNodes的部署方案为例,展示一下集群部署后各组件的运行状况

1. Pod运行情况

<img src='../images/getpods.png'>

2. pvc 使用情况

<img src='../images/getpvc.png'>

每个confignode\datanode 都会独立使用一个pvc,并将其数据持久化到对应的pvc中


### 在集群内部连接并访问集群

1. 使用cli通过datanode的集群内部地址建立连接

<img src='../images/logininner.png'>


2. 展示集群中的节点情况

<img src='../images/showcluster.png'>

可以看到,集群中的节点地址均为Kubernetes 中内部FQDN

3. 展示集群中的前十条时间序列(已经进行了测试数据写入)

<img src='../images/showtimeseries.png'>

3. 进行数据查询

<img src='../images/select10.png'>
Binary file added images/getpods.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/getpvc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/logininner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/select10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/showcluster.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/showtimeseries.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.