Cluster Information Query Command

Show Variables

Currently, IoTDB supports showing key parameters of the cluster:

  1. SHOW VARIABLES

Eg:

  1. IoTDB> show variables
  2. +----------------------------------+-----------------------------------------------------------------+
  3. | Variables| Value|
  4. +----------------------------------+-----------------------------------------------------------------+
  5. | ClusterName| defaultCluster|
  6. | DataReplicationFactor| 1|
  7. | SchemaReplicationFactor| 1|
  8. | DataRegionConsensusProtocolClass| org.apache.iotdb.consensus.iot.IoTConsensus|
  9. |SchemaRegionConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus|
  10. | ConfigNodeConsensusProtocolClass| org.apache.iotdb.consensus.ratis.RatisConsensus|
  11. | TimePartitionInterval| 604800000|
  12. | DefaultTTL(ms)| 9223372036854775807|
  13. | ReadConsistencyLevel| strong|
  14. | SchemaRegionPerDataNode| 1.0|
  15. | DataRegionPerDataNode| 5.0|
  16. | LeastDataRegionGroupNum| 5|
  17. | SeriesSlotNum| 10000|
  18. | SeriesSlotExecutorClass|org.apache.iotdb.commons.partition.executor.hash.BKDRHashExecutor|
  19. | DiskSpaceWarningThreshold| 0.05|
  20. +----------------------------------+-----------------------------------------------------------------+
  21. Total line number = 15
  22. It costs 0.225s

Notice: Ensure that all key parameters displayed in this SQL are consist on each node in the same cluster

Show ConfigNode information

Currently, IoTDB supports showing ConfigNode information by the following SQL:

  1. SHOW CONFIGNODES

Eg:

  1. IoTDB> show confignodes
  2. +------+-------+---------------+------------+--------+
  3. |NodeID| Status|InternalAddress|InternalPort| Role|
  4. +------+-------+---------------+------------+--------+
  5. | 0|Running| 127.0.0.1| 10710| Leader|
  6. | 1|Running| 127.0.0.1| 10711|Follower|
  7. | 2|Running| 127.0.0.1| 10712|Follower|
  8. +------+-------+---------------+------------+--------+
  9. Total line number = 3
  10. It costs 0.030s

ConfigNode status definition

The ConfigNode statuses are defined as follows:

  • Running: The ConfigNode is running properly.
  • Unknown: The ConfigNode doesn’t report heartbeat properly.
    • Can’t receive data synchronized from other ConfigNodes
    • Won’t be selected as the cluster ConfigNode-leader

Show DataNode information

Currently, IoTDB supports showing DataNode information by the following SQL:

  1. SHOW DATANODES

Eg:

  1. IoTDB> create timeseries root.sg.d1.s1 with datatype=BOOLEAN,encoding=PLAIN
  2. Msg: The statement is executed successfully.
  3. IoTDB> create timeseries root.sg.d2.s1 with datatype=BOOLEAN,encoding=PLAIN
  4. Msg: The statement is executed successfully.
  5. IoTDB> create timeseries root.ln.d1.s1 with datatype=BOOLEAN,encoding=PLAIN
  6. Msg: The statement is executed successfully.
  7. IoTDB> show datanodes
  8. +------+-------+----------+-------+-------------+---------------+
  9. |NodeID| Status|RpcAddress|RpcPort|DataRegionNum|SchemaRegionNum|
  10. +------+-------+----------+-------+-------------+---------------+
  11. | 1|Running| 127.0.0.1| 6667| 0| 1|
  12. | 2|Running| 127.0.0.1| 6668| 0| 1|
  13. +------+-------+----------+-------+-------------+---------------+
  14. Total line number = 2
  15. It costs 0.007s
  16. IoTDB> insert into root.ln.d1(timestamp,s1) values(1,true)
  17. Msg: The statement is executed successfully.
  18. IoTDB> show datanodes
  19. +------+-------+----------+-------+-------------+---------------+
  20. |NodeID| Status|RpcAddress|RpcPort|DataRegionNum|SchemaRegionNum|
  21. +------+-------+----------+-------+-------------+---------------+
  22. | 1|Running| 127.0.0.1| 6667| 1| 1|
  23. | 2|Running| 127.0.0.1| 6668| 0| 1|
  24. +------+-------+----------+-------+-------------+---------------+
  25. Total line number = 2
  26. It costs 0.006s

