clickhouse之readonly解决方法

1,问题描述
日志报错写入ck报错:ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, code: 1002, host: 192.16.1.19, port: 8123; Code: 242. DB::Exception: Table is in readonly mode: replica_path=/clickhouse/tables/datap_one_rep/db_com_aaa/dwd_visit_users_log_local/2/replicas/everdata19. (TABLE_IS_READ_ONLY) (version 23.2.5.46 (official build))
2,问题排查
SELECT
table,
zookeeper_path,
replica_path
FROM clusterAllReplicas(‘eversec_one_rep’, ‘system’, ‘replicas’)
WHERE is_readonly ;
clickhouse之readonly解决方法_第1张图片
找到readonly的节点后,登录到对应的节点上执行一下操作
例如19节点:
1,)DETACH TABLE 库名.表名;

2)SYSTEM DROP REPLICA ‘ever19’ FROM ZKPATH ‘/clickhouse/tables/ever_one_rep/db_com_pingan/表名/2’;

3)ATTACH TABLE d库名.表名;

4) SYSTEM RESTORE REPLICA 库名.表名;

5)SYSTEM SYNC REPLICA 库名.表名;

你可能感兴趣的:(clickhouse,linux,运维)