ClickHouse/docs/en/operations/system-tables/zookeeper_connection.md
mateng915 5237dd0245
New system table zookeeper connection (#45245)
* Feature: Support new system table to show which zookeeper node be connected

Description:
============
Currently we have no place to check which zk node be connected otherwise using
lsof command. It not convenient

Solution:
=========
Implemented a new system table, system.zookeeper_host when CK Server has zk
this table will show the zk node dir which connected by current CK server

Noted: This table can support multi-zookeeper cluster scenario.

* fixed review comments

* added test case

* update test cases

* remove unused code

* fixed review comments and removed unused code

* updated test cases for print host, port and is_expired

* modify the code comments

* fixed CI Failed

* fixed code style check failure

* updated test cases by added Tags

* update test reference

* update test cases

* added system.zookeeper_connection doc

* Update docs/en/operations/system-tables/zookeeper_connection.md

* Update docs/en/operations/system-tables/zookeeper_connection.md

* Update docs/en/operations/system-tables/zookeeper_connection.md

---------

Co-authored-by: Alexander Tokmakov <tavplubix@gmail.com>
2023-05-19 17:06:43 +03:00

2.1 KiB

slug
/en/operations/system-tables/zookeeper_connection

#zookeeper_connection

This table does not exist if ZooKeeper is not configured. The 'system.zookeeper_connection' table shows current connections to ZooKeeper (including auxiliary ZooKeepers). Each row shows information about one connection.

Columns:

  • name (String) — ZooKeeper cluster's name.
  • host (String) — The hostname/IP of the ZooKeeper node that ClickHouse connected to.
  • port (String) — The port of the ZooKeeper node that ClickHouse connected to.
  • index (UInt8) — The index of the ZooKeeper node that ClickHouse connected to. The index is from ZooKeeper config.
  • connected_time (String) — When the connection was established
  • is_expired (UInt8) — Is the current connection expired.
  • keeper_api_version (String) — Keeper API version.
  • client_id (UInt64) — Session id of the connection.

Example:

SELECT * FROM system.zookeeper_connection;
┌─name──────────────┬─host─────────┬─port─┬─index─┬──────connected_time─┬─is_expired─┬─keeper_api_version─┬──────────client_id─┐
│ default_zookeeper │ 127.0.0.1    │ 2181 │     0 │ 2023-05-19 14:30:16 │          0 │                  0 │ 216349144108826660 │
└───────────────────┴──────────────┴──────┴───────┴─────────────────────┴────────────┴────────────────────┴────────────────────┘