DataNode status definition

The state machine of DataNode is shown in the figure below: Cluster Maintenance - 图1

The DataNode statuses are defined as follows:

  • Running: The DataNode is running properly and is readable and writable.
  • Unknown: The DataNode doesn’t report heartbeat properly, the ConfigNode considers the DataNode as unreadable and un-writable.
    • The cluster is still readable and writable if some DataNodes are Unknown
  • Removing: The DataNode is being removed from the cluster and is unreadable and un-writable.
    • The cluster is still readable and writable if some DataNodes are Removing
  • ReadOnly: The remaining disk space of DataNode is lower than disk_warning_threshold(default is 5%), the DataNode is readable but un-writable and cannot synchronize data.
    • The cluster is still readable and writable if some DataNodes are ReadOnly
    • The schema and data in a ReadOnly DataNode is readable
    • The schema and data in a ReadOnly DataNode is deletable
    • A ReadOnly DataNode is creatable for schema, but un-writable for data
    • Data cannot be written to the cluster when all DataNodes are ReadOnly, but new Databases and schema is still creatable

For a DataNode, the following table describes the impact of schema read, write, and deletion in different status:

DataNode statusreadablecreatabledeletable
Runningyesyesyes
Unknownnonono
Removingnonono
ReadOnlyyesyesyes

For a DataNode, the following table describes the impact of data read, write, and deletion in different status:

DataNode statusreadablewritabledeletable
Runningyesyesyes
Unknownnonono
Removingnonono
ReadOnlyyesnoyes

Show all Node information

Currently, IoTDB supports show the information of all Nodes by the following SQL:

  1. SHOW CLUSTER

Eg:

  1. IoTDB> show cluster
  2. +------+----------+-------+---------------+------------+
  3. |NodeID| NodeType| Status|InternalAddress|InternalPort|
  4. +------+----------+-------+---------------+------------+
  5. | 0|ConfigNode|Running| 127.0.0.1| 10710|
  6. | 1|ConfigNode|Running| 127.0.0.1| 10711|
  7. | 2|ConfigNode|Running| 127.0.0.1| 10712|
  8. | 3| DataNode|Running| 127.0.0.1| 10730|
  9. | 4| DataNode|Running| 127.0.0.1| 10731|
  10. | 5| DataNode|Running| 127.0.0.1| 10732|
  11. +------+----------+-------+---------------+------------+
  12. Total line number = 6
  13. It costs 0.011s

After a node is stopped, its status will change, as shown below:

  1. IoTDB> show cluster
  2. +------+----------+-------+---------------+------------+
  3. |NodeID| NodeType| Status|InternalAddress|InternalPort|
  4. +------+----------+-------+---------------+------------+
  5. | 0|ConfigNode|Running| 127.0.0.1| 10710|
  6. | 1|ConfigNode|Unknown| 127.0.0.1| 10711|
  7. | 2|ConfigNode|Running| 127.0.0.1| 10712|
  8. | 3| DataNode|Running| 127.0.0.1| 10730|
  9. | 4| DataNode|Running| 127.0.0.1| 10731|
  10. | 5| DataNode|Running| 127.0.0.1| 10732|
  11. +------+----------+-------+---------------+------------+
  12. Total line number = 6
  13. It costs 0.012s

Show the details of all nodes:

  1. SHOW CLUSTER DETAILS

Eg:

  1. IoTDB> show cluster details
  2. +------+----------+-------+---------------+------------+-------------------+----------+-------+-------+-------------------+-----------------+
  3. |NodeID| NodeType| Status|InternalAddress|InternalPort|ConfigConsensusPort|RpcAddress|RpcPort|MppPort|SchemaConsensusPort|DataConsensusPort|
  4. +------+----------+-------+---------------+------------+-------------------+----------+-------+-------+-------------------+-----------------+
  5. | 0|ConfigNode|Running| 127.0.0.1| 10710| 10720| | | | | |
  6. | 1|ConfigNode|Running| 127.0.0.1| 10711| 10721| | | | | |
  7. | 2|ConfigNode|Running| 127.0.0.1| 10712| 10722| | | | | |
  8. | 3| DataNode|Running| 127.0.0.1| 10730| | 127.0.0.1| 6667| 10740| 10750| 10760|
  9. | 4| DataNode|Running| 127.0.0.1| 10731| | 127.0.0.1| 6668| 10741| 10751| 10761|
  10. | 5| DataNode|Running| 127.0.0.1| 10732| | 127.0.0.1| 6669| 10742| 10752| 10762|
  11. +------+----------+-------+---------------+------------+-------------------+----------+-------+-------+-------------------+-----------------+
  12. Total line number = 6
  13. It costs 0.340s

