diff --git a/helm/README.md b/helm/README.md new file mode 100644 index 0000000..082c2b2 --- /dev/null +++ b/helm/README.md @@ -0,0 +1,148 @@ + + +# 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: + +## Connect to the cluster + +### To connect to a cluster in a Kubernetes environment + +The address of a DataNode is `datanode-.datanode-svc.iotdb-cluster`,with port number `6667`,You need to modify the value of `` 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 + + + +2. Use of PVC + + + + 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. + + + + +2. Show the node status in the cluster. + + + + 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) + + + +3. Perform data queries + + \ No newline at end of file diff --git a/helm/README_zh.md b/helm/README_zh.md new file mode 100644 index 0000000..c1e3699 --- /dev/null +++ b/helm/README_zh.md @@ -0,0 +1,154 @@ + + +# 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 状态时,系统就处于可以状态了, 如下图所示 + + + +## 连接到集群 + +### 在 Kubernetes 环境中来连接集群 + +DataNode 的地址为 `datanode-.datanode-svc.iotdb-cluster`, 端口号为`6667`;需要根据想要连接的datanode的序号,修改地址中\ 的值; 例如,`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运行情况 + + + +2. pvc 使用情况 + + + + 每个confignode\datanode 都会独立使用一个pvc,并将其数据持久化到对应的pvc中 + + +### 在集群内部连接并访问集群 + +1. 使用cli通过datanode的集群内部地址建立连接 + + + + +2. 展示集群中的节点情况 + + + + 可以看到,集群中的节点地址均为Kubernetes 中内部FQDN + +3. 展示集群中的前十条时间序列(已经进行了测试数据写入) + + + +3. 进行数据查询 + + \ No newline at end of file diff --git a/images/getpods.png b/images/getpods.png new file mode 100644 index 0000000..3f50741 Binary files /dev/null and b/images/getpods.png differ diff --git a/images/getpvc.png b/images/getpvc.png new file mode 100644 index 0000000..912de02 Binary files /dev/null and b/images/getpvc.png differ diff --git a/images/logininner.png b/images/logininner.png new file mode 100644 index 0000000..e5a726e Binary files /dev/null and b/images/logininner.png differ diff --git a/images/select10.png b/images/select10.png new file mode 100644 index 0000000..7aab16e Binary files /dev/null and b/images/select10.png differ diff --git a/images/showcluster.png b/images/showcluster.png new file mode 100644 index 0000000..f2fdfe7 Binary files /dev/null and b/images/showcluster.png differ diff --git a/images/showtimeseries.png b/images/showtimeseries.png new file mode 100644 index 0000000..8df21ce Binary files /dev/null and b/images/showtimeseries.png differ