system.zookeeper

The table does not exist if ZooKeeper is not configured. Allows reading data from the ZooKeeper cluster defined in the config.
The query must either have a ‘path =’ condition or a path IN condition set with the WHERE clause as shown below. This corresponds to the path of the children in ZooKeeper that you want to get data for.

The query SELECT * FROM system.zookeeper WHERE path = '/clickhouse' outputs data for all children on the /clickhouse node.
To output data for all root nodes, write path = ‘/’.
If the path specified in ‘path’ doesn’t exist, an exception will be thrown.

The query SELECT * FROM system.zookeeper WHERE path IN ('/', '/clickhouse') outputs data for all children on the / and /clickhouse node.
If in the specified ‘path’ collection has doesn’t exist path, an exception will be thrown.
It can be used to do a batch of ZooKeeper path queries.

Columns:

  • name (String) — The name of the node.
  • path (String) — The path to the node.
  • value (String) — Node value.
  • dataLength (Int32) — Size of the value.
  • numChildren (Int32) — Number of descendants.
  • czxid (Int64) — ID of the transaction that created the node.
  • mzxid (Int64) — ID of the transaction that last changed the node.
  • pzxid (Int64) — ID of the transaction that last deleted or added descendants.
  • ctime (DateTime) — Time of node creation.
  • mtime (DateTime) — Time of the last modification of the node.
  • version (Int32) — Node version: the number of times the node was changed.
  • cversion (Int32) — Number of added or removed descendants.
  • aversion (Int32) — Number of changes to the ACL.
  • ephemeralOwner (Int64) — For ephemeral nodes, the ID of the session that owns this node.

Example:

  1. SELECT *
  2. FROM system.zookeeper
  3. WHERE path = '/clickhouse/tables/01-08/visits/replicas'
  4. FORMAT Vertical
  1. Row 1:
  2. ──────
  3. name: example01-08-1.yandex.ru
  4. value:
  5. czxid: 932998691229
  6. mzxid: 932998691229
  7. ctime: 2015-03-27 16:49:51
  8. mtime: 2015-03-27 16:49:51
  9. version: 0
  10. cversion: 47
  11. aversion: 0
  12. ephemeralOwner: 0
  13. dataLength: 0
  14. numChildren: 7
  15. pzxid: 987021031383
  16. path: /clickhouse/tables/01-08/visits/replicas
  17. Row 2:
  18. ──────
  19. name: example01-08-2.yandex.ru
  20. value:
  21. czxid: 933002738135
  22. mzxid: 933002738135
  23. ctime: 2015-03-27 16:57:01
  24. mtime: 2015-03-27 16:57:01
  25. version: 0
  26. cversion: 37
  27. aversion: 0
  28. ephemeralOwner: 0
  29. dataLength: 0
  30. numChildren: 7
  31. pzxid: 987021252247
  32. path: /clickhouse/tables/01-08/visits/replicas

Original article