Show Region information

The cluster uses a SchemaRegion/DataRegion as a unit for schema/data replication and data management. The Region status and distribution is helpful for system operation and maintenance testing, as shown in the following scenarios:

  • Check which DataNodes are allocated to each Region in the cluster and whether they are balanced.
  • Check the partitions allocated to each Region in the cluster and whether they are balanced.
  • Check which DataNodes are allocated by the leaders of each RegionGroup in the cluster and whether they are balanced.

Currently, IoTDB supports show Region information by the following SQL:

  • SHOW REGIONS: Show distribution of all Regions.
  • SHOW SCHEMA REGIONS: Show distribution of all SchemaRegions.
  • SHOW DATA REGIONS: Show distribution of all DataRegions.
  • SHOW (DATA|SCHEMA)? REGIONS OF DATABASE <sg1,sg2,...>: Show Region distribution of specified StorageGroups.
  • SHOW (DATA|SCHEMA)? REGIONS ON NODEID <id1,id2,...>: Show Region distribution on specified Nodes.
  • SHOW (DATA|SCHEMA)? REGIONS (OF DATABASE <sg1,sg2,...>)? (ON NODEID <id1,id2,...>)?: Show Region distribution of specified StorageGroups on specified Nodes.

Show distribution of all Regions:

  1. IoTDB> show regions
  2. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  3. |RegionId| Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort| Role| CreateTime|
  4. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  5. | 0| DataRegion|Running|root.sg1| 1| 1| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.520|
  6. | 0| DataRegion|Running|root.sg1| 1| 1| 2| 127.0.0.1| 6668| Leader|2023-03-07T17:32:18.749|
  7. | 0| DataRegion|Running|root.sg1| 1| 1| 3| 127.0.0.1| 6669|Follower|2023-03-07T17:32:19.013|
  8. | 1|SchemaRegion|Running|root.sg1| 1| 0| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.111|
  9. | 1|SchemaRegion|Running|root.sg1| 1| 0| 2| 127.0.0.1| 6668|Follower|2023-03-07T17:32:18.245|
  10. | 1|SchemaRegion|Running|root.sg1| 1| 0| 3| 127.0.0.1| 6669| Leader|2023-03-07T17:32:18.398|
  11. | 2| DataRegion|Running|root.sg2| 1| 1| 1| 127.0.0.1| 6667| Leader|2023-03-07T17:32:19.834|
  12. | 2| DataRegion|Running|root.sg2| 1| 1| 2| 127.0.0.1| 6668|Follower|2023-03-07T17:32:20.011|
  13. | 2| DataRegion|Running|root.sg2| 1| 1| 3| 127.0.0.1| 6669|Follower|2023-03-07T17:32:20.395|
  14. | 3|SchemaRegion|Running|root.sg2| 1| 0| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:19.232|
  15. | 3|SchemaRegion|Running|root.sg2| 1| 0| 2| 127.0.0.1| 6668| Leader|2023-03-07T17:32:19.450|
  16. | 3|SchemaRegion|Running|root.sg2| 1| 0| 3| 127.0.0.1| 6669|Follower|2023-03-07T17:32:19.637|
  17. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  18. Total line number = 12
  19. It costs 0.165s

The SeriesSlotNum refers to the number of the seriesSlots in the region. In the same light, the TimeSlotNum means the number of the timeSlots in the region.

