You need to enable JavaScript to run this app.
导航
ha_replicas
最近更新时间:2025.07.02 15:12:58首次发布时间:2025.07.02 15:12:58
我的收藏
有用
有用
无用
无用

ha_replicas 系统表展示了 HamergeTree 表的具体状态。

列名

字段名称

数据类型

字段含义说明

is_leader

UInt8

是否是 leader。

can_become_leader

UInt8

能否可以成为 leader。

is_readonly

UInt8

表是否是 readonly 的状态。

is_session_expired

UInt8

到 Zookeeper 的连接是不是超时了。

is_lost

UInt8

表是不是处于 is_lost 的状态。

is_offline

UInt8

表是不是处于 is_offline 的状态。

zookeeper_path

String

Zookeeper 的路径。

replica_name

String

副本名称。

replica_path

String

表在 Zookeeper 上对应的 node 的路径。

queue_size

UInt32

表目前有多少未完成的 log entry。

clones_in_queue

UInt32

未完成的 log entry 里有多少 clone_part。clone_part 会导致 absolute_delay 为 864000。

inserts_in_queue

UInt32

未完成的 log entry 里有多少 get_part。

merges_in_queue

UInt32

未完成的 log entry 里有多少 merge。

part_mutations_in_queue

UInt32

未完成的 log entry 里有多少 mutate_part。

committed_lsn

UInt64

整个 shard 下不同节点的表都完成了的 lsn。

updated_lsn

UInt64

该节点的表自己完成的 lsn。

latest_lsn

UInt64

整个 shard 新申请的 lsn。

absolute_delay

UInt64

该节点上最老的、未执行的 get_part/replace_range 的创建时间到现在时间的 delay,查询会路由到 delay 值最小的那个节点。

active_replicas

UInt8

该 shard 下目前有几个 active 的节点。

main_log_file_status

String

该表的主 log.bin 的状态是否健康。

mirror_log_file_status

String

该表的备 log.bin 的状态是否健康。

示例

select * from system.ha_replicas where table = 'test_table' and database = 'test'
Row 1:
──────
database:                    test
table:                       test_table
engine:                      HaMergeTree
is_leader:                   1
can_become_leader:           1
is_readonly:                 0
is_session_expired:          0
is_lost:                     0
is_offline:                  0
zookeeper_path:              /clickhouse/id/clustername/xxx/shard_0
replica_name:                192.18.x.x
replica_path:                /clickhouse/id/clustename/xxx/xxx/replicas/192.18.x.x
queue_size:                  0
clones_in_queue:             0
inserts_in_queue:            0
merges_in_queue:             0
merges_of_self:              0
part_mutations_in_queue:     0
part_mutations_of_self:      0
last_queue_update:           2025-06-09 21:22:22
queue_oldest_time:           1970-01-01 08:00:00
clones_oldest_time:          1970-01-01 08:00:00
inserts_oldest_time:         1970-01-01 08:00:00
merges_oldest_time:          1970-01-01 08:00:00
part_mutations_oldest_time:  1970-01-01 08:00:00
oldest_part_to_clone:       
oldest_part_to_get:      
oldest_part_to_merge_to:      
oldest_part_to_mutate_to:     
parts_to_check:              0
committed_lsn:               0
updated_lsn:                 0
latest_lsn:                  0
absolute_delay:              0
total_active_rows:           0
total_replicas:              2
active_replicas:             1
main_log_file_status:        Healthy
mirror_log_file_status:      Healthy