Cluster

The physical entities that form TDengine clusters are known as data nodes (dnodes). Each dnode is a process running on the operating system of the physical machine. Dnodes can contain virtual nodes (vnodes), which store time-series data. Virtual nodes are formed into vgroups, which have 1 or 3 vnodes depending on the replica setting. If you want to enable replication on your cluster, it must contain at least three nodes. Dnodes can also contain management nodes (mnodes). Each cluster has up to three mnodes. Finally, dnodes can contain query nodes (qnodes), which compute time-series data, thus separating compute from storage. A single dnode can contain a vnode, qnode, and mnode.

Create a Dnode

  1. CREATE DNODE {dnode_endpoint | dnode_host_name PORT port_val}

Enter the dnode_endpoint in hostname:port format. You can also specify the hostname and port as separate parameters.

Create the dnode before starting the corresponding dnode process. The dnode can then join the cluster based on the value of the firstEp parameter. Each dnode is assigned an ID after it joins a cluster.

View Dnodes

  1. SHOW DNODES;

The preceding SQL command shows all dnodes in the cluster with the ID, endpoint, and status.

Delete a DNODE

  1. DROP DNODE {dnode_id | dnode_endpoint}

You can delete a dnode by its ID or by its endpoint. Note that deleting a dnode does not stop its process. You must stop the process after the dnode is deleted.

Modify Dnode Configuration

  1. ALTER DNODE dnode_id dnode_option
  2. ALTER ALL DNODES dnode_option
  3. dnode_option: {
  4. 'resetLog'
  5. | 'balance' 'value'
  6. | 'monitor' 'value'
  7. | 'debugFlag' 'value'
  8. | 'monDebugFlag' 'value'
  9. | 'vDebugFlag' 'value'
  10. | 'mDebugFlag' 'value'
  11. | 'cDebugFlag' 'value'
  12. | 'httpDebugFlag' 'value'
  13. | 'qDebugflag' 'value'
  14. | 'sdbDebugFlag' 'value'
  15. | 'uDebugFlag' 'value'
  16. | 'tsdbDebugFlag' 'value'
  17. | 'sDebugflag' 'value'
  18. | 'rpcDebugFlag' 'value'
  19. | 'dDebugFlag' 'value'
  20. | 'mqttDebugFlag' 'value'
  21. | 'wDebugFlag' 'value'
  22. | 'tmrDebugFlag' 'value'
  23. | 'cqDebugFlag' 'value'
  24. }

The parameters that you can modify through this statement are the same as those located in the dnode configuration file. Modifications that you make through this statement take effect immediately, while modifications to the configuration file take effect when the dnode restarts.

value is the value of the parameter, which needs to be in character format. For example, modify the log output level of dnode 1 to debug:

  1. ALTER DNODE 1 'debugFlag' '143';

Add an Mnode

  1. CREATE MNODE ON DNODE dnode_id

TDengine automatically creates an mnode on the firstEp node. You can use this statement to create more mnodes for higher system availability. A cluster can have a maximum of three mnodes. Each dnode can contain only one mnode.

View Mnodes

  1. SHOW MNODES;

This statement shows all mnodes in the cluster with the ID, dnode, and status.

Delete an Mnode

  1. DROP MNODE ON DNODE dnode_id;

This statement deletes the mnode located on the specified dnode.

Create a Qnode

  1. CREATE QNODE ON DNODE dnode_id;

TDengine does not automatically create qnodes on startup. You can create qnodes as necessary for compute/storage separation. Each dnode can contain only one qnode. If a qnode is created on a dnode whose supportVnodes parameter is not 0, a vnode and qnode may coexist on the dnode. Each dnode can have a maximum of one vnode, one qnode, and one mnode. However, you can configure your cluster so that vnodes, qnodes, and mnodes are located on separate dnodes. If you set supportVnodes to 0 for a dnode, you can then decide whether to deploy an mnode or a qnode on it. In this way you can physically separate virtual node types.

View Qnodes

  1. SHOW QNODES;

This statement shows all qnodes in the cluster with the ID and dnode.

Delete a Qnode

  1. DROP QNODE ON DNODE dnode_id;

This statement deletes the mnode located on the specified dnode. This does not affect the status of the dnode.

Modify Client Configuration

The client configuration can also be modified in a similar way to other cluster components.

  1. ALTER LOCAL local_option
  2. local_option: {
  3. 'resetLog'
  4. | 'rpcDebugFlag' 'value'
  5. | 'tmrDebugFlag' 'value'
  6. | 'cDebugFlag' 'value'
  7. | 'uDebugFlag' 'value'
  8. | 'debugFlag' 'value'
  9. }

The parameters that you can modify through this statement are the same as those located in the client configuration file. Modifications that you make through this statement take effect immediately, while modifications to the configuration file take effect when the client restarts.

View Client Configuration

  1. SHOW LOCAL VARIABLES;