Show the distribution of SchemaRegions or DataRegions:

  1. IoTDB> show data regions
  2. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  3. |RegionId| Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort| Role| CreateTime|
  4. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  5. | 0| DataRegion|Running|root.sg1| 1| 1| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.520|
  6. | 0| DataRegion|Running|root.sg1| 1| 1| 2| 127.0.0.1| 6668| Leader|2023-03-07T17:32:18.749|
  7. | 0| DataRegion|Running|root.sg1| 1| 1| 3| 127.0.0.1| 6669|Follower|2023-03-07T17:32:19.013|
  8. | 2| DataRegion|Running|root.sg2| 1| 1| 1| 127.0.0.1| 6667| Leader|2023-03-07T17:32:19.834|
  9. | 2| DataRegion|Running|root.sg2| 1| 1| 2| 127.0.0.1| 6668|Follower|2023-03-07T17:32:20.011|
  10. | 2| DataRegion|Running|root.sg2| 1| 1| 3| 127.0.0.1| 6669|Follower|2023-03-07T17:32:20.395|
  11. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  12. Total line number = 6
  13. It costs 0.011s
  14. IoTDB> show schema regions
  15. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  16. |RegionId| Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort| Role| CreateTime|
  17. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  18. | 1|SchemaRegion|Running|root.sg1| 1| 0| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.111|
  19. | 1|SchemaRegion|Running|root.sg1| 1| 0| 2| 127.0.0.1| 6668|Follower|2023-03-07T17:32:18.245|
  20. | 1|SchemaRegion|Running|root.sg1| 1| 0| 3| 127.0.0.1| 6669| Leader|2023-03-07T17:32:18.398|
  21. | 3|SchemaRegion|Running|root.sg2| 1| 0| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:19.232|
  22. | 3|SchemaRegion|Running|root.sg2| 1| 0| 2| 127.0.0.1| 6668| Leader|2023-03-07T17:32:19.450|
  23. | 3|SchemaRegion|Running|root.sg2| 1| 0| 3| 127.0.0.1| 6669|Follower|2023-03-07T17:32:19.637|
  24. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  25. Total line number = 6
  26. It costs 0.012s

