zookeeper
| Setting | Description |
|---|---|
node | ZooKeeper 端点。你可以设置多个端点。例如:<node index="1"><host>example_host</host><port>2181</port></node>。index 属性指定尝试连接 ZooKeeper 集群时各节点的顺序。 |
operation_timeout_ms | 单个操作的最大超时时间 (以毫秒为单位) 。 |
session_timeout_ms | 客户端会话的最大超时时间 (以毫秒为单位) 。 |
root (optional) | 作为 ClickHouse 服务器 所使用 znode 根节点的 znode。 |
fallback_session_lifetime.min (optional) | 当主节点不可用时,连接到回退节点的 ZooKeeper 会话生命周期下限 (负载均衡) 。以秒为单位。默认值:3 小时。 |
fallback_session_lifetime.max (optional) | 当主节点不可用时,连接到回退节点的 ZooKeeper 会话生命周期上限 (负载均衡) 。以秒为单位。默认值:6 小时。 |
identity (optional) | 访问所请求 znode 时 ZooKeeper 所需的用户名和密码。 |
use_compression (optional) | 如果设置为 true,则在 Keeper 协议中启用压缩。 |
use_xid_64 (optional) | 启用 64 位事务 ID。设置为 true 以启用扩展事务 ID 格式。默认值:false。 |
pass_opentelemetry_tracing_context (optional) | 启用将 OpenTelemetry 链路追踪上下文传播到 Keeper 请求。启用后,将为 Keeper 操作创建 tracing spans,从而实现跨 ClickHouse 和 Keeper 的分布式链路追踪。更多详情请参见 Tracing ClickHouse Keeper Requests。默认值:false。 |
zookeeper_load_balancing 设置 (可选) ,可用于选择 ZooKeeper 节点的选择算法:
| Algorithm Name | Description |
|---|---|
random | 随机选择一个 ZooKeeper 节点。 |
in_order | 选择第一个 ZooKeeper 节点;如果它不可用,则选择第二个,依此类推。 |
nearest_hostname | 选择 hostname 与 server 的 hostname 最相近的 ZooKeeper 节点,比较方式为名称前缀。 |
hostname_levenshtein_distance | 与 nearest_hostname 类似,但按 Levenshtein distance 的方式比较 hostname。 |
first_or_random | 选择第一个 ZooKeeper 节点;如果它不可用,则从剩余的 ZooKeeper 节点中随机选择一个。 |
round_robin | 选择第一个 ZooKeeper 节点;如果发生重新连接,则选择下一个。 |
<zookeeper>
<node>
<host>example1</host>
<port>2181</port>
</node>
<node>
<host>example2</host>
<port>2181</port>
</node>
<session_timeout_ms>30000</session_timeout_ms>
<operation_timeout_ms>10000</operation_timeout_ms>
<!-- Optional. Chroot suffix. Should exist. -->
<root>/path/to/zookeeper/node</root>
<!-- Optional. Zookeeper digest ACL string. -->
<identity>user:password</identity>
<!--<zookeeper_load_balancing>random / in_order / nearest_hostname / hostname_levenshtein_distance / first_or_random / round_robin</zookeeper_load_balancing>-->
<zookeeper_load_balancing>random</zookeeper_load_balancing>
<!-- Optional. Enable 64-bit transaction IDs. -->
<use_xid_64>false</use_xid_64>
<!-- Optional. Enable OpenTelemetry tracing context propagation. -->
<pass_opentelemetry_tracing_context>false</pass_opentelemetry_tracing_context>
</zookeeper>
zookeeper_log
zookeeper_log 系统表的相关设置。
以下设置可通过子标签配置:
以下设置可通过子标签配置:
| Setting | Description | Default | Note |
|---|---|---|---|
database | 数据库名称。 | ||
table | 系统表名称。 | ||
engine | 系统表的 MergeTree 引擎定义。 | 如果已定义 partition_by 或 order_by,则不能使用。如果未指定,默认使用 MergeTree | |
partition_by | 系统表的 自定义分区键。 | 如果为系统表指定了 engine,则应直接在 ‘engine’ 内指定 partition_by 参数 | |
ttl | 指定表的 生存时间 (TTL)。 | 如果为系统表指定了 engine,则应直接在 ‘engine’ 内指定 ttl 参数 | |
order_by | 系统表的 自定义排序键。如果定义了 engine,则不能使用。 | 如果为系统表指定了 engine,则应直接在 ‘engine’ 内指定 order_by 参数 | |
storage_policy | 该表使用的存储策略名称 (可选) 。 | 如果为系统表指定了 engine,则应直接在 ‘engine’ 内指定 storage_policy 参数 | |
settings | 控制 MergeTree 行为的附加参数 (可选) 。 | 如果为系统表指定了 engine,则应直接在 ‘engine’ 内指定 settings 参数 | |
flush_interval_milliseconds | 将数据从内存缓冲区刷写到表的时间间隔。 | 7500 | |
max_size_rows | 日志的最大行数。当未刷写的日志数量达到 max_size 时,日志会被转储到磁盘。 | 1048576 | |
reserved_size_rows | 为日志预分配的内存行数。 | 8192 | |
buffer_size_rows_flush_threshold | 行数阈值。达到该阈值后,会在后台启动将日志刷写到磁盘的操作。 | max_size_rows / 2 | |
flush_on_crash | 设置在发生崩溃时是否将日志转储到磁盘。 | false |
<default_system_log_flush_policy>
<skip_alias_columns>true</skip_alias_columns>
</default_system_log_flush_policy>
| 设置 | 描述 | 默认值 |
|---|---|---|
skip_alias_columns | 为 true 时,系统日志表的 schema 中会省略 ALIAS 列。S3 支持的系统日志需要启用此项。 | false |
<clickhouse>
<zookeeper_log>
<database>system</database>
<table>zookeeper_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<ttl>event_date + INTERVAL 1 WEEK DELETE</ttl>
</zookeeper_log>
</clickhouse>