熔断机制
- 根据时间周期的累计熔断机制 (users文件内引用)
<quotas>
<default>
<interval>
<duration>3600</duration>
<queries>0</queries>
<errors>0</errors>
<result_rows>0</result_rows>
<read_rows>0</read_rows>
<execution_time>0</execution_time>
</interval>
</default>
<limit_1>
<interval>
<duration>3600</duration>
<queries>100</queries>
<errors>100</errors>
<result_rows>100</result_rows>
<read_rows>2000</read_rows>
<execution_time>3600</execution_time>
</interval>
</limit_1>
</quotas>
- 根据单次查询的用量熔断(用户profile处定义)
max_partitions_per_insert_block
max_rows_to_group_by
max_memory_usage
//等查看官网
数据备份
- 小体量数据
clickhouse-client --query="SELECT * FROM test_backup" > /chbase/test_backup.tsv
cat /chbase/test_backup.tsv | clickhouse-client --query "INSERT INTO
test_backup FORMAT TSV"
- 快照表备份
CREATE TABLE test_backup_0206 AS test_backup
INSERT INTO TABLE test_backup_0206 SELECT * FROM test_backup
INSERT INTO TABLE test_backup_0206 SELECT * FROM remote('ch5.nauu.com:9000','default', 'test_backup', 'default')
- 按分区备份
ALTER TABLE tb_name FREEZE PARTITION partition_expr
ALTER TABLE tb_name FETCH PARTITION partition_id FROM zk_path
ALTER TABLE test_fetch FETCH PARTITION 2019 FROM
'/clickhouse/tables/01/test_fetch'
data/default/test_fetch/detached
服务监控
- 系统表
SELECT * FROM system.metrics LIMIT 5
SELECT event, value FROM system.events LIMIT 5
SELECT * FROM system.asynchronous_metrics LIMIT 5
- 查询日志
<query_log>
<database>system</database>
<table>query_log</table>
<partition_by>toYYYYMM(event_date)</partition_by>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
</query_log>
SELECT type,concat(substr(query,1,20),'...')query,read_rows,
query_duration_ms AS duration FROM system.query_log LIMIT 6