Show Region distribution of specified DataBases:

  1. IoTDB> show regions of database root.sg1
  2. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  3. |RegionId| Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort| Role| CreateTime|
  4. +--------+------------+-------+-- -----+-------------+-----------+----------+----------+-------+--------+-----------------------+
  5. | 0| DataRegion|Running|root.sg1| 1| 1| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.520|
  6. | 0| DataRegion|Running|root.sg1| 1| 1| 2| 127.0.0.1| 6668| Leader|2023-03-07T17:32:18.749|
  7. | 0| DataRegion|Running|root.sg1| 1| 1| 3| 127.0.0.1| 6669|Follower|2023-03-07T17:32:19.013|
  8. | 1|SchemaRegion|Running|root.sg1| 1| 0| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.111|
  9. | 1|SchemaRegion|Running|root.sg1| 1| 0| 2| 127.0.0.1| 6668|Follower|2023-03-07T17:32:18.245|
  10. | 1|SchemaRegion|Running|root.sg1| 1| 0| 3| 127.0.0.1| 6669| Leader|2023-03-07T17:32:18.398|
  11. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  12. Total line number = 6
  13. It costs 0.007s
  14. IoTDB> show regions of database root.sg1, root.sg2
  15. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  16. |RegionId| Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort| Role| CreateTime|
  17. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  18. | 0| DataRegion|Running|root.sg1| 1| 1| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.520|
  19. | 0| DataRegion|Running|root.sg1| 1| 1| 2| 127.0.0.1| 6668| Leader|2023-03-07T17:32:18.749|
  20. | 0| DataRegion|Running|root.sg1| 1| 1| 3| 127.0.0.1| 6669|Follower|2023-03-07T17:32:19.013|
  21. | 1|SchemaRegion|Running|root.sg1| 1| 0| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.111|
  22. | 1|SchemaRegion|Running|root.sg1| 1| 0| 2| 127.0.0.1| 6668|Follower|2023-03-07T17:32:18.245|
  23. | 1|SchemaRegion|Running|root.sg1| 1| 0| 3| 127.0.0.1| 6669| Leader|2023-03-07T17:32:18.398|
  24. | 2| DataRegion|Running|root.sg2| 1| 1| 1| 127.0.0.1| 6667| Leader|2023-03-07T17:32:19.834|
  25. | 2| DataRegion|Running|root.sg2| 1| 1| 2| 127.0.0.1| 6668|Follower|2023-03-07T17:32:20.011|
  26. | 2| DataRegion|Running|root.sg2| 1| 1| 3| 127.0.0.1| 6669|Follower|2023-03-07T17:32:20.395|
  27. | 3|SchemaRegion|Running|root.sg2| 1| 0| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:19.232|
  28. | 3|SchemaRegion|Running|root.sg2| 1| 0| 2| 127.0.0.1| 6668| Leader|2023-03-07T17:32:19.450|
  29. | 3|SchemaRegion|Running|root.sg2| 1| 0| 3| 127.0.0.1| 6669|Follower|2023-03-07T17:32:19.637|
  30. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  31. Total line number = 12
  32. It costs 0.009s
  33. IoTDB> show data regions of database root.sg1, root.sg2
  34. +--------+----------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  35. |RegionId| Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort| Role| CreateTime|
  36. +--------+----------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  37. | 0|DataRegion|Running|root.sg1| 1| 1| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.520|
  38. | 0|DataRegion|Running|root.sg1| 1| 1| 2| 127.0.0.1| 6668| Leader|2023-03-07T17:32:18.749|
  39. | 0|DataRegion|Running|root.sg1| 1| 1| 3| 127.0.0.1| 6669|Follower|2023-03-07T17:32:19.013|
  40. | 2|DataRegion|Running|root.sg2| 1| 1| 1| 127.0.0.1| 6667| Leader|2023-03-07T17:32:19.834|
  41. | 2|DataRegion|Running|root.sg2| 1| 1| 2| 127.0.0.1| 6668|Follower|2023-03-07T17:32:20.011|
  42. | 2|DataRegion|Running|root.sg2| 1| 1| 3| 127.0.0.1| 6669|Follower|2023-03-07T17:32:20.395|
  43. +--------+----------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  44. Total line number = 6
  45. It costs 0.007s
  46. IoTDB> show schema regions of database root.sg1, root.sg2
  47. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  48. |RegionId| Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort| Role| CreateTime|
  49. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  50. | 1|SchemaRegion|Running|root.sg1| 1| 0| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.111|
  51. | 1|SchemaRegion|Running|root.sg1| 1| 0| 2| 127.0.0.1| 6668|Follower|2023-03-07T17:32:18.245|
  52. | 1|SchemaRegion|Running|root.sg1| 1| 0| 3| 127.0.0.1| 6669| Leader|2023-03-07T17:32:18.398|
  53. | 3|SchemaRegion|Running|root.sg2| 1| 0| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:19.232|
  54. | 3|SchemaRegion|Running|root.sg2| 1| 0| 2| 127.0.0.1| 6668| Leader|2023-03-07T17:32:19.450|
  55. | 3|SchemaRegion|Running|root.sg2| 1| 0| 3| 127.0.0.1| 6669|Follower|2023-03-07T17:32:19.637|
  56. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  57. Total line number = 6
  58. It costs 0.009s

Show Region distribution on specified Nodes:

  1. IoTDB> show regions on nodeid 1
  2. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  3. |RegionId| Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort| Role| CreateTime|
  4. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  5. | 0| DataRegion|Running|root.sg1| 1| 1| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.520|
  6. | 1|SchemaRegion|Running|root.sg1| 1| 0| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.111|
  7. | 2| DataRegion|Running|root.sg2| 1| 1| 1| 127.0.0.1| 6667| Leader|2023-03-07T17:32:19.834|
  8. | 3|SchemaRegion|Running|root.sg2| 1| 0| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:19.232|
  9. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  10. Total line number = 4
  11. It costs 0.165s
  12. IoTDB> show regions on nodeid 1, 2
  13. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  14. |RegionId| Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort| Role| CreateTime|
  15. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  16. | 0| DataRegion|Running|root.sg1| 1| 1| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.520|
  17. | 0| DataRegion|Running|root.sg1| 1| 1| 2| 127.0.0.1| 6668| Leader|2023-03-07T17:32:18.749|
  18. | 1|SchemaRegion|Running|root.sg1| 1| 0| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.111|
  19. | 1|SchemaRegion|Running|root.sg1| 1| 0| 2| 127.0.0.1| 6668|Follower|2023-03-07T17:32:18.245|
  20. | 2| DataRegion|Running|root.sg2| 1| 1| 1| 127.0.0.1| 6667| Leader|2023-03-07T17:32:19.834|
  21. | 2| DataRegion|Running|root.sg2| 1| 1| 2| 127.0.0.1| 6668|Follower|2023-03-07T17:32:19.011|
  22. | 3|SchemaRegion|Running|root.sg2| 1| 0| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:19.232|
  23. | 3|SchemaRegion|Running|root.sg2| 1| 0| 2| 127.0.0.1| 6668| Leader|2023-03-07T17:32:19.450|
  24. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  25. Total line number = 8
  26. It costs 0.165s

