2023-06-02 18:36:44 +00:00
|
|
|
---
|
|
|
|
slug: /en/operations/utilities/clickhouse-keeper-client
|
|
|
|
sidebar_label: clickhouse-keeper-client
|
|
|
|
---
|
|
|
|
|
|
|
|
# clickhouse-keeper-client
|
|
|
|
|
|
|
|
A client application to interact with clickhouse-keeper by its native protocol.
|
|
|
|
|
|
|
|
## Keys {#clickhouse-keeper-client}
|
|
|
|
|
|
|
|
- `-q QUERY`, `--query=QUERY` — Query to execute. If this parameter is not passed, `clickhouse-keeper-client` will start in interactive mode.
|
|
|
|
- `-h HOST`, `--host=HOST` — Server host. Default value: `localhost`.
|
2023-08-03 16:29:31 +00:00
|
|
|
- `-p N`, `--port=N` — Server port. Default value: 9181
|
2023-11-11 07:37:49 +00:00
|
|
|
- `-c FILE_PATH`, `--config-file=FILE_PATH` — Set path of config file to get the connection string. Default value: `config.xml`.
|
2023-06-02 18:36:44 +00:00
|
|
|
- `--connection-timeout=TIMEOUT` — Set connection timeout in seconds. Default value: 10s.
|
|
|
|
- `--session-timeout=TIMEOUT` — Set session timeout in seconds. Default value: 10s.
|
|
|
|
- `--operation-timeout=TIMEOUT` — Set operation timeout in seconds. Default value: 10s.
|
|
|
|
- `--history-file=FILE_PATH` — Set path of history file. Default value: `~/.keeper-client-history`.
|
2023-09-07 00:36:39 +00:00
|
|
|
- `--log-level=LEVEL` — Set log level. Default value: `information`.
|
|
|
|
- `--no-confirmation` — If set, will not require a confirmation on several commands. Default value `false` for interactive and `true` for query
|
2023-06-02 18:36:44 +00:00
|
|
|
- `--help` — Shows the help message.
|
|
|
|
|
|
|
|
## Example {#clickhouse-keeper-client-example}
|
|
|
|
|
|
|
|
```bash
|
2024-01-03 07:38:55 +00:00
|
|
|
./clickhouse-keeper-client -h localhost -p 9181 --connection-timeout 30 --session-timeout 30 --operation-timeout 30
|
2023-08-03 16:29:31 +00:00
|
|
|
Connected to ZooKeeper at [::1]:9181 with session_id 137
|
2023-06-02 18:36:44 +00:00
|
|
|
/ :) ls
|
|
|
|
keeper foo bar
|
2024-08-07 10:44:31 +00:00
|
|
|
/ :) cd 'keeper'
|
2023-06-02 18:36:44 +00:00
|
|
|
/keeper :) ls
|
|
|
|
api_version
|
2024-08-07 10:44:31 +00:00
|
|
|
/keeper :) cd 'api_version'
|
2023-06-02 18:36:44 +00:00
|
|
|
/keeper/api_version :) ls
|
|
|
|
|
2024-08-07 10:44:31 +00:00
|
|
|
/keeper/api_version :) cd 'xyz'
|
2024-05-17 08:23:32 +00:00
|
|
|
Path /keeper/api_version/xyz does not exist
|
2023-06-02 18:36:44 +00:00
|
|
|
/keeper/api_version :) cd ../../
|
|
|
|
/ :) ls
|
|
|
|
keeper foo bar
|
2024-08-07 10:44:31 +00:00
|
|
|
/ :) get 'keeper/api_version'
|
2023-06-02 18:36:44 +00:00
|
|
|
2
|
|
|
|
```
|
|
|
|
|
|
|
|
## Commands {#clickhouse-keeper-client-commands}
|
|
|
|
|
2024-08-07 10:44:31 +00:00
|
|
|
- `ls '[path]'` -- Lists the nodes for the given path (default: cwd)
|
|
|
|
- `cd '[path]'` -- Changes the working path (default `.`)
|
2024-09-06 16:20:30 +00:00
|
|
|
- `cp '<src>' '<dest>'` -- Copies 'src' node to 'dest' path
|
|
|
|
- `mv '<src>' '<dest>'` -- Moves 'src' node to the 'dest' path
|
2024-08-07 10:44:31 +00:00
|
|
|
- `exists '<path>'` -- Returns `1` if node exists, `0` otherwise
|
|
|
|
- `set '<path>' <value> [version]` -- Updates the node's value. Only updates if version matches (default: -1)
|
|
|
|
- `create '<path>' <value> [mode]` -- Creates new node with the set value
|
|
|
|
- `touch '<path>'` -- Creates new node with an empty string as value. Doesn't throw an exception if the node already exists
|
|
|
|
- `get '<path>'` -- Returns the node's value
|
|
|
|
- `rm '<path>' [version]` -- Removes the node only if version matches (default: -1)
|
|
|
|
- `rmr '<path>'` -- Recursively deletes path. Confirmation required
|
2023-06-02 18:36:44 +00:00
|
|
|
- `flwc <command>` -- Executes four-letter-word command
|
|
|
|
- `help` -- Prints this message
|
2024-08-07 10:44:31 +00:00
|
|
|
- `get_direct_children_number '[path]'` -- Get numbers of direct children nodes under a specific path
|
|
|
|
- `get_all_children_number '[path]'` -- Get all numbers of children nodes under a specific path
|
|
|
|
- `get_stat '[path]'` -- Returns the node's stat (default `.`)
|
|
|
|
- `find_super_nodes <threshold> '[path]'` -- Finds nodes with number of children larger than some threshold for the given path (default `.`)
|
2023-08-07 16:08:31 +00:00
|
|
|
- `delete_stale_backups` -- Deletes ClickHouse nodes used for backups that are now inactive
|
2023-07-26 05:57:16 +00:00
|
|
|
- `find_big_family [path] [n]` -- Returns the top n nodes with the biggest family in the subtree (default path = `.` and n = 10)
|
2024-08-07 10:44:31 +00:00
|
|
|
- `sync '<path>'` -- Synchronizes node between processes and leader
|
2023-09-07 01:56:14 +00:00
|
|
|
- `reconfig <add|remove|set> "<arg>" [version]` -- Reconfigure Keeper cluster. See https://clickhouse.com/docs/en/guides/sre/keeper/clickhouse-keeper#reconfiguration
|