Make sure that the current environment has the following tools installed and can successfully connect to the corresponding Kubernetes cluster.
Modify the configuration parameters in the helm/values.yaml file according to the corresponding requirements. Specifically:
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
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
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
Go to the ./helm/ directory and exec install command to install the IoTDB Cluster in a Kubernetes environment.
helm install iotdb-cluster .
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:
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.
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
We will show the operation status of each component in the cluster after deploying with 3 ConfigNodes and 3 DataNodes as an example.
Status of Pods
Use of PVC
Each confignode and datanode will use a separate PVC and persist its data to the corresponding PVC.
Use the CLI to establish a connection to the cluster's internal address of the datanode.
Show the node status in the cluster.
It can be seen that the node addresses in the cluster are all internal FQDNs in Kubernetes.
Show the top 10 time series in the cluster (after test data has been written)
Perform data queries