Show Region distribution of specified StorageGroups on specified Nodes:

  1. IoTDB> show regions of database root.sg1 on nodeid 1
  2. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  3. |RegionId| Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort| Role| CreateTime|
  4. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  5. | 0| DataRegion|Running|root.sg1| 1| 1| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.520|
  6. | 1|SchemaRegion|Running|root.sg1| 1| 0| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.111|
  7. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  8. Total line number = 2
  9. It costs 0.165s
  10. IoTDB> show data regions of database root.sg1, root.sg2 on nodeid 1, 2
  11. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  12. |RegionId| Type| Status|Database|SeriesSlotNum|TimeSlotNum|DataNodeId|RpcAddress|RpcPort| Role| CreateTime|
  13. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  14. | 0| DataRegion|Running|root.sg1| 1| 1| 1| 127.0.0.1| 6667|Follower|2023-03-07T17:32:18.520|
  15. | 0| DataRegion|Running|root.sg1| 1| 1| 2| 127.0.0.1| 6668| Leader|2023-03-07T17:32:18.749|
  16. | 2| DataRegion|Running|root.sg2| 1| 1| 1| 127.0.0.1| 6667| Leader|2023-03-07T17:32:19.834|
  17. | 2| DataRegion|Running|root.sg2| 1| 1| 2| 127.0.0.1| 6668|Follower|2023-03-07T17:32:19.011|
  18. +--------+------------+-------+--------+-------------+-----------+----------+----------+-------+--------+-----------------------+
  19. Total line number = 4
  20. It costs 0.165s

Region status definition

Region inherits the status of the DataNode where the Region resides. And Region states are defined as follows:

  • Running: The DataNode where the Region resides is running properly, the Region is readable and writable.
  • Unknown: The DataNode where the Region resides doesn’t report heartbeat properly, the ConfigNode considers the Region is unreadable and un-writable.
  • Removing: The DataNode where the Region resides is being removed from the cluster, the Region is unreadable and un-writable.
  • ReadOnly: The available disk space of the DataNode where the Region resides is lower than the disk_warning_threshold(5% by default). The Region is readable but un-writable and cannot synchronize data.

The status switchover of a Region doesn’t affect the belonged RegionGroup, when setting up a multi-replica cluster(i.e. the number of schema replica and data replica is greater than 1), other Running Regions of the same RegionGroup ensure the high availability of RegionGroup.

For a RegionGroup:

  • It’s readable, writable and deletable if and only if more than half of its Regions are Running
  • It’s unreadable, un-writable and un-deletable when the number of its Running Regions is less than half

Show cluster slots information

The cluster uses partitions for schema and data arrangement, the partition defined as follows:

  • SchemaPartition: SeriesSlot
  • DataPartition: <SeriesSlot, SeriesTimeSlot>

More details can be found in the Cluster-Concept document.

The cluster slots information can be shown by the following SQLs:

Show the DataRegion where a DataPartition resides in

Show the DataRegion where a DataPartition(or all DataPartitions under a same series slot) resides in:

  • SHOW DATA REGIONID OF root.sg WHERE SERIESSLOTID=s0 (AND TIMESLOTID=t0)

Specifications:

  1. The s0, t0 must be numbers.

  2. The “TimeSlotId” is short for “SeriesTimeSlotId”.

  3. The “SERIESSLOTID=s0” can be substituted by “DEVICEID=xxx.xx.xx”. Using this, the sql will calculate the seriesSlot corresponding to that deviceId.

  4. The “TIMESLOTID=t0” can be replaced by “TIMESTAMP=t1”. In this case, the sql will calculate the timeSlot the timestamp belongs to, which starts before the timeStamp and (implicitly) ends after it.

