Mention ON CLUSTER options for SYSTEM queries

This commit is contained in:
Raúl Marín 2023-06-02 16:51:04 +02:00
parent 5352a7a60e
commit dcd5579851
3 changed files with 87 additions and 55 deletions

View File

@ -119,19 +119,35 @@ The compiled expression cache is enabled/disabled with the query/user/profile-le
Resets the [query cache](../../operations/query-cache.md). Resets the [query cache](../../operations/query-cache.md).
```sql
SYSTEM DROP QUERY CACHE [ON CLUSTER cluster_name]
```
## FLUSH LOGS ## FLUSH LOGS
Flushes buffered log messages to system tables, e.g. system.query_log. Mainly useful for debugging since most system tables have a default flush interval of 7.5 seconds. Flushes buffered log messages to system tables, e.g. system.query_log. Mainly useful for debugging since most system tables have a default flush interval of 7.5 seconds.
This will also create system tables even if message queue is empty. This will also create system tables even if message queue is empty.
```sql
SYSTEM FLUSH LOGS [ON CLUSTER cluster_name]
```
## RELOAD CONFIG ## RELOAD CONFIG
Reloads ClickHouse configuration. Used when configuration is stored in ZooKeeper. Note that `SYSTEM RELOAD CONFIG` does not reload `USER` configuration stored in ZooKeeper, it only reloads `USER` configuration that is stored in `users.xml`. To reload all `USER` config use `SYSTEM RELOAD USERS` Reloads ClickHouse configuration. Used when configuration is stored in ZooKeeper. Note that `SYSTEM RELOAD CONFIG` does not reload `USER` configuration stored in ZooKeeper, it only reloads `USER` configuration that is stored in `users.xml`. To reload all `USER` config use `SYSTEM RELOAD USERS`
```sql
SYSTEM RELOAD CONFIG [ON CLUSTER cluster_name]
```
## RELOAD USERS ## RELOAD USERS
Reloads all access storages, including: users.xml, local disk access storage, replicated (in ZooKeeper) access storage. Reloads all access storages, including: users.xml, local disk access storage, replicated (in ZooKeeper) access storage.
```sql
SYSTEM RELOAD USERS [ON CLUSTER cluster_name]
```
## SHUTDOWN ## SHUTDOWN
Normally shuts down ClickHouse (like `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) Normally shuts down ClickHouse (like `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`)
@ -149,7 +165,7 @@ ClickHouse can manage [distributed](../../engines/table-engines/special/distribu
Disables background data distribution when inserting data into distributed tables. Disables background data distribution when inserting data into distributed tables.
``` sql ``` sql
SYSTEM STOP DISTRIBUTED SENDS [db.]<distributed_table_name> SYSTEM STOP DISTRIBUTED SENDS [db.]<distributed_table_name> [ON CLUSTER cluster_name]
``` ```
### FLUSH DISTRIBUTED ### FLUSH DISTRIBUTED
@ -157,7 +173,7 @@ SYSTEM STOP DISTRIBUTED SENDS [db.]<distributed_table_name>
Forces ClickHouse to send data to cluster nodes synchronously. If any nodes are unavailable, ClickHouse throws an exception and stops query execution. You can retry the query until it succeeds, which will happen when all nodes are back online. Forces ClickHouse to send data to cluster nodes synchronously. If any nodes are unavailable, ClickHouse throws an exception and stops query execution. You can retry the query until it succeeds, which will happen when all nodes are back online.
``` sql ``` sql
SYSTEM FLUSH DISTRIBUTED [db.]<distributed_table_name> SYSTEM FLUSH DISTRIBUTED [db.]<distributed_table_name> [ON CLUSTER cluster_name]
``` ```
### START DISTRIBUTED SENDS ### START DISTRIBUTED SENDS
@ -165,7 +181,7 @@ SYSTEM FLUSH DISTRIBUTED [db.]<distributed_table_name>
Enables background data distribution when inserting data into distributed tables. Enables background data distribution when inserting data into distributed tables.
``` sql ``` sql
SYSTEM START DISTRIBUTED SENDS [db.]<distributed_table_name> SYSTEM START DISTRIBUTED SENDS [db.]<distributed_table_name> [ON CLUSTER cluster_name]
``` ```
## Managing MergeTree Tables ## Managing MergeTree Tables
@ -177,7 +193,7 @@ ClickHouse can manage background processes in [MergeTree](../../engines/table-en
Provides possibility to stop background merges for tables in the MergeTree family: Provides possibility to stop background merges for tables in the MergeTree family:
``` sql ``` sql
SYSTEM STOP MERGES [ON VOLUME <volume_name> | [db.]merge_tree_family_table_name] SYSTEM STOP MERGES [ON CLUSTER cluster_name] [ON VOLUME <volume_name> | [db.]merge_tree_family_table_name]
``` ```
:::note :::note
@ -189,7 +205,7 @@ SYSTEM STOP MERGES [ON VOLUME <volume_name> | [db.]merge_tree_family_table_name]
Provides possibility to start background merges for tables in the MergeTree family: Provides possibility to start background merges for tables in the MergeTree family:
``` sql ``` sql
SYSTEM START MERGES [ON VOLUME <volume_name> | [db.]merge_tree_family_table_name] SYSTEM START MERGES [ON CLUSTER cluster_name] [ON VOLUME <volume_name> | [db.]merge_tree_family_table_name]
``` ```
### STOP TTL MERGES ### STOP TTL MERGES
@ -198,7 +214,7 @@ Provides possibility to stop background delete old data according to [TTL expres
Returns `Ok.` even if table does not exist or table has not MergeTree engine. Returns error when database does not exist: Returns `Ok.` even if table does not exist or table has not MergeTree engine. Returns error when database does not exist:
``` sql ``` sql
SYSTEM STOP TTL MERGES [[db.]merge_tree_family_table_name] SYSTEM STOP TTL MERGES [ON CLUSTER cluster_name] [[db.]merge_tree_family_table_name]
``` ```
### START TTL MERGES ### START TTL MERGES
@ -207,7 +223,7 @@ Provides possibility to start background delete old data according to [TTL expre
Returns `Ok.` even if table does not exist. Returns error when database does not exist: Returns `Ok.` even if table does not exist. Returns error when database does not exist:
``` sql ``` sql
SYSTEM START TTL MERGES [[db.]merge_tree_family_table_name] SYSTEM START TTL MERGES [ON CLUSTER cluster_name] [[db.]merge_tree_family_table_name]
``` ```
### STOP MOVES ### STOP MOVES
@ -216,7 +232,7 @@ Provides possibility to stop background move data according to [TTL table expres
Returns `Ok.` even if table does not exist. Returns error when database does not exist: Returns `Ok.` even if table does not exist. Returns error when database does not exist:
``` sql ``` sql
SYSTEM STOP MOVES [[db.]merge_tree_family_table_name] SYSTEM STOP MOVES [ON CLUSTER cluster_name] [[db.]merge_tree_family_table_name]
``` ```
### START MOVES ### START MOVES
@ -225,7 +241,7 @@ Provides possibility to start background move data according to [TTL table expre
Returns `Ok.` even if table does not exist. Returns error when database does not exist: Returns `Ok.` even if table does not exist. Returns error when database does not exist:
``` sql ``` sql
SYSTEM START MOVES [[db.]merge_tree_family_table_name] SYSTEM START MOVES [ON CLUSTER cluster_name] [[db.]merge_tree_family_table_name]
``` ```
### SYSTEM UNFREEZE {#query_language-system-unfreeze} ### SYSTEM UNFREEZE {#query_language-system-unfreeze}
@ -241,7 +257,7 @@ SYSTEM UNFREEZE WITH NAME <backup_name>
Wait until all asynchronously loading data parts of a table (outdated data parts) will became loaded. Wait until all asynchronously loading data parts of a table (outdated data parts) will became loaded.
``` sql ``` sql
SYSTEM WAIT LOADING PARTS [db.]merge_tree_family_table_name SYSTEM WAIT LOADING PARTS [ON CLUSTER cluster_name] [db.]merge_tree_family_table_name
``` ```
## Managing ReplicatedMergeTree Tables ## Managing ReplicatedMergeTree Tables
@ -254,7 +270,7 @@ Provides possibility to stop background fetches for inserted parts for tables in
Always returns `Ok.` regardless of the table engine and even if table or database does not exist. Always returns `Ok.` regardless of the table engine and even if table or database does not exist.
``` sql ``` sql
SYSTEM STOP FETCHES [[db.]replicated_merge_tree_family_table_name] SYSTEM STOP FETCHES [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### START FETCHES ### START FETCHES
@ -263,7 +279,7 @@ Provides possibility to start background fetches for inserted parts for tables i
Always returns `Ok.` regardless of the table engine and even if table or database does not exist. Always returns `Ok.` regardless of the table engine and even if table or database does not exist.
``` sql ``` sql
SYSTEM START FETCHES [[db.]replicated_merge_tree_family_table_name] SYSTEM START FETCHES [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### STOP REPLICATED SENDS ### STOP REPLICATED SENDS
@ -271,7 +287,7 @@ SYSTEM START FETCHES [[db.]replicated_merge_tree_family_table_name]
Provides possibility to stop background sends to other replicas in cluster for new inserted parts for tables in the `ReplicatedMergeTree` family: Provides possibility to stop background sends to other replicas in cluster for new inserted parts for tables in the `ReplicatedMergeTree` family:
``` sql ``` sql
SYSTEM STOP REPLICATED SENDS [[db.]replicated_merge_tree_family_table_name] SYSTEM STOP REPLICATED SENDS [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### START REPLICATED SENDS ### START REPLICATED SENDS
@ -279,7 +295,7 @@ SYSTEM STOP REPLICATED SENDS [[db.]replicated_merge_tree_family_table_name]
Provides possibility to start background sends to other replicas in cluster for new inserted parts for tables in the `ReplicatedMergeTree` family: Provides possibility to start background sends to other replicas in cluster for new inserted parts for tables in the `ReplicatedMergeTree` family:
``` sql ``` sql
SYSTEM START REPLICATED SENDS [[db.]replicated_merge_tree_family_table_name] SYSTEM START REPLICATED SENDS [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### STOP REPLICATION QUEUES ### STOP REPLICATION QUEUES
@ -287,7 +303,7 @@ SYSTEM START REPLICATED SENDS [[db.]replicated_merge_tree_family_table_name]
Provides possibility to stop background fetch tasks from replication queues which stored in Zookeeper for tables in the `ReplicatedMergeTree` family. Possible background tasks types - merges, fetches, mutation, DDL statements with ON CLUSTER clause: Provides possibility to stop background fetch tasks from replication queues which stored in Zookeeper for tables in the `ReplicatedMergeTree` family. Possible background tasks types - merges, fetches, mutation, DDL statements with ON CLUSTER clause:
``` sql ``` sql
SYSTEM STOP REPLICATION QUEUES [[db.]replicated_merge_tree_family_table_name] SYSTEM STOP REPLICATION QUEUES [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### START REPLICATION QUEUES ### START REPLICATION QUEUES
@ -295,7 +311,7 @@ SYSTEM STOP REPLICATION QUEUES [[db.]replicated_merge_tree_family_table_name]
Provides possibility to start background fetch tasks from replication queues which stored in Zookeeper for tables in the `ReplicatedMergeTree` family. Possible background tasks types - merges, fetches, mutation, DDL statements with ON CLUSTER clause: Provides possibility to start background fetch tasks from replication queues which stored in Zookeeper for tables in the `ReplicatedMergeTree` family. Possible background tasks types - merges, fetches, mutation, DDL statements with ON CLUSTER clause:
``` sql ``` sql
SYSTEM START REPLICATION QUEUES [[db.]replicated_merge_tree_family_table_name] SYSTEM START REPLICATION QUEUES [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### SYNC REPLICA ### SYNC REPLICA
@ -318,7 +334,7 @@ Provides possibility to reinitialize Zookeeper session's state for `ReplicatedMe
Initialization of replication queue based on ZooKeeper data happens in the same way as for `ATTACH TABLE` statement. For a short time, the table will be unavailable for any operations. Initialization of replication queue based on ZooKeeper data happens in the same way as for `ATTACH TABLE` statement. For a short time, the table will be unavailable for any operations.
``` sql ``` sql
SYSTEM RESTART REPLICA [db.]replicated_merge_tree_family_table_name SYSTEM RESTART REPLICA [ON CLUSTER cluster_name] [db.]replicated_merge_tree_family_table_name
``` ```
### RESTORE REPLICA ### RESTORE REPLICA
@ -384,7 +400,7 @@ Provides possibility to reinitialize Zookeeper sessions state for all `Replicate
Allows to drop filesystem cache. Allows to drop filesystem cache.
```sql ```sql
SYSTEM DROP FILESYSTEM CACHE SYSTEM DROP FILESYSTEM CACHE [ON CLUSTER cluster_name]
``` ```
### SYNC FILE CACHE ### SYNC FILE CACHE
@ -396,5 +412,5 @@ It's too heavy and has potential for misuse.
Will do sync syscall. Will do sync syscall.
```sql ```sql
SYSTEM SYNC FILE CACHE SYSTEM SYNC FILE CACHE [ON CLUSTER cluster_name]
``` ```

View File

@ -39,7 +39,7 @@ SELECT name, status FROM system.dictionaries;
**Синтаксис** **Синтаксис**
```sql ```sql
SYSTEM RELOAD MODELS SYSTEM RELOAD MODELS [ON CLUSTER cluster_name]
``` ```
## RELOAD MODEL {#query_language-system-reload-model} ## RELOAD MODEL {#query_language-system-reload-model}
@ -49,7 +49,7 @@ SYSTEM RELOAD MODELS
**Синтаксис** **Синтаксис**
```sql ```sql
SYSTEM RELOAD MODEL <model_path> SYSTEM RELOAD MODEL [ON CLUSTER cluster_name] <model_path>
``` ```
## RELOAD FUNCTIONS {#query_language-system-reload-functions} ## RELOAD FUNCTIONS {#query_language-system-reload-functions}
@ -59,8 +59,8 @@ SYSTEM RELOAD MODEL <model_path>
**Синтаксис** **Синтаксис**
```sql ```sql
RELOAD FUNCTIONS RELOAD FUNCTIONS [ON CLUSTER cluster_name]
RELOAD FUNCTION function_name RELOAD FUNCTION function_name [ON CLUSTER cluster_name]
``` ```
## DROP DNS CACHE {#query_language-system-drop-dns-cache} ## DROP DNS CACHE {#query_language-system-drop-dns-cache}
@ -106,10 +106,18 @@ Cкомпилированные выражения используются ко
Записывает буферы логов в системные таблицы (например system.query_log). Позволяет не ждать 7.5 секунд при отладке. Записывает буферы логов в системные таблицы (например system.query_log). Позволяет не ждать 7.5 секунд при отладке.
Если буфер логов пустой, то этот запрос просто создаст системные таблицы. Если буфер логов пустой, то этот запрос просто создаст системные таблицы.
```sql
SYSTEM FLUSH LOGS [ON CLUSTER cluster_name]
```
## RELOAD CONFIG {#query_language-system-reload-config} ## RELOAD CONFIG {#query_language-system-reload-config}
Перечитывает конфигурацию настроек ClickHouse. Используется при хранении конфигурации в zookeeper. Перечитывает конфигурацию настроек ClickHouse. Используется при хранении конфигурации в zookeeper.
```sql
SYSTEM RELOAD CONFIG [ON CLUSTER cluster_name]
```
## SHUTDOWN {#query_language-system-shutdown} ## SHUTDOWN {#query_language-system-shutdown}
Штатно завершает работу ClickHouse (аналог `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`) Штатно завершает работу ClickHouse (аналог `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`)
@ -127,7 +135,7 @@ ClickHouse может оперировать [распределёнными](..
Отключает фоновую отправку при вставке данных в распределённые таблицы. Отключает фоновую отправку при вставке данных в распределённые таблицы.
``` sql ``` sql
SYSTEM STOP DISTRIBUTED SENDS [db.]<distributed_table_name> SYSTEM STOP DISTRIBUTED SENDS [db.]<distributed_table_name> [ON CLUSTER cluster_name]
``` ```
### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} ### FLUSH DISTRIBUTED {#query_language-system-flush-distributed}
@ -135,7 +143,7 @@ SYSTEM STOP DISTRIBUTED SENDS [db.]<distributed_table_name>
В синхронном режиме отправляет все данные на узлы кластера. Если какие-либо узлы недоступны, ClickHouse генерирует исключение и останавливает выполнение запроса. Такой запрос можно повторять до успешного завершения, что будет означать возвращение связанности с остальными узлами кластера. В синхронном режиме отправляет все данные на узлы кластера. Если какие-либо узлы недоступны, ClickHouse генерирует исключение и останавливает выполнение запроса. Такой запрос можно повторять до успешного завершения, что будет означать возвращение связанности с остальными узлами кластера.
``` sql ``` sql
SYSTEM FLUSH DISTRIBUTED [db.]<distributed_table_name> SYSTEM FLUSH DISTRIBUTED [db.]<distributed_table_name> [ON CLUSTER cluster_name]
``` ```
### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} ### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends}
@ -143,7 +151,7 @@ SYSTEM FLUSH DISTRIBUTED [db.]<distributed_table_name>
Включает фоновую отправку при вставке данных в распределенные таблицы. Включает фоновую отправку при вставке данных в распределенные таблицы.
``` sql ``` sql
SYSTEM START DISTRIBUTED SENDS [db.]<distributed_table_name> SYSTEM START DISTRIBUTED SENDS [db.]<distributed_table_name> [ON CLUSTER cluster_name]
``` ```
## Managing MergeTree Tables {#query-language-system-mergetree} ## Managing MergeTree Tables {#query-language-system-mergetree}
@ -155,7 +163,7 @@ ClickHouse может управлять фоновыми процессами
Позволяет остановить фоновые мержи для таблиц семейства MergeTree: Позволяет остановить фоновые мержи для таблиц семейства MergeTree:
``` sql ``` sql
SYSTEM STOP MERGES [ON VOLUME <volume_name> | [db.]merge_tree_family_table_name] SYSTEM STOP MERGES [ON CLUSTER cluster_name] [ON VOLUME <volume_name> | [db.]merge_tree_family_table_name]
``` ```
:::note :::note
@ -166,7 +174,7 @@ SYSTEM STOP MERGES [ON VOLUME <volume_name> | [db.]merge_tree_family_table_name]
Включает фоновые мержи для таблиц семейства MergeTree: Включает фоновые мержи для таблиц семейства MergeTree:
``` sql ``` sql
SYSTEM START MERGES [ON VOLUME <volume_name> | [db.]merge_tree_family_table_name] SYSTEM START MERGES [ON CLUSTER cluster_name] [ON VOLUME <volume_name> | [db.]merge_tree_family_table_name]
``` ```
### STOP TTL MERGES {#query_language-stop-ttl-merges} ### STOP TTL MERGES {#query_language-stop-ttl-merges}
@ -175,7 +183,7 @@ SYSTEM START MERGES [ON VOLUME <volume_name> | [db.]merge_tree_family_table_name
Возвращает `Ok.` даже если указана несуществующая таблица или таблица имеет тип отличный от MergeTree. Возвращает ошибку если указана не существующая база данных: Возвращает `Ok.` даже если указана несуществующая таблица или таблица имеет тип отличный от MergeTree. Возвращает ошибку если указана не существующая база данных:
``` sql ``` sql
SYSTEM STOP TTL MERGES [[db.]merge_tree_family_table_name] SYSTEM STOP TTL MERGES [ON CLUSTER cluster_name] [[db.]merge_tree_family_table_name]
``` ```
### START TTL MERGES {#query_language-start-ttl-merges} ### START TTL MERGES {#query_language-start-ttl-merges}
@ -184,7 +192,7 @@ SYSTEM STOP TTL MERGES [[db.]merge_tree_family_table_name]
Возвращает `Ok.` даже если указана несуществующая таблица или таблица имеет тип отличный от MergeTree. Возвращает ошибку если указана не существующая база данных: Возвращает `Ok.` даже если указана несуществующая таблица или таблица имеет тип отличный от MergeTree. Возвращает ошибку если указана не существующая база данных:
``` sql ``` sql
SYSTEM START TTL MERGES [[db.]merge_tree_family_table_name] SYSTEM START TTL MERGES [ON CLUSTER cluster_name] [[db.]merge_tree_family_table_name]
``` ```
### STOP MOVES {#query_language-stop-moves} ### STOP MOVES {#query_language-stop-moves}
@ -193,7 +201,7 @@ SYSTEM START TTL MERGES [[db.]merge_tree_family_table_name]
Возвращает `Ok.` даже если указана несуществующая таблица или таблица имеет тип отличный от MergeTree. Возвращает ошибку если указана не существующая база данных: Возвращает `Ok.` даже если указана несуществующая таблица или таблица имеет тип отличный от MergeTree. Возвращает ошибку если указана не существующая база данных:
``` sql ``` sql
SYSTEM STOP MOVES [[db.]merge_tree_family_table_name] SYSTEM STOP MOVES [ON CLUSTER cluster_name] [[db.]merge_tree_family_table_name]
``` ```
### START MOVES {#query_language-start-moves} ### START MOVES {#query_language-start-moves}
@ -202,7 +210,7 @@ SYSTEM STOP MOVES [[db.]merge_tree_family_table_name]
Возвращает `Ok.` даже если указана несуществующая таблица или таблица имеет тип отличный от MergeTree. Возвращает ошибку если указана не существующая база данных: Возвращает `Ok.` даже если указана несуществующая таблица или таблица имеет тип отличный от MergeTree. Возвращает ошибку если указана не существующая база данных:
``` sql ``` sql
SYSTEM START MOVES [[db.]merge_tree_family_table_name] SYSTEM START MOVES [ON CLUSTER cluster_name] [[db.]merge_tree_family_table_name]
``` ```
### SYSTEM UNFREEZE {#query_language-system-unfreeze} ### SYSTEM UNFREEZE {#query_language-system-unfreeze}
@ -223,7 +231,7 @@ ClickHouse может управлять фоновыми процессами
Всегда возвращает `Ok.` вне зависимости от типа таблицы и даже если таблица или база данных не существет. Всегда возвращает `Ok.` вне зависимости от типа таблицы и даже если таблица или база данных не существет.
``` sql ``` sql
SYSTEM STOP FETCHES [[db.]replicated_merge_tree_family_table_name] SYSTEM STOP FETCHES [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### START FETCHES {#query_language-system-start-fetches} ### START FETCHES {#query_language-system-start-fetches}
@ -232,7 +240,7 @@ SYSTEM STOP FETCHES [[db.]replicated_merge_tree_family_table_name]
Всегда возвращает `Ok.` вне зависимости от типа таблицы и даже если таблица или база данных не существет. Всегда возвращает `Ok.` вне зависимости от типа таблицы и даже если таблица или база данных не существет.
``` sql ``` sql
SYSTEM START FETCHES [[db.]replicated_merge_tree_family_table_name] SYSTEM START FETCHES [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### STOP REPLICATED SENDS {#query_language-system-start-replicated-sends} ### STOP REPLICATED SENDS {#query_language-system-start-replicated-sends}
@ -240,7 +248,7 @@ SYSTEM START FETCHES [[db.]replicated_merge_tree_family_table_name]
Позволяет остановить фоновые процессы отсылки новых вставленных кусков данных другим репликам в кластере для таблиц семейства `ReplicatedMergeTree`: Позволяет остановить фоновые процессы отсылки новых вставленных кусков данных другим репликам в кластере для таблиц семейства `ReplicatedMergeTree`:
``` sql ``` sql
SYSTEM STOP REPLICATED SENDS [[db.]replicated_merge_tree_family_table_name] SYSTEM STOP REPLICATED SENDS [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### START REPLICATED SENDS {#query_language-system-start-replicated-sends} ### START REPLICATED SENDS {#query_language-system-start-replicated-sends}
@ -248,7 +256,7 @@ SYSTEM STOP REPLICATED SENDS [[db.]replicated_merge_tree_family_table_name]
Позволяет запустить фоновые процессы отсылки новых вставленных кусков данных другим репликам в кластере для таблиц семейства `ReplicatedMergeTree`: Позволяет запустить фоновые процессы отсылки новых вставленных кусков данных другим репликам в кластере для таблиц семейства `ReplicatedMergeTree`:
``` sql ``` sql
SYSTEM START REPLICATED SENDS [[db.]replicated_merge_tree_family_table_name] SYSTEM START REPLICATED SENDS [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### STOP REPLICATION QUEUES {#query_language-system-stop-replication-queues} ### STOP REPLICATION QUEUES {#query_language-system-stop-replication-queues}
@ -256,7 +264,7 @@ SYSTEM START REPLICATED SENDS [[db.]replicated_merge_tree_family_table_name]
Останавливает фоновые процессы разбора заданий из очереди репликации которая хранится в Zookeeper для таблиц семейства `ReplicatedMergeTree`. Возможные типы заданий - merges, fetches, mutation, DDL запросы с ON CLUSTER: Останавливает фоновые процессы разбора заданий из очереди репликации которая хранится в Zookeeper для таблиц семейства `ReplicatedMergeTree`. Возможные типы заданий - merges, fetches, mutation, DDL запросы с ON CLUSTER:
``` sql ``` sql
SYSTEM STOP REPLICATION QUEUES [[db.]replicated_merge_tree_family_table_name] SYSTEM STOP REPLICATION QUEUES [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### START REPLICATION QUEUES {#query_language-system-start-replication-queues} ### START REPLICATION QUEUES {#query_language-system-start-replication-queues}
@ -264,7 +272,7 @@ SYSTEM STOP REPLICATION QUEUES [[db.]replicated_merge_tree_family_table_name]
Запускает фоновые процессы разбора заданий из очереди репликации которая хранится в Zookeeper для таблиц семейства `ReplicatedMergeTree`. Возможные типы заданий - merges, fetches, mutation, DDL запросы с ON CLUSTER: Запускает фоновые процессы разбора заданий из очереди репликации которая хранится в Zookeeper для таблиц семейства `ReplicatedMergeTree`. Возможные типы заданий - merges, fetches, mutation, DDL запросы с ON CLUSTER:
``` sql ``` sql
SYSTEM START REPLICATION QUEUES [[db.]replicated_merge_tree_family_table_name] SYSTEM START REPLICATION QUEUES [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### SYNC REPLICA {#query_language-system-sync-replica} ### SYNC REPLICA {#query_language-system-sync-replica}
@ -287,7 +295,7 @@ SYSTEM SYNC REPLICA [db.]replicated_merge_tree_family_table_name [STRICT | LIGHT
Инициализация очереди репликации на основе данных ZooKeeper происходит так же, как при `ATTACH TABLE`. Некоторое время таблица будет недоступна для любых операций. Инициализация очереди репликации на основе данных ZooKeeper происходит так же, как при `ATTACH TABLE`. Некоторое время таблица будет недоступна для любых операций.
``` sql ``` sql
SYSTEM RESTART REPLICA [db.]replicated_merge_tree_family_table_name SYSTEM RESTART REPLICA [ON CLUSTER cluster_name] [db.]replicated_merge_tree_family_table_name
``` ```
### RESTORE REPLICA {#query_language-system-restore-replica} ### RESTORE REPLICA {#query_language-system-restore-replica}

View File

@ -71,10 +71,18 @@ SYSTEM DROP REPLICA 'replica_name' FROM ZKPATH '/path/to/table/in/zk';
将日志信息缓冲数据刷入系统表例如system.query_log。调试时允许等待不超过7.5秒。当信息队列为空时,会创建系统表。 将日志信息缓冲数据刷入系统表例如system.query_log。调试时允许等待不超过7.5秒。当信息队列为空时,会创建系统表。
```sql
SYSTEM FLUSH LOGS [ON CLUSTER cluster_name]
```
## RELOAD CONFIG {#query_language-system-reload-config} ## RELOAD CONFIG {#query_language-system-reload-config}
重新加载ClickHouse的配置。用于当配置信息存放在ZooKeeper时。 重新加载ClickHouse的配置。用于当配置信息存放在ZooKeeper时。
```sql
SYSTEM RELOAD CONFIG [ON CLUSTER cluster_name]
```
## SHUTDOWN {#query_language-system-shutdown} ## SHUTDOWN {#query_language-system-shutdown}
关闭ClickHouse服务类似于 `service clickhouse-server stop` / `kill {$pid_clickhouse-server}` 关闭ClickHouse服务类似于 `service clickhouse-server stop` / `kill {$pid_clickhouse-server}`
@ -93,7 +101,7 @@ ClickHouse可以管理 [distribute](../../engines/table-engines/special/distribu
当向分布式表插入数据时,禁用后台的分布式数据分发。 当向分布式表插入数据时,禁用后台的分布式数据分发。
``` sql ``` sql
SYSTEM STOP DISTRIBUTED SENDS [db.]<distributed_table_name> SYSTEM STOP DISTRIBUTED SENDS [db.]<distributed_table_name> [ON CLUSTER cluster_name]
``` ```
### FLUSH DISTRIBUTED {#query_language-system-flush-distributed} ### FLUSH DISTRIBUTED {#query_language-system-flush-distributed}
@ -101,7 +109,7 @@ SYSTEM STOP DISTRIBUTED SENDS [db.]<distributed_table_name>
强制让ClickHouse同步向集群节点同步发送数据。如果有节点失效ClickHouse抛出异常并停止插入操作。当所有节点都恢复上线时你可以重试之前的操作直到成功执行。 强制让ClickHouse同步向集群节点同步发送数据。如果有节点失效ClickHouse抛出异常并停止插入操作。当所有节点都恢复上线时你可以重试之前的操作直到成功执行。
``` sql ``` sql
SYSTEM FLUSH DISTRIBUTED [db.]<distributed_table_name> SYSTEM FLUSH DISTRIBUTED [db.]<distributed_table_name> [ON CLUSTER cluster_name]
``` ```
### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends} ### START DISTRIBUTED SENDS {#query_language-system-start-distributed-sends}
@ -109,7 +117,7 @@ SYSTEM FLUSH DISTRIBUTED [db.]<distributed_table_name>
当向分布式表插入数据时,允许后台的分布式数据分发。 当向分布式表插入数据时,允许后台的分布式数据分发。
``` sql ``` sql
SYSTEM START DISTRIBUTED SENDS [db.]<distributed_table_name> SYSTEM START DISTRIBUTED SENDS [db.]<distributed_table_name> [ON CLUSTER cluster_name]
``` ```
## Managing MergeTree Tables {#query-language-system-mergetree} ## Managing MergeTree Tables {#query-language-system-mergetree}
@ -121,7 +129,7 @@ ClickHouse可以管理 [MergeTree](../../engines/table-engines/mergetree-family/
为MergeTree系列引擎表停止后台合并操作。 为MergeTree系列引擎表停止后台合并操作。
``` sql ``` sql
SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] SYSTEM STOP MERGES [ON CLUSTER cluster_name] [ON VOLUME <volume_name> | [db.]merge_tree_family_table_name]
``` ```
:::note :::note
@ -133,7 +141,7 @@ SYSTEM STOP MERGES [[db.]merge_tree_family_table_name]
为MergeTree系列引擎表启动后台合并操作。 为MergeTree系列引擎表启动后台合并操作。
``` sql ``` sql
SYSTEM START MERGES [[db.]merge_tree_family_table_name] SYSTEM START MERGES [ON CLUSTER cluster_name] [ON VOLUME <volume_name> | [db.]merge_tree_family_table_name]
``` ```
### STOP TTL MERGES {#query_language-stop-ttl-merges} ### STOP TTL MERGES {#query_language-stop-ttl-merges}
@ -142,7 +150,7 @@ SYSTEM START MERGES [[db.]merge_tree_family_table_name]
不管表存在与否,都返回 `OK.`。当数据库不存在时返回错误。 不管表存在与否,都返回 `OK.`。当数据库不存在时返回错误。
``` sql ``` sql
SYSTEM STOP TTL MERGES [[db.]merge_tree_family_table_name] SYSTEM STOP TTL MERGES [ON CLUSTER cluster_name] [[db.]merge_tree_family_table_name]
``` ```
### START TTL MERGES {#query_language-start-ttl-merges} ### START TTL MERGES {#query_language-start-ttl-merges}
@ -151,7 +159,7 @@ SYSTEM STOP TTL MERGES [[db.]merge_tree_family_table_name]
``` sql ``` sql
SYSTEM START TTL MERGES [[db.]merge_tree_family_table_name] SYSTEM START TTL MERGES [ON CLUSTER cluster_name] [[db.]merge_tree_family_table_name]
``` ```
### STOP MOVES {#query_language-stop-moves} ### STOP MOVES {#query_language-stop-moves}
@ -160,7 +168,7 @@ SYSTEM START TTL MERGES [[db.]merge_tree_family_table_name]
``` sql ``` sql
SYSTEM STOP MOVES [[db.]merge_tree_family_table_name] SYSTEM STOP MOVES [ON CLUSTER cluster_name] [[db.]merge_tree_family_table_name]
``` ```
### START MOVES {#query_language-start-moves} ### START MOVES {#query_language-start-moves}
@ -169,7 +177,7 @@ SYSTEM STOP MOVES [[db.]merge_tree_family_table_name]
``` sql ``` sql
SYSTEM STOP MOVES [[db.]merge_tree_family_table_name] SYSTEM START MOVES [ON CLUSTER cluster_name] [[db.]merge_tree_family_table_name]
``` ```
### SYSTEM UNFREEZE {#query_language-system-unfreeze} ### SYSTEM UNFREEZE {#query_language-system-unfreeze}
@ -190,7 +198,7 @@ SYSTEM UNFREEZE WITH NAME <backup_name>
不管表引擎类型如何或表/数据库是否存,都返回 `OK.` 不管表引擎类型如何或表/数据库是否存,都返回 `OK.`
``` sql ``` sql
SYSTEM STOP FETCHES [[db.]replicated_merge_tree_family_table_name] SYSTEM STOP FETCHES [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### START FETCHES {#query_language-system-start-fetches} ### START FETCHES {#query_language-system-start-fetches}
@ -199,7 +207,7 @@ SYSTEM STOP FETCHES [[db.]replicated_merge_tree_family_table_name]
不管表引擎类型如何或表/数据库是否存,都返回 `OK.` 不管表引擎类型如何或表/数据库是否存,都返回 `OK.`
``` sql ``` sql
SYSTEM START FETCHES [[db.]replicated_merge_tree_family_table_name] SYSTEM START FETCHES [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### STOP REPLICATED SENDS {#query_language-system-start-replicated-sends} ### STOP REPLICATED SENDS {#query_language-system-start-replicated-sends}
@ -207,7 +215,7 @@ SYSTEM START FETCHES [[db.]replicated_merge_tree_family_table_name]
停止通过后台分发 `ReplicatedMergeTree`系列引擎表中新插入的数据块到集群的其它副本节点。 停止通过后台分发 `ReplicatedMergeTree`系列引擎表中新插入的数据块到集群的其它副本节点。
``` sql ``` sql
SYSTEM STOP REPLICATED SENDS [[db.]replicated_merge_tree_family_table_name] SYSTEM STOP REPLICATED SENDS [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### START REPLICATED SENDS {#query_language-system-start-replicated-sends} ### START REPLICATED SENDS {#query_language-system-start-replicated-sends}
@ -215,7 +223,7 @@ SYSTEM STOP REPLICATED SENDS [[db.]replicated_merge_tree_family_table_name]
启动通过后台分发 `ReplicatedMergeTree`系列引擎表中新插入的数据块到集群的其它副本节点。 启动通过后台分发 `ReplicatedMergeTree`系列引擎表中新插入的数据块到集群的其它副本节点。
``` sql ``` sql
SYSTEM START REPLICATED SENDS [[db.]replicated_merge_tree_family_table_name] SYSTEM START REPLICATED SENDS [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### STOP REPLICATION QUEUES {#query_language-system-stop-replication-queues} ### STOP REPLICATION QUEUES {#query_language-system-stop-replication-queues}
@ -224,7 +232,7 @@ SYSTEM START REPLICATED SENDS [[db.]replicated_merge_tree_family_table_name]
停止从Zookeeper中获取 `ReplicatedMergeTree`系列表的复制队列的后台任务。可能的后台任务类型包含merges, fetches, mutation带有 `ON CLUSTER`的ddl语句 停止从Zookeeper中获取 `ReplicatedMergeTree`系列表的复制队列的后台任务。可能的后台任务类型包含merges, fetches, mutation带有 `ON CLUSTER`的ddl语句
``` sql ``` sql
SYSTEM STOP REPLICATION QUEUES [[db.]replicated_merge_tree_family_table_name] SYSTEM STOP REPLICATION QUEUES [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### START REPLICATION QUEUES {#query_language-system-start-replication-queues} ### START REPLICATION QUEUES {#query_language-system-start-replication-queues}
@ -232,7 +240,7 @@ SYSTEM STOP REPLICATION QUEUES [[db.]replicated_merge_tree_family_table_name]
启动从Zookeeper中获取 `ReplicatedMergeTree`系列表的复制队列的后台任务。可能的后台任务类型包含merges, fetches, mutation带有 `ON CLUSTER`的ddl语句 启动从Zookeeper中获取 `ReplicatedMergeTree`系列表的复制队列的后台任务。可能的后台任务类型包含merges, fetches, mutation带有 `ON CLUSTER`的ddl语句
``` sql ``` sql
SYSTEM START REPLICATION QUEUES [[db.]replicated_merge_tree_family_table_name] SYSTEM START REPLICATION QUEUES [ON CLUSTER cluster_name] [[db.]replicated_merge_tree_family_table_name]
``` ```
### SYNC REPLICA {#query_language-system-sync-replica} ### SYNC REPLICA {#query_language-system-sync-replica}
@ -250,7 +258,7 @@ SYSTEM SYNC REPLICA [db.]replicated_merge_tree_family_table_name [STRICT | LIGHT
``` sql ``` sql
SYSTEM RESTART REPLICA [db.]replicated_merge_tree_family_table_name SYSTEM RESTART REPLICA [ON CLUSTER cluster_name] [db.]replicated_merge_tree_family_table_name
``` ```
### RESTART REPLICAS {#query_language-system-restart-replicas} ### RESTART REPLICAS {#query_language-system-restart-replicas}