mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Update the documentaion
This commit is contained in:
parent
df6d627618
commit
8b005a9d02
@ -206,6 +206,55 @@ end_time: 2022-08-30 09:21:46
|
||||
1 row in set. Elapsed: 0.002 sec.
|
||||
```
|
||||
|
||||
Along with `system.backups` table, all backup and restore operations are also tracked in the system log table [backup_log](../operations/system-tables/backup_log.md):
|
||||
```
|
||||
SELECT *
|
||||
FROM system.backup_log
|
||||
WHERE id = '7678b0b3-f519-4e6e-811f-5a0781a4eb52'
|
||||
ORDER BY event_time_microseconds ASC
|
||||
FORMAT Vertical
|
||||
```
|
||||
```response
|
||||
Row 1:
|
||||
──────
|
||||
event_date: 2023-08-18
|
||||
event_time_microseconds: 2023-08-18 11:13:43.097414
|
||||
id: 7678b0b3-f519-4e6e-811f-5a0781a4eb52
|
||||
name: Disk('backups', '1.zip')
|
||||
status: CREATING_BACKUP
|
||||
error:
|
||||
start_time: 2023-08-18 11:13:43
|
||||
end_time: 1970-01-01 03:00:00
|
||||
num_files: 0
|
||||
total_size: 0
|
||||
num_entries: 0
|
||||
uncompressed_size: 0
|
||||
compressed_size: 0
|
||||
files_read: 0
|
||||
bytes_read: 0
|
||||
|
||||
Row 2:
|
||||
──────
|
||||
event_date: 2023-08-18
|
||||
event_time_microseconds: 2023-08-18 11:13:43.174782
|
||||
id: 7678b0b3-f519-4e6e-811f-5a0781a4eb52
|
||||
name: Disk('backups', '1.zip')
|
||||
status: BACKUP_FAILED
|
||||
#highlight-next-line
|
||||
error: Code: 598. DB::Exception: Backup Disk('backups', '1.zip') already exists. (BACKUP_ALREADY_EXISTS) (version 23.8.1.1)
|
||||
start_time: 2023-08-18 11:13:43
|
||||
end_time: 2023-08-18 11:13:43
|
||||
num_files: 0
|
||||
total_size: 0
|
||||
num_entries: 0
|
||||
uncompressed_size: 0
|
||||
compressed_size: 0
|
||||
files_read: 0
|
||||
bytes_read: 0
|
||||
|
||||
2 rows in set. Elapsed: 0.075 sec.
|
||||
```
|
||||
|
||||
## Configuring BACKUP/RESTORE to use an S3 Endpoint
|
||||
|
||||
To write backups to an S3 bucket you need three pieces of information:
|
||||
|
@ -2084,6 +2084,47 @@ The default server configuration file `config.xml` contains the following settin
|
||||
</crash_log>
|
||||
```
|
||||
|
||||
## backup_log {#server_configuration_parameters-backup_log}
|
||||
|
||||
Settings for the [backup_log](../../operations/system-tables/backup_log.md) system table for logging `BACKUP` and `RESTORE` operations.
|
||||
|
||||
Parameters:
|
||||
|
||||
- `database` — Database name.
|
||||
- `table` — Table name.
|
||||
- `partition_by` — [Custom partitioning key](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) for a system table. Can't be used if `engine` is defined.
|
||||
- `order_by` - [Custom sorting key](../../engines/table-engines/mergetree-family/mergetree.md#order_by) for a system table. Can't be used if `engine` is defined.
|
||||
- `engine` - [MergeTree Engine Definition](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table) for a system table. Can't be used if `partition_by` or `order_by` is defined.
|
||||
- `flush_interval_milliseconds` — Interval for flushing data from the buffer in memory to the table.
|
||||
- `max_size_rows` – Maximal size in lines for the logs. When non-flushed logs amount reaches max_size, logs dumped to the disk.
|
||||
Default: 1048576.
|
||||
- `reserved_size_rows` – Pre-allocated memory size in lines for the logs.
|
||||
Default: 8192.
|
||||
- `buffer_size_rows_flush_threshold` – Lines amount threshold, reaching it launches flushing logs to the disk in background.
|
||||
Default: `max_size_rows / 2`.
|
||||
- `flush_on_crash` - Indication whether logs should be dumped to the disk in case of a crash.
|
||||
Default: false.
|
||||
- `storage_policy` – Name of storage policy to use for the table (optional).
|
||||
- `settings` - [Additional parameters](../../engines/table-engines/mergetree-family/mergetree.md#settings) that control the behavior of the MergeTree (optional).
|
||||
|
||||
**Example**
|
||||
|
||||
```xml
|
||||
<clickhouse>
|
||||
<backup_log>
|
||||
<database>system</database>
|
||||
<table>backup_log</table>
|
||||
<flush_interval_milliseconds>1000</flush_interval_milliseconds>
|
||||
<partition_by>toYYYYMM(event_date)</partition_by>
|
||||
<max_size_rows>1048576</max_size_rows>
|
||||
<reserved_size_rows>8192</reserved_size_rows>
|
||||
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
|
||||
<flush_on_crash>false</flush_on_crash>
|
||||
<!-- <engine>Engine = MergeTree PARTITION BY event_date ORDER BY event_time TTL event_date + INTERVAL 30 day</engine> -->
|
||||
</backup_log>
|
||||
</clickhouse>
|
||||
```
|
||||
|
||||
## query_masking_rules {#query-masking-rules}
|
||||
|
||||
Regexp-based rules, which will be applied to queries as well as all log messages before storing them in server logs,
|
||||
|
145
docs/en/operations/system-tables/backup_log.md
Normal file
145
docs/en/operations/system-tables/backup_log.md
Normal file
@ -0,0 +1,145 @@
|
||||
---
|
||||
slug: /en/operations/system-tables/backup_log
|
||||
---
|
||||
# backup_log
|
||||
|
||||
Contains logging entries with the information about `BACKUP` and `RESTORE` operations.
|
||||
|
||||
Columns:
|
||||
|
||||
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — Date of the entry.
|
||||
- `event_time_microseconds` ([DateTime64](../../sql-reference/data-types/datetime64.md)) — Time of the entry with microseconds precision.
|
||||
- `id` ([String](../../sql-reference/data-types/string.md)) — Identifier of the backup or restore operation.
|
||||
- `name` ([String](../../sql-reference/data-types/string.md)) — Name of the backup storage (the contents of the `FROM` or `TO` clause).
|
||||
- `status` ([Enum8](../../sql-reference/data-types/enum.md)) — Operation status. Possible values:
|
||||
- `'CREATING_BACKUP'`
|
||||
- `'BACKUP_CREATED'`
|
||||
- `'BACKUP_FAILED'`
|
||||
- `'RESTORING'`
|
||||
- `'RESTORED'`
|
||||
- `'RESTORE_FAILED'`
|
||||
- `error` ([String](../../sql-reference/data-types/string.md)) — Error message of the failed operation (empty string for successful opetations).
|
||||
- `start_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — Start time of the operation.
|
||||
- `end_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — End time of the operation.
|
||||
- `num_files` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Number of files stored in the backup.
|
||||
- `total_size` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Total size of files stored in the backup.
|
||||
- `num_entries` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Number of entries in the backup, i.e. the number of files inside the folder if the backup is stored as a folder, or the number of files inside the archive if the backup is stored as an archive. It is not the same as `num_files` if it's an incremental backup or if it contains empty files or duplicates. The following is always true: `num_entries <= num_files`.
|
||||
- `uncompressed_size` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Uncompressed size of the backup.
|
||||
- `compressed_size` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Compressed size of the backup. If the backup is not stored as an archive it equals to `uncompressed_size`.
|
||||
- `files_read` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Number of files read during the restore operation.
|
||||
- `bytes_read` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Total size of files read during the restore operation.
|
||||
|
||||
**Example**
|
||||
|
||||
```sql
|
||||
BACKUP TABLE test_db.my_table TO Disk('backups_disk', '1.zip')
|
||||
```
|
||||
```response
|
||||
┌─id───────────────────────────────────┬─status─────────┐
|
||||
│ e5b74ecb-f6f1-426a-80be-872f90043885 │ BACKUP_CREATED │
|
||||
└──────────────────────────────────────┴────────────────┘
|
||||
```
|
||||
```sql
|
||||
SELECT * FROM system.backup_log WHERE id = 'e5b74ecb-f6f1-426a-80be-872f90043885' ORDER BY event_date, event_time_microseconds \G
|
||||
```
|
||||
```response
|
||||
Row 1:
|
||||
──────
|
||||
event_date: 2023-08-19
|
||||
event_time_microseconds: 2023-08-19 11:05:21.998566
|
||||
id: e5b74ecb-f6f1-426a-80be-872f90043885
|
||||
name: Disk('backups_disk', '1.zip')
|
||||
status: CREATING_BACKUP
|
||||
error:
|
||||
start_time: 2023-08-19 11:05:21
|
||||
end_time: 1970-01-01 03:00:00
|
||||
num_files: 0
|
||||
total_size: 0
|
||||
num_entries: 0
|
||||
uncompressed_size: 0
|
||||
compressed_size: 0
|
||||
files_read: 0
|
||||
bytes_read: 0
|
||||
|
||||
Row 2:
|
||||
──────
|
||||
event_date: 2023-08-19
|
||||
event_time_microseconds: 2023-08-19 11:08:56.916192
|
||||
id: e5b74ecb-f6f1-426a-80be-872f90043885
|
||||
name: Disk('backups_disk', '1.zip')
|
||||
status: BACKUP_CREATED
|
||||
error:
|
||||
start_time: 2023-08-19 11:05:21
|
||||
end_time: 2023-08-19 11:08:56
|
||||
num_files: 57
|
||||
total_size: 4290364870
|
||||
num_entries: 46
|
||||
uncompressed_size: 4290362365
|
||||
compressed_size: 3525068304
|
||||
files_read: 0
|
||||
bytes_read: 0
|
||||
```
|
||||
```sql
|
||||
RESTORE TABLE test_db.my_table FROM Disk('backups_disk', '1.zip')
|
||||
```
|
||||
```response
|
||||
┌─id───────────────────────────────────┬─status───┐
|
||||
│ cdf1f731-52ef-42da-bc65-2e1bfcd4ce90 │ RESTORED │
|
||||
└──────────────────────────────────────┴──────────┘
|
||||
```
|
||||
```sql
|
||||
SELECT * FROM system.backup_log WHERE id = 'cdf1f731-52ef-42da-bc65-2e1bfcd4ce90' ORDER BY event_date, event_time_microseconds \G
|
||||
```
|
||||
```response
|
||||
Row 1:
|
||||
──────
|
||||
event_date: 2023-08-19
|
||||
event_time_microseconds: 2023-08-19 11:09:19.718077
|
||||
id: cdf1f731-52ef-42da-bc65-2e1bfcd4ce90
|
||||
name: Disk('backups_disk', '1.zip')
|
||||
status: RESTORING
|
||||
error:
|
||||
start_time: 2023-08-19 11:09:19
|
||||
end_time: 1970-01-01 03:00:00
|
||||
num_files: 0
|
||||
total_size: 0
|
||||
num_entries: 0
|
||||
uncompressed_size: 0
|
||||
compressed_size: 0
|
||||
files_read: 0
|
||||
bytes_read: 0
|
||||
|
||||
Row 2:
|
||||
──────
|
||||
event_date: 2023-08-19
|
||||
event_time_microseconds: 2023-08-19 11:09:29.334234
|
||||
id: cdf1f731-52ef-42da-bc65-2e1bfcd4ce90
|
||||
name: Disk('backups_disk', '1.zip')
|
||||
status: RESTORED
|
||||
error:
|
||||
start_time: 2023-08-19 11:09:19
|
||||
end_time: 2023-08-19 11:09:29
|
||||
num_files: 57
|
||||
total_size: 4290364870
|
||||
num_entries: 46
|
||||
uncompressed_size: 4290362365
|
||||
compressed_size: 4290362365
|
||||
files_read: 57
|
||||
bytes_read: 4290364870
|
||||
```
|
||||
|
||||
This is essentially the same information that is written in the system table `system.backups`:
|
||||
|
||||
```sql
|
||||
SELECT * FROM system.backups ORDER BY start_time
|
||||
```
|
||||
```response
|
||||
┌─id───────────────────────────────────┬─name──────────────────────────┬─status─────────┬─error─┬──────────start_time─┬────────────end_time─┬─num_files─┬─total_size─┬─num_entries─┬─uncompressed_size─┬─compressed_size─┬─files_read─┬─bytes_read─┐
|
||||
│ e5b74ecb-f6f1-426a-80be-872f90043885 │ Disk('backups_disk', '1.zip') │ BACKUP_CREATED │ │ 2023-08-19 11:05:21 │ 2023-08-19 11:08:56 │ 57 │ 4290364870 │ 46 │ 4290362365 │ 3525068304 │ 0 │ 0 │
|
||||
│ cdf1f731-52ef-42da-bc65-2e1bfcd4ce90 │ Disk('backups_disk', '1.zip') │ RESTORED │ │ 2023-08-19 11:09:19 │ 2023-08-19 11:09:29 │ 57 │ 4290364870 │ 46 │ 4290362365 │ 4290362365 │ 57 │ 4290364870 │
|
||||
└──────────────────────────────────────┴───────────────────────────────┴────────────────┴───────┴─────────────────────┴─────────────────────┴───────────┴────────────┴─────────────┴───────────────────┴─────────────────┴────────────┴────────────┘
|
||||
```
|
||||
|
||||
**See Also**
|
||||
|
||||
- [Backup and Restore](../../operations/backup.md)
|
@ -23,7 +23,7 @@ System tables:
|
||||
|
||||
Most of system tables store their data in RAM. A ClickHouse server creates such system tables at the start.
|
||||
|
||||
Unlike other system tables, the system log tables [metric_log](../../operations/system-tables/metric_log.md), [query_log](../../operations/system-tables/query_log.md), [query_thread_log](../../operations/system-tables/query_thread_log.md), [trace_log](../../operations/system-tables/trace_log.md), [part_log](../../operations/system-tables/part_log.md), [crash_log](../../operations/system-tables/crash-log.md) and [text_log](../../operations/system-tables/text_log.md) are served by [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) table engine and store their data in a filesystem by default. If you remove a table from a filesystem, the ClickHouse server creates the empty one again at the time of the next data writing. If system table schema changed in a new release, then ClickHouse renames the current table and creates a new one.
|
||||
Unlike other system tables, the system log tables [metric_log](../../operations/system-tables/metric_log.md), [query_log](../../operations/system-tables/query_log.md), [query_thread_log](../../operations/system-tables/query_thread_log.md), [trace_log](../../operations/system-tables/trace_log.md), [part_log](../../operations/system-tables/part_log.md), [crash_log](../../operations/system-tables/crash-log.md), [text_log](../../operations/system-tables/text_log.md) and [backup_log](../../operations/system-tables/backup_log.md) are served by [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) table engine and store their data in a filesystem by default. If you remove a table from a filesystem, the ClickHouse server creates the empty one again at the time of the next data writing. If system table schema changed in a new release, then ClickHouse renames the current table and creates a new one.
|
||||
|
||||
System log tables can be customized by creating a config file with the same name as the table under `/etc/clickhouse-server/config.d/`, or setting corresponding elements in `/etc/clickhouse-server/config.xml`. Elements can be customized are:
|
||||
|
||||
@ -32,7 +32,7 @@ System log tables can be customized by creating a config file with the same name
|
||||
- `partition_by`: specify [PARTITION BY](../../engines/table-engines/mergetree-family/custom-partitioning-key.md) expression.
|
||||
- `ttl`: specify table [TTL](../../sql-reference/statements/alter/ttl.md) expression.
|
||||
- `flush_interval_milliseconds`: interval of flushing data to disk.
|
||||
- `engine`: provide full engine expression (starting with `ENGINE =` ) with parameters. This option is contradict with `partition_by` and `ttl`. If set together, the server would raise an exception and exit.
|
||||
- `engine`: provide full engine expression (starting with `ENGINE =` ) with parameters. This option conflicts with `partition_by` and `ttl`. If set together, the server will raise an exception and exit.
|
||||
|
||||
An example:
|
||||
|
||||
|
@ -1488,6 +1488,47 @@ ClickHouse использует потоки из глобального пул
|
||||
</crash_log>
|
||||
```
|
||||
|
||||
## backup_log {#server_configuration_parameters-backup_log}
|
||||
|
||||
Настройки для системной таблицы [backup_log](../../operations/system-tables/backup_log.md), предназначенной для логирования операций `BACKUP` и `RESTORE`.
|
||||
|
||||
Параметры:
|
||||
|
||||
- `database` — имя базы данных.
|
||||
- `table` — имя таблицы.
|
||||
- `partition_by` — [произвольный ключ партиционирования](../../engines/table-engines/mergetree-family/custom-partitioning-key.md). Нельзя использовать одновременно с `engine`.
|
||||
- `order_by` - [произвольный ключ сортировки](../../engines/table-engines/mergetree-family/mergetree.md#order_by). Нельзя использовать одновременно с `engine`.
|
||||
- `engine` - [настройки MergeTree Engine](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-creating-a-table). Нельзя использовать с `partition_by` или `order_by`.
|
||||
- `flush_interval_milliseconds` — период сброса данных из буфера в памяти в таблицу.
|
||||
- `max_size_rows` – максимальный размер в строках для буфера с логами. Когда буфер будет заполнен полностью, сбрасывает логи на диск.
|
||||
Значение по умолчанию: 1024.
|
||||
- `reserved_size_rows` – преаллоцированный размер в строках для буфера с логами.
|
||||
Значение по умолчанию: 1024.
|
||||
- `buffer_size_rows_flush_threshold` – количество строк в логе, при достижении которого логи начнут скидываться на диск в неблокирующем режиме.
|
||||
Значение по умолчанию: `max_size_rows / 2`.
|
||||
- `flush_on_crash` - должны ли логи быть сброшены на диск в случае неожиданной остановки программы.
|
||||
Значение по умолчанию: false.
|
||||
- `storage_policy` – название политики хранения (необязательный параметр).
|
||||
- `settings` - [дополнительные настройки MergeTree Engine](../../engines/table-engines/mergetree-family/mergetree.md#settings) (необязательный параметр).
|
||||
|
||||
**Пример**
|
||||
|
||||
```xml
|
||||
<clickhouse>
|
||||
<backup_log>
|
||||
<database>system</database>
|
||||
<table>backup_log</table>
|
||||
<flush_interval_milliseconds>1000</flush_interval_milliseconds>
|
||||
<partition_by>toYYYYMM(event_date)</partition_by>
|
||||
<max_size_rows>1048576</max_size_rows>
|
||||
<reserved_size_rows>8192</reserved_size_rows>
|
||||
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
|
||||
<flush_on_crash>false</flush_on_crash>
|
||||
<!-- <engine>Engine = MergeTree PARTITION BY event_date ORDER BY event_time TTL event_date + INTERVAL 30 day</engine> -->
|
||||
</backup_log>
|
||||
</clickhouse>
|
||||
```
|
||||
|
||||
## query_masking_rules {#query-masking-rules}
|
||||
|
||||
Правила, основанные на регулярных выражениях, которые будут применены для всех запросов, а также для всех сообщений перед сохранением их в лог на сервере,
|
||||
|
145
docs/ru/operations/system-tables/backup_log.md
Normal file
145
docs/ru/operations/system-tables/backup_log.md
Normal file
@ -0,0 +1,145 @@
|
||||
---
|
||||
slug: /ru/operations/system-tables/backup_log
|
||||
---
|
||||
# system.backup_log {#system_tables-backup-log}
|
||||
|
||||
Содержит информацию о всех операциях `BACKUP` and `RESTORE`.
|
||||
|
||||
Колонки:
|
||||
|
||||
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — Дата события.
|
||||
- `event_time_microseconds` ([DateTime64](../../sql-reference/data-types/datetime64.md)) — Время события с точностью до микросекунд.
|
||||
- `id` ([String](../../sql-reference/data-types/string.md)) — Идентификатор операции.
|
||||
- `name` ([String](../../sql-reference/data-types/string.md)) — Название хранилища (содержимое секции `FROM` или `TO` в SQL запросе).
|
||||
- `status` ([Enum8](../../sql-reference/data-types/enum.md)) — Статус операции. Возможные значения:
|
||||
- `'CREATING_BACKUP'`
|
||||
- `'BACKUP_CREATED'`
|
||||
- `'BACKUP_FAILED'`
|
||||
- `'RESTORING'`
|
||||
- `'RESTORED'`
|
||||
- `'RESTORE_FAILED'`
|
||||
- `error` ([String](../../sql-reference/data-types/string.md)) — Сообщение об ошибке, при наличии (записи для успешных операций содержат пустую строку).
|
||||
- `start_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — Время начала операции.
|
||||
- `end_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — Время завершения операции.
|
||||
- `num_files` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Количество файлов, хранимых в бэкапе.
|
||||
- `total_size` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Общий размер файлов, хранимых в бэкапе.
|
||||
- `num_entries` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Количество позиций в бэкапе, т.е. либо количество файлов в папке (если бэкап хранится в папке), либо количество файлов в архиве (если бэкап хранится в архиве). Это значение не равно `num_files` в случае если это инкрементальный бэкап либо он содержит пустые файлы или дубликаты. Следующее утверждение верно всегда: `num_entries <= num_files`.
|
||||
- `uncompressed_size` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Размер бэкапа до сжатия.
|
||||
- `compressed_size` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Размер бэкапа после сжатия. Если бэкап не хранится в виде архива, это значение равно `uncompressed_size`.
|
||||
- `files_read` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Количество файлов, прочитанных во время операции восстановления.
|
||||
- `bytes_read` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Общий размер файлов, прочитанных во время операции восстановления.
|
||||
|
||||
**Пример**
|
||||
|
||||
```sql
|
||||
BACKUP TABLE test_db.my_table TO Disk('backups_disk', '1.zip')
|
||||
```
|
||||
```response
|
||||
┌─id───────────────────────────────────┬─status─────────┐
|
||||
│ e5b74ecb-f6f1-426a-80be-872f90043885 │ BACKUP_CREATED │
|
||||
└──────────────────────────────────────┴────────────────┘
|
||||
```
|
||||
```sql
|
||||
SELECT * FROM system.backup_log WHERE id = 'e5b74ecb-f6f1-426a-80be-872f90043885' ORDER BY event_date, event_time_microseconds \G
|
||||
```
|
||||
```response
|
||||
Row 1:
|
||||
──────
|
||||
event_date: 2023-08-19
|
||||
event_time_microseconds: 2023-08-19 11:05:21.998566
|
||||
id: e5b74ecb-f6f1-426a-80be-872f90043885
|
||||
name: Disk('backups_disk', '1.zip')
|
||||
status: CREATING_BACKUP
|
||||
error:
|
||||
start_time: 2023-08-19 11:05:21
|
||||
end_time: 1970-01-01 03:00:00
|
||||
num_files: 0
|
||||
total_size: 0
|
||||
num_entries: 0
|
||||
uncompressed_size: 0
|
||||
compressed_size: 0
|
||||
files_read: 0
|
||||
bytes_read: 0
|
||||
|
||||
Row 2:
|
||||
──────
|
||||
event_date: 2023-08-19
|
||||
event_time_microseconds: 2023-08-19 11:08:56.916192
|
||||
id: e5b74ecb-f6f1-426a-80be-872f90043885
|
||||
name: Disk('backups_disk', '1.zip')
|
||||
status: BACKUP_CREATED
|
||||
error:
|
||||
start_time: 2023-08-19 11:05:21
|
||||
end_time: 2023-08-19 11:08:56
|
||||
num_files: 57
|
||||
total_size: 4290364870
|
||||
num_entries: 46
|
||||
uncompressed_size: 4290362365
|
||||
compressed_size: 3525068304
|
||||
files_read: 0
|
||||
bytes_read: 0
|
||||
```
|
||||
```sql
|
||||
RESTORE TABLE test_db.my_table FROM Disk('backups_disk', '1.zip')
|
||||
```
|
||||
```response
|
||||
┌─id───────────────────────────────────┬─status───┐
|
||||
│ cdf1f731-52ef-42da-bc65-2e1bfcd4ce90 │ RESTORED │
|
||||
└──────────────────────────────────────┴──────────┘
|
||||
```
|
||||
```sql
|
||||
SELECT * FROM system.backup_log WHERE id = 'cdf1f731-52ef-42da-bc65-2e1bfcd4ce90' ORDER BY event_date, event_time_microseconds \G
|
||||
```
|
||||
```response
|
||||
Row 1:
|
||||
──────
|
||||
event_date: 2023-08-19
|
||||
event_time_microseconds: 2023-08-19 11:09:19.718077
|
||||
id: cdf1f731-52ef-42da-bc65-2e1bfcd4ce90
|
||||
name: Disk('backups_disk', '1.zip')
|
||||
status: RESTORING
|
||||
error:
|
||||
start_time: 2023-08-19 11:09:19
|
||||
end_time: 1970-01-01 03:00:00
|
||||
num_files: 0
|
||||
total_size: 0
|
||||
num_entries: 0
|
||||
uncompressed_size: 0
|
||||
compressed_size: 0
|
||||
files_read: 0
|
||||
bytes_read: 0
|
||||
|
||||
Row 2:
|
||||
──────
|
||||
event_date: 2023-08-19
|
||||
event_time_microseconds: 2023-08-19 11:09:29.334234
|
||||
id: cdf1f731-52ef-42da-bc65-2e1bfcd4ce90
|
||||
name: Disk('backups_disk', '1.zip')
|
||||
status: RESTORED
|
||||
error:
|
||||
start_time: 2023-08-19 11:09:19
|
||||
end_time: 2023-08-19 11:09:29
|
||||
num_files: 57
|
||||
total_size: 4290364870
|
||||
num_entries: 46
|
||||
uncompressed_size: 4290362365
|
||||
compressed_size: 4290362365
|
||||
files_read: 57
|
||||
bytes_read: 4290364870
|
||||
```
|
||||
|
||||
Это по сути та же информация, что заносится и в системную таблицу `system.backups`:
|
||||
|
||||
```sql
|
||||
SELECT * FROM system.backups ORDER BY start_time
|
||||
```
|
||||
```response
|
||||
┌─id───────────────────────────────────┬─name──────────────────────────┬─status─────────┬─error─┬──────────start_time─┬────────────end_time─┬─num_files─┬─total_size─┬─num_entries─┬─uncompressed_size─┬─compressed_size─┬─files_read─┬─bytes_read─┐
|
||||
│ e5b74ecb-f6f1-426a-80be-872f90043885 │ Disk('backups_disk', '1.zip') │ BACKUP_CREATED │ │ 2023-08-19 11:05:21 │ 2023-08-19 11:08:56 │ 57 │ 4290364870 │ 46 │ 4290362365 │ 3525068304 │ 0 │ 0 │
|
||||
│ cdf1f731-52ef-42da-bc65-2e1bfcd4ce90 │ Disk('backups_disk', '1.zip') │ RESTORED │ │ 2023-08-19 11:09:19 │ 2023-08-19 11:09:29 │ 57 │ 4290364870 │ 46 │ 4290362365 │ 4290362365 │ 57 │ 4290364870 │
|
||||
└──────────────────────────────────────┴───────────────────────────────┴────────────────┴───────┴─────────────────────┴─────────────────────┴───────────┴────────────┴─────────────┴───────────────────┴─────────────────┴────────────┴────────────┘
|
||||
```
|
||||
|
||||
**См. также**
|
||||
|
||||
- [Backup and Restore](../../operations/backup.md)
|
@ -21,7 +21,7 @@ sidebar_label: "Системные таблицы"
|
||||
|
||||
Большинство системных таблиц хранят свои данные в оперативной памяти. Сервер ClickHouse создает эти системные таблицы при старте.
|
||||
|
||||
В отличие от других системных таблиц, таблицы с системными логами [metric_log](../../operations/system-tables/metric_log.md), [query_log](../../operations/system-tables/query_log.md), [query_thread_log](../../operations/system-tables/query_thread_log.md), [trace_log](../../operations/system-tables/trace_log.md), [part_log](../../operations/system-tables/part_log.md), [crash_log](../../operations/system-tables/crash-log.md) и [text_log](../../operations/system-tables/text_log.md) используют движок таблиц [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) и по умолчанию хранят свои данные в файловой системе. Если удалить таблицу из файловой системы, сервер ClickHouse снова создаст пустую таблицу во время следующей записи данных. Если схема системной таблицы изменилась в новом релизе, то ClickHouse переименует текущую таблицу и создаст новую.
|
||||
В отличие от других системных таблиц, таблицы с системными логами [metric_log](../../operations/system-tables/metric_log.md), [query_log](../../operations/system-tables/query_log.md), [query_thread_log](../../operations/system-tables/query_thread_log.md), [trace_log](../../operations/system-tables/trace_log.md), [part_log](../../operations/system-tables/part_log.md), [crash_log](../../operations/system-tables/crash-log.md), [text_log](../../operations/system-tables/text_log.md) и [backup_log](../../operations/system-tables/backup_log.md) используют движок таблиц [MergeTree](../../engines/table-engines/mergetree-family/mergetree.md) и по умолчанию хранят свои данные в файловой системе. Если удалить таблицу из файловой системы, сервер ClickHouse снова создаст пустую таблицу во время следующей записи данных. Если схема системной таблицы изменилась в новом релизе, то ClickHouse переименует текущую таблицу и создаст новую.
|
||||
|
||||
Таблицы с системными логами `log` можно настроить, создав конфигурационный файл с тем же именем, что и таблица в разделе `/etc/clickhouse-server/config.d/`, или указав соответствующие элементы в `/etc/clickhouse-server/config.xml`. Настраиваться могут следующие элементы:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user