Eg:

  1. IoTDB> show data regionid of root.sg where seriesslotid=5286 and timeslotid=0
  2. +--------+
  3. |RegionId|
  4. +--------+
  5. | 1|
  6. +--------+
  7. Total line number = 1
  8. It costs 0.006s
  9. IoTDB> show data regionid of root.sg where seriesslotid=5286
  10. +--------+
  11. |RegionId|
  12. +--------+
  13. | 1|
  14. | 2|
  15. +--------+
  16. Total line number = 2
  17. It costs 0.006s

Show the SchemaRegion where a SchemaPartition resides in

Show the SchemaRegion where a SchemaPartition resides in:

  • SHOW SCHEMA REGIONID OF root.sg WHERE SERIESSLOTID=s0

As is illustrated above, the SeriesSlotID and TimeSlotID are both replaceable.

Eg:

  1. IoTDB> show schema regionid of root.sg where seriesslotid=5286
  2. +--------+
  3. |RegionId|
  4. +--------+
  5. | 0|
  6. +--------+
  7. Total line number = 1
  8. It costs 0.007s

Show the time slots of a series slot

Show the time slots under a particular series slot.

  • SHOW TIMESLOTID OF root.sg WHERE SERIESLOTID=s0 (AND STARTTIME=t1) (AND ENDTIME=t2)

Eg:

  1. IoTDB> show timeslotid of root.sg where seriesslotid=5286
  2. +----------+
  3. |TimeSlotId|
  4. +----------+
  5. | 0|
  6. | 1000|
  7. +----------+
  8. Total line number = 1
  9. It costs 0.007s

Show Database’s series slots

Show the data/schema/all series slots related to a database:

  • SHOW (DATA|SCHEMA)? SERIESSLOTID OF root.sg

Eg:

  1. IoTDB> show data seriesslotid of root.sg
  2. +------------+
  3. |SeriesSlotId|
  4. +------------+
  5. | 5286|
  6. +------------+
  7. Total line number = 1
  8. It costs 0.007s
  9. IoTDB> show schema seriesslotid of root.sg
  10. +------------+
  11. |SeriesSlotId|
  12. +------------+
  13. | 5286|
  14. +------------+
  15. Total line number = 1
  16. It costs 0.006s
  17. IoTDB> show seriesslotid of root.sg
  18. +------------+
  19. |SeriesSlotId|
  20. +------------+
  21. | 5286|
  22. +------------+
  23. Total line number = 1
  24. It costs 0.006s

Migrate Region

The following sql can be applied to manually migrate a region, for load balancing or other purposes.

  1. MIGRATE REGION <Region-id> FROM <original-DataNodeId> TO <dest-DataNodeId>

