Search code examples
clickhouse

Do I have to monitor ClickHouse replica leader state?


According to official docs of ClickHouse there's the request for monitoring that could inform me if something wrong with my replica.

SELECT
    database,
    table,
    is_leader,
    is_readonly,
    is_session_expired,
    future_parts,
    parts_to_check,
    columns_version,
    queue_size,
    inserts_in_queue,
    merges_in_queue,
    log_max_index,
    log_pointer,
    total_replicas,
    active_replicas
FROM system.replicas
WHERE
       is_readonly
    OR is_session_expired
    OR future_parts > 20
    OR parts_to_check > 10
    OR queue_size > 20
    OR inserts_in_queue > 10
    OR log_max_index - log_pointer > 10
    OR total_replicas < 2
    OR active_replicas < total_replicas

Have I additionaly monitoring leader state of my replica? What happens with replica if leader get down and there's no one node which could be leader instead (can_become_leader: 0)?


Solution

  • What happens with replica if leader get down and there's no one node which could be leader instead (can_become_leader: 0)?

    Merges and mutations will stop. You will get the error "too many parts".