Eg:

  1. IoTDB> SHOW REGIONS
  2. +--------+------------+-------+-------------+------------+----------+----------+----------+-------+--------+
  3. |RegionId| Type| Status| Database|SeriesSlotId|TimeSlotId|DataNodeId|RpcAddress|RpcPort| Role|
  4. +--------+------------+-------+-------------+------------+----------+----------+----------+-------+--------+
  5. | 0|SchemaRegion|Running|root.test.g_0| 500| 0| 3| 127.0.0.1| 6670| Leader|
  6. | 0|SchemaRegion|Running|root.test.g_0| 500| 0| 4| 127.0.0.1| 6681|Follower|
  7. | 0|SchemaRegion|Running|root.test.g_0| 500| 0| 5| 127.0.0.1| 6668|Follower|
  8. | 1| DataRegion|Running|root.test.g_0| 183| 200| 1| 127.0.0.1| 6667|Follower|
  9. | 1| DataRegion|Running|root.test.g_0| 183| 200| 3| 127.0.0.1| 6670|Follower|
  10. | 1| DataRegion|Running|root.test.g_0| 183| 200| 7| 127.0.0.1| 6669| Leader|
  11. | 2| DataRegion|Running|root.test.g_0| 181| 200| 3| 127.0.0.1| 6670| Leader|
  12. | 2| DataRegion|Running|root.test.g_0| 181| 200| 4| 127.0.0.1| 6681|Follower|
  13. | 2| DataRegion|Running|root.test.g_0| 181| 200| 5| 127.0.0.1| 6668|Follower|
  14. | 3| DataRegion|Running|root.test.g_0| 180| 200| 1| 127.0.0.1| 6667|Follower|
  15. | 3| DataRegion|Running|root.test.g_0| 180| 200| 5| 127.0.0.1| 6668| Leader|
  16. | 3| DataRegion|Running|root.test.g_0| 180| 200| 7| 127.0.0.1| 6669|Follower|
  17. | 4| DataRegion|Running|root.test.g_0| 179| 200| 3| 127.0.0.1| 6670|Follower|
  18. | 4| DataRegion|Running|root.test.g_0| 179| 200| 4| 127.0.0.1| 6681| Leader|
  19. | 4| DataRegion|Running|root.test.g_0| 179| 200| 7| 127.0.0.1| 6669|Follower|
  20. | 5| DataRegion|Running|root.test.g_0| 179| 200| 1| 127.0.0.1| 6667| Leader|
  21. | 5| DataRegion|Running|root.test.g_0| 179| 200| 4| 127.0.0.1| 6681|Follower|
  22. | 5| DataRegion|Running|root.test.g_0| 179| 200| 5| 127.0.0.1| 6668|Follower|
  23. +--------+------------+-------+-------------+------------+----------+----------+----------+-------+--------+
  24. Total line number = 18
  25. It costs 0.161s
  26. IoTDB> MIGRATE REGION 1 FROM 3 TO 4
  27. Msg: The statement is executed successfully.
  28. IoTDB> SHOW REGIONS
  29. +--------+------------+-------+-------------+------------+----------+----------+----------+-------+--------+
  30. |RegionId| Type| Status| Database|SeriesSlotId|TimeSlotId|DataNodeId|RpcAddress|RpcPort| Role|
  31. +--------+------------+-------+-------------+------------+----------+----------+----------+-------+--------+
  32. | 0|SchemaRegion|Running|root.test.g_0| 500| 0| 3| 127.0.0.1| 6670| Leader|
  33. | 0|SchemaRegion|Running|root.test.g_0| 500| 0| 4| 127.0.0.1| 6681|Follower|
  34. | 0|SchemaRegion|Running|root.test.g_0| 500| 0| 5| 127.0.0.1| 6668|Follower|
  35. | 1| DataRegion|Running|root.test.g_0| 183| 200| 1| 127.0.0.1| 6667|Follower|
  36. | 1| DataRegion|Running|root.test.g_0| 183| 200| 4| 127.0.0.1| 6681|Follower|
  37. | 1| DataRegion|Running|root.test.g_0| 183| 200| 7| 127.0.0.1| 6669| Leader|
  38. | 2| DataRegion|Running|root.test.g_0| 181| 200| 3| 127.0.0.1| 6670| Leader|
  39. | 2| DataRegion|Running|root.test.g_0| 181| 200| 4| 127.0.0.1| 6681|Follower|
  40. | 2| DataRegion|Running|root.test.g_0| 181| 200| 5| 127.0.0.1| 6668|Follower|
  41. | 3| DataRegion|Running|root.test.g_0| 180| 200| 1| 127.0.0.1| 6667|Follower|
  42. | 3| DataRegion|Running|root.test.g_0| 180| 200| 5| 127.0.0.1| 6668| Leader|
  43. | 3| DataRegion|Running|root.test.g_0| 180| 200| 7| 127.0.0.1| 6669|Follower|
  44. | 4| DataRegion|Running|root.test.g_0| 179| 200| 3| 127.0.0.1| 6670|Follower|
  45. | 4| DataRegion|Running|root.test.g_0| 179| 200| 4| 127.0.0.1| 6681| Leader|
  46. | 4| DataRegion|Running|root.test.g_0| 179| 200| 7| 127.0.0.1| 6669|Follower|
  47. | 5| DataRegion|Running|root.test.g_0| 179| 200| 1| 127.0.0.1| 6667| Leader|
  48. | 5| DataRegion|Running|root.test.g_0| 179| 200| 4| 127.0.0.1| 6681|Follower|
  49. | 5| DataRegion|Running|root.test.g_0| 179| 200| 5| 127.0.0.1| 6668|Follower|
  50. +--------+------------+-------+-------------+------------+----------+----------+----------+-------+--------+
  51. Total line number = 18
  52. It costs 0.165s