全局服务器设置
本节包含服务器设置的描述,这些设置无法在会话或查询级别更改。这些设置存储在 ClickHouse 服务器上的 config.xml
文件中。有关 ClickHouse 中配置文件的更多信息,请参阅“配置文件”。
其他设置在“设置”部分中描述。在研究设置之前,我们建议阅读配置文件部分,并注意替换的使用(incl
和 optional
属性)。
allow_use_jemalloc_memory
允许使用 jemalloc 内存。
类型: Bool
默认值: 1
asynchronous_heavy_metrics_update_period_s
异步指标更新的周期,以秒为单位。
类型: UInt32
默认值: 120
asynchronous_metric_log
在 ClickHouse Cloud 部署上默认启用。
如果您的环境中默认未启用此设置,您可以根据 ClickHouse 的安装方式,按照以下说明启用或禁用它。
启用
要手动开启异步指标日志历史记录收集 system.asynchronous_metric_log
,创建 /etc/clickhouse-server/config.d/asynchronous_metric_log.xml
文件,内容如下
<clickhouse>
<asynchronous_metric_log>
<database>system</database>
<table>asynchronous_metric_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<collect_interval_milliseconds>1000</collect_interval_milliseconds>
<max_size_rows>1048576</max_size_rows>
<reserved_size_rows>8192</reserved_size_rows>
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
<flush_on_crash>false</flush_on_crash>
</asynchronous_metric_log>
</clickhouse>
禁用
要禁用 asynchronous_metric_log
设置,您应该创建以下文件 /etc/clickhouse-server/config.d/disable_asynchronous_metric_log.xml
,内容如下
<clickhouse>
<asynchronous_metric_log remove="1" />
</clickhouse>
asynchronous_metrics_update_period_s
异步指标更新的周期,以秒为单位。
类型: UInt32
默认值: 1
auth_use_forwarded_address
对于通过代理连接的客户端,使用原始地址进行身份验证。
此设置应格外谨慎使用,因为转发的地址很容易被欺骗 - 接受此类身份验证的服务器不应直接访问,而应完全通过受信任的代理访问。
类型: Bool
默认值: 0
background_buffer_flush_schedule_pool_size
用于在后台为 Buffer 引擎表 执行刷新操作的最大线程数。
类型: UInt64
默认值: 16
background_common_pool_size
用于在后台为 *MergeTree 引擎 表执行各种操作(主要是垃圾回收)的最大线程数。
类型: UInt64
默认值: 8
background_distributed_schedule_pool_size
用于执行分布式发送的最大线程数。
类型: UInt64
默认值: 16
background_fetches_pool_size
用于在后台为 *MergeTree 引擎 表从另一个副本获取数据部分的最大线程数。
类型: UInt64
默认值: 16
background_merges_mutations_concurrency_ratio
设置线程数与可以并发执行的后台合并和 mutation 操作数量之间的比率。
例如,如果比率等于 2 并且 background_pool_size
设置为 16,则 ClickHouse 可以并发执行 32 个后台合并操作。这是可能的,因为后台操作可能会被暂停和延迟。这是为了给小型合并操作更高的执行优先级。
您只能在运行时增加此比率。要降低它,您必须重启服务器。
与 background_pool_size
设置一样,background_merges_mutations_concurrency_ratio
可以从 default
配置文件中应用,以实现向后兼容。
类型: Float
默认值: 2
background_merges_mutations_scheduling_policy
关于如何为后台合并和 mutation 操作执行调度的策略。可能的值为:round_robin
和 shortest_task_first
。
用于选择要由后台线程池执行的下一个合并或 mutation 操作的算法。策略可以在运行时更改,无需重启服务器。可以从 default
配置文件中应用,以实现向后兼容。
可能的值
round_robin
— 每个并发的合并和 mutation 操作都以轮询顺序执行,以确保无饥饿操作。较小的合并操作比大的合并操作完成得更快,仅仅是因为它们需要合并的块更少。shortest_task_first
— 始终执行较小的合并或 mutation 操作。合并和 mutation 操作根据其结果大小分配优先级。尺寸较小的合并操作严格优先于尺寸较大的合并操作。此策略确保尽可能快地合并小部分,但可能导致在被INSERT
操作严重超载的分区中,大型合并操作无限期地处于饥饿状态。
类型: String
默认值: round_robin
background_message_broker_schedule_pool_size
用于执行消息流式传输的后台操作的最大线程数。
类型: UInt64
默认值: 16
background_move_pool_size
用于在后台将数据部分移动到 *MergeTree 引擎表的另一个磁盘或卷的最大线程数。
类型: UInt64
默认值: 8
background_schedule_pool_size
用于持续执行复制表、Kafka 流式传输和 DNS 缓存更新的一些轻量级定期操作的最大线程数。
类型: UInt64
默认值: 512
backup_threads
执行 BACKUP
请求的最大线程数。
类型: UInt64
默认值: 16
backups_io_thread_pool_queue_size
可以在 Backups IO 线程池上调度的最大作业数。建议保持此队列无限制,因为当前的 S3 备份逻辑。
值 0
(默认值)表示无限制。
类型: UInt64
默认值: 0
cache_size_to_ram_max_ratio
设置缓存大小与 RAM 最大比率。允许在低内存系统上降低缓存大小。
类型: Double
默认值: 0.5
concurrent_threads_soft_limit_num
查询处理线程的最大数量,不包括从远程服务器检索数据的线程,允许运行所有查询。这不是硬性限制。如果达到限制,查询仍然会获得至少一个线程来运行。如果更多线程可用,查询可以在执行期间扩展到所需的线程数。
值 0
(默认值)表示无限制。
类型: UInt64
默认值: 0
concurrent_threads_soft_limit_ratio_to_cores
与 concurrent_threads_soft_limit_num
相同,但使用与核心的比率。
类型: UInt64
默认值: 0
default_database
默认数据库名称。
类型: String
默认值: default
disable_internal_dns_cache
禁用内部 DNS 缓存。建议在基础设施频繁变化的系统(如 Kubernetes)中运行 ClickHouse 时使用。
类型: Bool
默认值: 0
dns_cache_max_entries
内部 DNS 缓存最大条目数。
类型: UInt64
默认值: 10000
dns_cache_update_period
内部 DNS 缓存更新周期,以秒为单位。
类型: Int32
默认值: 15
dns_max_consecutive_failures
在从 ClickHouse DNS 缓存中删除主机之前,最大连续解析失败次数
类型: UInt32
默认值: 10
index_mark_cache_policy
索引标记缓存策略名称。
类型: String
默认值: SLRU
index_mark_cache_size
索引标记缓存的最大大小。
值 0
表示禁用。
此设置可以在运行时修改,并将立即生效。
类型: UInt64
默认值: 0
index_mark_cache_size_ratio
索引标记缓存中受保护队列的大小(在 SLRU 策略的情况下),相对于缓存的总大小。
类型: Double
默认值: 0.5
index_uncompressed_cache_policy
索引未压缩缓存策略名称。
类型: String
默认值: SLRU
index_uncompressed_cache_size
MergeTree
索引的未压缩块的缓存最大大小。
值 0
表示禁用。
此设置可以在运行时修改,并将立即生效。
类型: UInt64
默认值: 0
index_uncompressed_cache_size_ratio
索引未压缩缓存中受保护队列的大小(在 SLRU 策略的情况下),相对于缓存的总大小。
类型: Double
默认值: 0.5
skipping_index_cache_policy
跳过索引缓存策略名称。
类型: String
默认值: SLRU
skipping_index_cache_size
跳过索引的缓存大小。零表示禁用。
此设置可以在运行时修改,并将立即生效。
类型: UInt64
默认值: 5368709120 (= 5 GiB)
skipping_index_cache_size_ratio
跳过索引缓存中受保护队列的大小(在 SLRU 策略的情况下),相对于缓存的总大小。
类型: Double
默认值: 0.5
skipping_index_cache_max_entries
跳过索引缓存中的最大条目数。
类型: UInt64
默认值: 10000000
io_thread_pool_queue_size
可以在 IO 线程池上调度的最大作业数。
值 0
表示无限制。
类型: UInt64
默认值: 10000
mark_cache_policy
标记缓存策略名称。
类型: String
默认值: SLRU
mark_cache_size
标记的缓存最大大小(MergeTree
系列表的索引)。
此设置可以在运行时修改,并将立即生效。
类型: UInt64
默认值: 5368709120
mark_cache_size_ratio
标记缓存中受保护队列的大小(在 SLRU 策略的情况下),相对于缓存的总大小。
类型: Double
默认值: 0.5
max_backup_bandwidth_for_server
服务器上所有备份的最大读取速度,以字节/秒为单位。零表示无限制。
类型: UInt64
默认值: 0
max_backups_io_thread_pool_free_size
如果 Backups IO 线程池中空闲线程的数量超过 max_backup_io_thread_pool_free_size
,ClickHouse 将释放空闲线程占用的资源并减小池大小。如有必要,可以再次创建线程。
类型: UInt64
默认值: 0
max_backups_io_thread_pool_size
ClickHouse 使用 Backups IO 线程池中的线程来执行 S3 备份 IO 操作。max_backups_io_thread_pool_size
限制池中的最大线程数。
类型: UInt64
默认值: 1000
max_concurrent_queries
并发执行查询的总数限制。请注意,还必须考虑对 INSERT
和 SELECT
查询的限制,以及对用户的最大查询数限制。
另请参阅
值 0
(默认值)表示无限制。
此设置可以在运行时修改,并将立即生效。已经运行的查询将保持不变。
类型: UInt64
默认值: 0
max_concurrent_insert_queries
并发插入查询的总数限制。
值 0
(默认值)表示无限制。
此设置可以在运行时修改,并将立即生效。已经运行的查询将保持不变。
类型: UInt64
默认值: 0
max_concurrent_select_queries
并发选择查询的总数限制。
值 0
(默认值)表示无限制。
此设置可以在运行时修改,并将立即生效。已经运行的查询将保持不变。
类型: UInt64
默认值: 0
max_waiting_queries
并发等待查询的总数限制。当异步加载所需表时,等待查询的执行被阻止(请参阅 async_load_databases
)。
在检查由以下设置控制的限制时,不计算等待查询
max_concurrent_queries
max_concurrent_insert_queries
max_concurrent_select_queries
max_concurrent_queries_for_user
max_concurrent_queries_for_all_users
进行此更正是为了避免在服务器启动后立即达到这些限制。
值 0
(默认值)表示无限制。
此设置可以在运行时修改,并将立即生效。已经运行的查询将保持不变。
类型: UInt64
默认值: 0
max_connections
最大服务器连接数。
类型: Int32
默认值: 1024
max_io_thread_pool_free_size
如果 IO 线程池中空闲线程的数量超过 max_io_thread_pool_free_size
,ClickHouse 将释放空闲线程占用的资源并减小池大小。如有必要,可以再次创建线程。
类型: UInt64
默认值: 0
max_io_thread_pool_size
ClickHouse 使用 IO 线程池中的线程来执行某些 IO 操作(例如,与 S3 交互)。max_io_thread_pool_size
限制池中的最大线程数。
类型: UInt64
默认值: 100
max_local_read_bandwidth_for_server
本地读取的最大速度,以字节/秒为单位。
值 0
表示无限制。
类型: UInt64
默认值: 0
max_local_write_bandwidth_for_server
本地写入的最大速度,以字节/秒为单位。
值 0
表示无限制。
类型: UInt64
默认值: 0
max_partition_size_to_drop
删除分区的限制。
如果 MergeTree 表的大小超过 max_partition_size_to_drop
(以字节为单位),则无法使用 DROP PARTITION 查询删除分区。此设置不需要重启 ClickHouse 服务器即可应用。禁用限制的另一种方法是创建 <clickhouse-path>/flags/force_drop_table
文件。
示例
<max_partition_size_to_drop>0</max_partition_size_to_drop>
类型: UInt64
默认值: 50
max_remote_read_network_bandwidth_for_server
网络数据交换的最大速度,以字节/秒为单位,用于读取。
值 0
(默认值)表示无限制。
类型: UInt64
默认值: 0
max_remote_write_network_bandwidth_for_server
网络数据交换的最大速度,以字节/秒为单位,用于写入。
值 0
(默认值)表示无限制。
类型: UInt64
默认值: 0
max_server_memory_usage
总内存使用量的限制。默认的 max_server_memory_usage
值计算为 memory_amount * max_server_memory_usage_to_ram_ratio
。
值 0
(默认值)表示无限制。
类型: UInt64
默认值: 0
max_server_memory_usage_to_ram_ratio
与 max_server_memory_usage
相同,但以物理 RAM 的比率表示。允许在低内存系统上降低内存使用率。
在 RAM 和交换空间较低的主机上,您可能需要将 max_server_memory_usage_to_ram_ratio
设置为大于 1 的值。
值 0
表示无限制。
类型: Double
默认值: 0.9
max_build_vector_similarity_index_thread_pool_size
用于构建向量索引的最大线程数。
值 0
表示所有核心。
类型: UInt64
默认值: 16
cgroups_memory_usage_observer_wait_time
服务器允许的最大内存消耗由 cgroups 中的相应阈值调整的时间间隔,以秒为单位。
要禁用 cgroup 观察器,请将此值设置为 0
。
请参阅设置
类型: UInt64
默认值: 15
cgroup_memory_watcher_hard_limit_ratio
指定服务器进程根据 cgroups 的内存消耗的“硬”阈值,超过该阈值后,服务器的最大内存消耗将调整为阈值。
请参阅设置
类型: Double
默认值: 0.95
cgroup_memory_watcher_soft_limit_ratio
指定服务器进程根据 cgroups 的内存消耗的“软”阈值,超过该阈值后,jemalloc 中的 arena 将被清除。
请参阅设置
类型: Double
默认值: 0.9
max_database_num_to_warn
如果附加的数据库数量超过指定值,clickhouse 服务器将向 system.warnings
表添加警告消息。
示例
<max_database_num_to_warn>50</max_database_num_to_warn>
类型
默认值: 1000
max_table_num_to_warn
如果附加的表数量超过指定值,clickhouse 服务器将向 system.warnings
表添加警告消息。
示例
<max_table_num_to_warn>400</max_table_num_to_warn>
默认值: 5000
max_view_num_to_warn
如果附加的视图数量超过指定值,clickhouse 服务器将向 system.warnings
表添加警告消息。
示例
<max_view_num_to_warn>400</max_view_num_to_warn>
类型: UInt64
默认值: 10000
max_dictionary_num_to_warn
如果附加的字典数量超过指定值,ClickHouse 服务器将向 system.warnings
表添加警告消息。
示例
<max_dictionary_num_to_warn>400</max_dictionary_num_to_warn>
类型: UInt64
默认值: 1000
max_part_num_to_warn
如果活跃 part 的数量超过指定值,ClickHouse 服务器将向 system.warnings
表添加警告消息。
示例
<max_part_num_to_warn>400</max_part_num_to_warn>
类型: UInt64
默认值: 100000
max_table_num_to_throw
如果表的数量大于此值,服务器将抛出异常。
以下类型的表不计数
- view (视图)
- remote (远程表)
- dictionary (字典)
- system (系统表)
仅计数以下数据库引擎的表
- Atomic (原子引擎)
- Ordinary (普通引擎)
- Replicated (复制引擎)
- Lazy (延迟引擎)
值为 0
表示没有限制。
示例
<max_table_num_to_throw>400</max_table_num_to_throw>
类型: UInt64
默认值: 0
max_replicated_table_num_to_throw
如果复制表的数量大于此值,服务器将抛出异常。
仅计数以下数据库引擎的表
- Atomic (原子引擎)
- Ordinary (普通引擎)
- Replicated (复制引擎)
- Lazy (延迟引擎)
值为 0
表示没有限制。
示例
<max_replicated_table_num_to_throw>400</max_replicated_table_num_to_throw>
类型: UInt64
默认值: 0
max_dictionary_num_to_throw
如果字典的数量大于此值,服务器将抛出异常。
仅计数以下数据库引擎的表
- Atomic (原子引擎)
- Ordinary (普通引擎)
- Replicated (复制引擎)
- Lazy (延迟引擎)
值为 0
表示没有限制。
示例
<max_dictionary_num_to_throw>400</max_dictionary_num_to_throw>
类型: UInt64
默认值: 0
max_view_num_to_throw
如果视图的数量大于此值,服务器将抛出异常。
仅计数以下数据库引擎的表
- Atomic (原子引擎)
- Ordinary (普通引擎)
- Replicated (复制引擎)
- Lazy (延迟引擎)
值为 0
表示没有限制。
示例
<max_view_num_to_throw>400</max_view_num_to_throw>
类型: UInt64
默认值: 0
max_database_num_to_throw
如果数据库的数量大于此值,服务器将抛出异常。
值为 0
(默认值) 表示没有限制。
示例
<max_database_num_to_throw>400</max_database_num_to_throw>
类型: UInt64
默认值: 0
max_temporary_data_on_disk_size
用于外部聚合、连接或排序的最大磁盘存储量。超过此限制的查询将失败并抛出异常。
值 0
表示无限制。
另请参阅
类型: UInt64
默认值: 0
max_thread_pool_free_size
如果全局线程池中空闲线程的数量大于 max_thread_pool_free_size
,则 ClickHouse 会释放某些线程占用的资源,并且池大小会减小。如有必要,可以再次创建线程。
示例
<max_thread_pool_free_size>1200</max_thread_pool_free_size>
类型: UInt64
默认值: 0
max_thread_pool_size
ClickHouse 使用全局线程池中的线程来处理查询。如果没有空闲线程来处理查询,则会在池中创建一个新线程。max_thread_pool_size
限制了池中线程的最大数量。
示例
<max_thread_pool_size>12000</max_thread_pool_size>
类型: UInt64
默认值: 10000
mmap_cache_size
设置映射文件缓存的大小(以字节为单位)。此设置允许避免频繁的打开/关闭调用(由于随后的页面错误,这些调用非常昂贵),并允许从多个线程和查询重用映射。设置值是映射区域的数量(通常等于映射文件的数量)。
映射文件中的数据量可以在以下系统表中通过以下指标进行监控
系统表 | 指标 |
---|---|
system.metrics 和 system.metric_log | MMappedFiles 和 MMappedFileBytes |
system.asynchronous_metrics_log | MMapCacheCells |
system.events , system.processes , system.query_log , system.query_thread_log , system.query_views_log | CreatedReadBufferMMap , CreatedReadBufferMMapFailed , MMappedFileCacheHits , MMappedFileCacheMisses |
映射文件中的数据量不会直接消耗内存,也不会计入查询或服务器内存使用量 — 因为此内存可以像操作系统页面缓存一样被丢弃。当删除 MergeTree 系列表中的旧 part 时,缓存会自动删除(文件会被关闭),也可以通过 SYSTEM DROP MMAP CACHE
查询手动删除。
此设置可以在运行时修改,并将立即生效。
类型: UInt64
默认值: 1000
restore_threads
执行 RESTORE 请求的最大线程数。
类型: UInt64
默认值: 16
show_addresses_in_stack_traces
如果设置为 true,将在堆栈跟踪中显示地址
类型: Bool
默认值: 1
shutdown_wait_unfinished_queries
如果设置为 true,ClickHouse 将在关闭前等待正在运行的查询完成。
类型: Bool
默认值: 0
table_engines_require_grant
如果设置为 true,用户需要授权才能使用特定的引擎创建表,例如 GRANT TABLE ENGINE ON TinyLog to user
。
默认情况下,为了向后兼容,使用特定表引擎创建表会忽略授权,但是您可以通过将此项设置为 true 来更改此行为。
类型: Bool
默认值: false
temporary_data_in_cache
使用此选项,临时数据将存储在特定磁盘的缓存中。在本节中,您应该指定类型为 cache
的磁盘名称。在这种情况下,缓存和临时数据将共享相同的空间,并且可以驱逐磁盘缓存以创建临时数据。
只能使用一个选项来配置临时数据存储:tmp_path
、tmp_policy
、 temporary_data_in_cache
。
示例
local_disk
的缓存和临时数据都将存储在文件系统上的 /tiny_local_cache
中,由 tiny_local_cache
管理。
<clickhouse>
<storage_configuration>
<disks>
<local_disk>
<type>local</type>
<path>/local_disk/</path>
</local_disk>
<tiny_local_cache>
<type>cache</type>
<disk>local_disk</disk>
<path>/tiny_local_cache/</path>
<max_size_rows>10M</max_size_rows>
<max_file_segment_size>1M</max_file_segment_size>
<cache_on_write_operations>1</cache_on_write_operations>
</tiny_local_cache>
</disks>
</storage_configuration>
<temporary_data_in_cache>tiny_local_cache</temporary_data_in_cache>
</clickhouse>
类型: String
默认值: ""
thread_pool_queue_size
全局线程池上可以调度的最大作业数。增加队列大小会导致更大的内存使用量。建议将此值保持等于 max_thread_pool_size
。
值 0
表示无限制。
示例
<thread_pool_queue_size>12000</thread_pool_queue_size>
类型: UInt64
默认值: 10000
tmp_policy
用于存储临时数据的策略。有关更多信息,请参阅 MergeTree 表引擎 文档。
- 只能使用一个选项来配置临时数据存储:
tmp_path
、tmp_policy
、temporary_data_in_cache
。 move_factor
,keep_free_space_bytes
,max_data_part_size_bytes
将被忽略。- 策略应恰好具有一个卷,其中包含本地磁盘。
示例
当 /disk1
已满时,临时数据将存储在 /disk2
上。
<clickhouse>
<storage_configuration>
<disks>
<disk1>
<path>/disk1/</path>
</disk1>
<disk2>
<path>/disk2/</path>
</disk2>
</disks>
<policies>
<tmp_two_disks>
<volumes>
<main>
<disk>disk1</disk>
<disk>disk2</disk>
</main>
</volumes>
</tmp_two_disks>
</policies>
</storage_configuration>
<tmp_policy>tmp_two_disks</tmp_policy>
</clickhouse>
类型: String
默认值: ""
uncompressed_cache_policy
未压缩缓存策略名称。
类型: String
默认值: SLRU
uncompressed_cache_size
MergeTree 系列表引擎使用的未压缩数据的最大缓存大小(以字节为单位)。
服务器有一个共享缓存。内存按需分配。如果启用了 use_uncompressed_cache 选项,则使用缓存。
对于个别情况下的非常短的查询,未压缩缓存是有利的。
值 0
表示禁用。
此设置可以在运行时修改,并将立即生效。
类型: UInt64
默认值: 0
uncompressed_cache_size_ratio
未压缩缓存中受保护队列(在 SLRU 策略的情况下)相对于缓存总大小的大小。
类型: Double
默认值: 0.5
builtin_dictionaries_reload_interval
重新加载内置字典的间隔(秒)。
ClickHouse 每隔 x 秒重新加载内置字典。这使得无需重启服务器即可“动态”编辑字典。
示例
<builtin_dictionaries_reload_interval>3600</builtin_dictionaries_reload_interval>
类型: UInt64
默认值: 3600
compression
MergeTree 引擎表的数据压缩设置。
如果您刚开始使用 ClickHouse,建议不要更改此项。
配置模板:
<compression>
<case>
<min_part_size>...</min_part_size>
<min_part_size_ratio>...</min_part_size_ratio>
<method>...</method>
<level>...</level>
</case>
...
</compression>
<case>
字段:
min_part_size
– 数据 part 的最小大小。min_part_size_ratio
– 数据 part 大小与表大小的比率。method
– 压缩方法。可接受的值:lz4
,lz4hc
,zstd
,deflate_qpl
。level
– 压缩级别。请参阅 Codecs。
您可以配置多个 <case>
部分。
满足条件时的操作:
- 如果数据 part 符合设置的条件,ClickHouse 将使用指定的压缩方法。
- 如果数据 part 符合多个条件集,ClickHouse 将使用第一个匹配的条件集。
如果数据 part 不符合任何条件,ClickHouse 将使用 lz4
压缩。
示例
<compression incl="clickhouse_compression">
<case>
<min_part_size>10000000000</min_part_size>
<min_part_size_ratio>0.01</min_part_size_ratio>
<method>zstd</method>
<level>1</level>
</case>
</compression>
encryption
配置一个命令来获取 加密编解码器 使用的密钥。密钥(或多个密钥)应写入环境变量或在配置文件中设置。
密钥可以是十六进制或长度为 16 字节的字符串。
示例
从配置加载
<encryption_codecs>
<aes_128_gcm_siv>
<key>1234567812345678</key>
</aes_128_gcm_siv>
</encryption_codecs>
不建议将密钥存储在配置文件中。这不安全。您可以将密钥移动到安全磁盘上的单独配置文件中,并将指向该配置文件的符号链接放到 config.d/
文件夹中。
从配置加载,当密钥为十六进制时
<encryption_codecs>
<aes_128_gcm_siv>
<key_hex>00112233445566778899aabbccddeeff</key_hex>
</aes_128_gcm_siv>
</encryption_codecs>
从环境变量加载密钥
<encryption_codecs>
<aes_128_gcm_siv>
<key_hex from_env="ENVVAR"></key_hex>
</aes_128_gcm_siv>
</encryption_codecs>
此处 current_key_id
设置当前加密密钥,所有指定的密钥都可以用于解密。
这些方法中的每一种都可以应用于多个密钥
<encryption_codecs>
<aes_128_gcm_siv>
<key_hex id="0">00112233445566778899aabbccddeeff</key_hex>
<key_hex id="1" from_env="ENVVAR"></key_hex>
<current_key_id>1</current_key_id>
</aes_128_gcm_siv>
</encryption_codecs>
此处 current_key_id
显示当前加密密钥。
此外,用户可以添加 nonce,nonce 必须为 12 字节长(默认情况下,加密和解密过程使用由零字节组成的 nonce)
<encryption_codecs>
<aes_128_gcm_siv>
<nonce>012345678910</nonce>
</aes_128_gcm_siv>
</encryption_codecs>
或者可以设置为十六进制
<encryption_codecs>
<aes_128_gcm_siv>
<nonce_hex>abcdefabcdef</nonce_hex>
</aes_128_gcm_siv>
</encryption_codecs>
上面提到的所有内容都可以应用于 aes_256_gcm_siv
(但密钥必须为 32 字节长)。
error_log
默认情况下禁用。
启用
要手动开启错误历史记录收集 system.error_log
,请创建包含以下内容的 /etc/clickhouse-server/config.d/error_log.xml
<clickhouse>
<error_log>
<database>system</database>
<table>error_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<collect_interval_milliseconds>1000</collect_interval_milliseconds>
<max_size_rows>1048576</max_size_rows>
<reserved_size_rows>8192</reserved_size_rows>
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
<flush_on_crash>false</flush_on_crash>
</error_log>
</clickhouse>
禁用
要禁用 error_log
设置,您应该创建包含以下内容的以下文件 /etc/clickhouse-server/config.d/disable_error_log.xml
<clickhouse>
<error_log remove="1" />
</clickhouse>
custom_settings_prefixes
自定义设置 的前缀列表。前缀必须用逗号分隔。
示例
<custom_settings_prefixes>custom_</custom_settings_prefixes>
另请参阅
core_dump
配置 core dump 文件大小的软限制。
硬限制通过系统工具配置
示例
<core_dump>
<size_limit>1073741824</size_limit>
</core_dump>
默认值: 1073741824
database_atomic_delay_before_drop_table_sec
延迟时间,在此期间可以使用 UNDROP
语句恢复已删除的表。如果 DROP TABLE
使用 SYNC
修饰符运行,则忽略此设置。此设置的默认值为 480
(8 分钟)。
默认值: 480
database_catalog_unused_dir_hide_timeout_sec
清理 store/
目录中垃圾的任务的参数。如果某个子目录未被 clickhouse-server 使用,并且此目录在过去 database_catalog_unused_dir_hide_timeout_sec
秒内未被修改,则该任务将通过删除所有访问权限来“隐藏”此目录。它也适用于 clickhouse-server 不希望在 store/
内部看到的目录。
值为 0
表示“立即”。
默认值: 3600
(1 小时)
database_catalog_unused_dir_rm_timeout_sec
清理 store/
目录中垃圾的任务的参数。如果某个子目录未被 clickhouse-server 使用,并且之前已被“隐藏”(参见 database_catalog_unused_dir_hide_timeout_sec),并且此目录在过去 database_catalog_unused_dir_rm_timeout_sec
秒内未被修改,则该任务将删除此目录。它也适用于 clickhouse-server 不希望在 store/
内部看到的目录。
值为 0
表示“永不”。默认值对应 30 天。
默认值: 2592000
(30 天)。
database_catalog_drop_error_cooldown_sec
如果表删除失败,ClickHouse 将等待此超时时间后重试操作。
类型: UInt64
默认值: 5
database_catalog_drop_table_concurrency
用于删除表的线程池的大小。
类型: UInt64
默认值: 16
database_catalog_unused_dir_cleanup_period_sec
清理 store/
目录中垃圾的任务的参数。设置任务的调度周期。
值为 0
表示“永不”。默认值对应 1 天。
默认值: 86400
(1 天)。
default_profile
默认设置配置文件。设置配置文件位于参数 user_config
中指定的文件中。
示例
<default_profile>default</default_profile>
default_replica_path
ZooKeeper 中表的路径。
示例
<default_replica_path>/clickhouse/tables/{uuid}/{shard}</default_replica_path>
default_replica_name
ZooKeeper 中的副本名称。
示例
<default_replica_name>{replica}</default_replica_name>
dictionaries_config
字典的配置文件路径。
路径
- 指定绝对路径或相对于服务器配置文件的路径。
- 路径可以包含通配符 * 和 ?。
另请参阅
- “字典”。
示例
<dictionaries_config>*_dictionary.xml</dictionaries_config>
user_defined_executable_functions_config
可执行用户定义函数的配置文件路径。
路径
- 指定绝对路径或相对于服务器配置文件的路径。
- 路径可以包含通配符 * 和 ?。
另请参阅
- “可执行用户定义函数。”。
示例
<user_defined_executable_functions_config>*_function.xml</user_defined_executable_functions_config>
dictionaries_lazy_load
字典的延迟加载。
- 如果为
true
,则每个字典在首次使用时加载。如果加载失败,则使用该字典的函数将抛出异常。 - 如果为
false
,则服务器在启动时加载所有字典。
服务器将在启动时等待所有字典完成加载,然后才接受任何连接(例外:如果 wait_dictionaries_load_at_startup
设置为 false
)。
示例
<dictionaries_lazy_load>true</dictionaries_lazy_load>
format_schema_path
输入数据模式的目录路径,例如 CapnProto 格式的模式。
示例
<!-- Directory containing schema files for various input formats. -->
<format_schema_path>format_schemas/</format_schema_path>
graphite
将数据发送到 Graphite。
设置
host
– Graphite 服务器。port
– Graphite 服务器上的端口。interval
– 发送间隔,以秒为单位。timeout
– 发送数据的超时时间,以秒为单位。root_path
– 键的前缀。metrics
– 从 system.metrics 表发送数据。events
– 从 system.events 表发送时间段内累积的增量数据。events_cumulative
– 从 system.events 表发送累积数据。asynchronous_metrics
– 从 system.asynchronous_metrics 表发送数据。
您可以配置多个 <graphite>
子句。例如,您可以将其用于以不同的间隔发送不同的数据。
示例
<graphite>
<host>localhost</host>
<port>42000</port>
<timeout>0.1</timeout>
<interval>60</interval>
<root_path>one_min</root_path>
<metrics>true</metrics>
<events>true</events>
<events_cumulative>false</events_cumulative>
<asynchronous_metrics>true</asynchronous_metrics>
</graphite>
graphite_rollup
用于 Graphite 数据精简的设置。
有关更多详细信息,请参阅 GraphiteMergeTree。
示例
<graphite_rollup_example>
<default>
<function>max</function>
<retention>
<age>0</age>
<precision>60</precision>
</retention>
<retention>
<age>3600</age>
<precision>300</precision>
</retention>
<retention>
<age>86400</age>
<precision>3600</precision>
</retention>
</default>
</graphite_rollup_example>
http_port/https_port
通过 HTTP(s) 连接到服务器的端口。
- 如果指定了
https_port
,则必须配置 OpenSSL。 - 如果指定了
http_port
,即使设置了 OpenSSL 配置也会被忽略。
示例
<https_port>9999</https_port>
http_server_default_response
当您访问 ClickHouse HTTP(s) 服务器时默认显示的页面。默认值为 “Ok.”(末尾带有换行符)
示例
当访问 https://127.0.0.1: http_port
时打开 https://tabix.io/
。
<http_server_default_response>
<![CDATA[<html ng-app="SMI2"><head><base href="http://ui.tabix.io/"></head><body><div ui-view="" class="content-ui"></div><script src="http://loader.tabix.io/master.js"></script></body></html>]]>
</http_server_default_response>
hsts_max_age
HSTS 过期时间,以秒为单位。
值为 0
表示 ClickHouse 禁用 HSTS。如果您设置一个正数,HSTS 将被启用,最大期限为您设置的数字。
示例
<hsts_max_age>600000</hsts_max_age>
mlock_executable
启动后执行 mlockall
以降低首次查询的延迟,并防止 clickhouse 可执行文件在高 IO 负载下被分页移出。
建议启用此选项,但会导致启动时间增加最多几秒钟。请记住,如果没有 “CAP_IPC_LOCK” 功能,此参数将不起作用。
示例
<mlock_executable>false</mlock_executable>
include_from
包含替换的文件路径。支持 XML 和 YAML 格式。
有关更多信息,请参阅 “配置文件” 部分。
示例
<include_from>/etc/metrica.xml</include_from>
interserver_listen_host
对可以在 ClickHouse 服务器之间交换数据的主机进行限制。如果使用 Keeper,则相同的限制将应用于不同 Keeper 实例之间的通信。
默认情况下,该值等于 listen_host
设置。
示例
<interserver_listen_host>::ffff:a00:1</interserver_listen_host>
<interserver_listen_host>10.0.0.1</interserver_listen_host>
类型
默认值
interserver_http_port
用于 ClickHouse 服务器之间交换数据的端口。
示例
<interserver_http_port>9009</interserver_http_port>
interserver_http_host
可以被其他服务器用来访问此服务器的主机名。
如果省略,则以与 hostname -f
命令相同的方式定义。
用于从特定网络接口分离出来。
示例
<interserver_http_host>example.clickhouse.com</interserver_http_host>
interserver_https_port
用于 ClickHouse 服务器之间通过 HTTPS
交换数据的端口。
示例
<interserver_https_port>9010</interserver_https_port>
interserver_https_host
类似于 interserver_http_host
,不同之处在于此主机名可以被其他服务器用来通过 HTTPS
访问此服务器。
示例
<interserver_https_host>example.clickhouse.com</interserver_https_host>
interserver_http_credentials
在 复制 期间用于连接到其他服务器的用户名和密码。此外,服务器使用这些凭据对其他副本进行身份验证。因此,interserver_http_credentials
对于集群中的所有副本必须相同。
- 默认情况下,如果省略
interserver_http_credentials
部分,则在复制期间不使用身份验证。 interserver_http_credentials
设置与 ClickHouse 客户端凭据 配置 无关。- 这些凭据对于通过
HTTP
和HTTPS
进行复制是通用的。
该部分包含以下参数
user
— 用户名。password
— 密码。allow_empty
— 如果为true
,即使设置了凭据,也允许其他副本在没有身份验证的情况下连接。如果为false
,则拒绝没有身份验证的连接。默认值:false
。old
— 包含凭据轮换期间使用的旧user
和password
。可以指定多个old
部分。
凭据轮换
ClickHouse 支持动态 interserver 凭据轮换,而无需同时停止所有副本以更新其配置。凭据可以通过几个步骤更改。
要启用身份验证,请将 interserver_http_credentials.allow_empty
设置为 true
并添加凭据。这允许使用和不使用身份验证的连接。
<interserver_http_credentials>
<user>admin</user>
<password>111</password>
<allow_empty>true</allow_empty>
</interserver_http_credentials>
配置完所有副本后,将 allow_empty
设置为 false
或删除此设置。这使得使用新凭据进行身份验证成为强制性的。
要更改现有凭据,请将用户名和密码移动到 interserver_http_credentials.old
部分,并使用新值更新 user
和 password
。此时,服务器使用新凭据连接到其他副本,并接受使用新凭据或旧凭据的连接。
<interserver_http_credentials>
<user>admin</user>
<password>222</password>
<old>
<user>admin</user>
<password>111</password>
</old>
<old>
<user>temp</user>
<password>000</password>
</old>
</interserver_http_credentials>
当新凭据应用于所有副本时,可以删除旧凭据。
keep_alive_timeout
ClickHouse 等待传入请求的秒数,超过此时间后关闭连接。
示例
<keep_alive_timeout>10</keep_alive_timeout>
max_keep_alive_requests
通过单个 keep-alive 连接的最大请求数,达到此数量后,连接将被 ClickHouse 服务器关闭。
示例
<max_keep_alive_requests>10</max_keep_alive_requests>
listen_host
对可以发出请求的主机进行限制。如果您希望服务器响应所有请求,请指定 ::
。
示例
<listen_host>::1</listen_host>
<listen_host>127.0.0.1</listen_host>
listen_try
服务器在尝试监听时,如果 IPv6 或 IPv4 网络不可用,则不会退出。
示例
<listen_try>0</listen_try>
listen_reuse_port
允许多个服务器监听同一地址:端口。请求将由操作系统路由到随机服务器。不建议启用此设置。
示例
<listen_reuse_port>0</listen_reuse_port>
类型
默认值
listen_backlog
监听套接字的回溯 (挂起连接的队列大小)。默认值 4096
与 linux 5.4+ 的值相同。
通常不需要更改此值,因为
- 默认值足够大,
- 服务器有单独的线程用于接受客户端连接。
因此,即使您的 TcpExtListenOverflows
(来自 nstat
) 非零并且此计数器对于 ClickHouse 服务器增长,也不意味着需要增加此值,因为
- 通常,如果
4096
不够,则表明存在一些 ClickHouse 内部扩展问题,因此最好报告问题。 - 这并不意味着服务器稍后可以处理更多连接(即使可以,到那时客户端可能已消失或断开连接)。
示例
<listen_backlog>4096</listen_backlog>
logger
日志消息的位置和格式。
键:
键 | 描述 |
---|---|
level | 日志级别。可接受的值:none (关闭日志记录)、fatal 、critical 、error 、warning 、notice 、information 、debug 、trace 、test |
log | 日志文件的路径。 |
errorlog | 错误日志文件的路径。 |
size | 轮换策略:日志文件的最大大小(以字节为单位)。一旦日志文件大小超过此阈值,它将被重命名和存档,并创建一个新的日志文件。 |
count | 轮换策略:ClickHouse 最多保留多少个历史日志文件。 |
stream_compress | 使用 LZ4 压缩日志消息。设置为 1 或 true 以启用。 |
console | 不要将日志消息写入日志文件,而是在控制台中打印它们。设置为 1 或 true 以启用。如果 ClickHouse 未在守护进程模式下运行,则默认为 1 ,否则为 0 。 |
console_log_level | 控制台输出的日志级别。默认为 level 。 |
formatting | 控制台输出的日志格式。目前,仅支持 json |
use_syslog | 也将日志输出转发到 syslog。 |
syslog_level | 记录到 syslog 的日志级别。 |
message_regexp | 仅记录与此正则表达式匹配的消息。默认为 "" ,表示不进行过滤。 |
message_regexp_negative | 仅记录与此正则表达式不匹配的消息。默认为 "" ,表示不进行过滤。 |
日志格式说明符
log
和 errorLog
路径中的文件名支持以下格式说明符,用于生成的文件名(目录部分不支持它们)。
“示例”列显示了 2023-07-06 18:32:07
的输出。
说明符 | 描述 | 示例 |
---|---|---|
%% | 字面量 % | % |
%n | 换行符 | |
%t | 水平制表符 | |
%Y | 年份,十进制数,例如 2017 | 2023 |
%y | 年份的最后 2 位数字,十进制数(范围 [00,99]) | 23 |
%C | 年份的前 2 位数字,十进制数(范围 [00,99]) | 20 |
%G | 四位数字的 ISO 8601 基于周的年份,即包含指定周的年份。通常仅与 %V 一起使用才有用 | 2023 |
%g | ISO 8601 基于周的年份 的最后 2 位数字,即包含指定周的年份。 | 23 |
%b | 缩写的月份名称,例如 Oct(取决于区域设置) | 七月 |
%h | %b 的同义词 | 七月 |
%B | 完整的月份名称,例如 October(取决于区域设置) | 七月 |
%m | 月份,十进制数(范围 [01,12]) | 07 |
%U | 一年中的第几周,十进制数(星期日是一周的第一天)(范围 [00,53]) | 27 |
%W | 一年中的第几周,十进制数(星期一是一周的第一天)(范围 [00,53]) | 27 |
%V | ISO 8601 周数(范围 [01,53]) | 27 |
%j | 一年中的第几天,十进制数(范围 [001,366]) | 187 |
%d | 月份中的第几天,零填充的十进制数(范围 [01,31])。个位数前面加零。 | 06 |
%e | 月份中的第几天,空格填充的十进制数(范围 [1,31])。个位数前面加一个空格。 | 6 |
%a | 缩写的工作日名称,例如 Fri(取决于区域设置) | 周四 |
%A | 完整的工作日名称,例如 Friday(取决于区域设置) | 星期四 |
%w | 工作日,整数,星期日为 0(范围 [0-6]) | 4 |
%u | 工作日,十进制数,星期一为 1(ISO 8601 格式)(范围 [1-7]) | 4 |
%H | 小时,十进制数,24 小时制(范围 [00-23]) | 18 |
%I | 小时,十进制数,12 小时制(范围 [01,12]) | 06 |
%M | 分钟,十进制数(范围 [00,59]) | 32 |
%S | 秒,十进制数(范围 [00,60]) | 07 |
%c | 标准日期和时间字符串,例如 Sun Oct 17 04:41:13 2010(取决于区域设置) | 2023年7月6日 18:32:07 星期四 |
%x | 本地化的日期表示形式(取决于区域设置) | 07/06/23 |
%X | 本地化的时间表示形式,例如 18:40:20 或 6:40:20 PM(取决于区域设置) | 18:32:07 |
%D | 短日期 MM/DD/YY,等效于 %m/%d/%y | 07/06/23 |
%F | 短日期 YYYY-MM-DD,等效于 %Y-%m-%d | 2023-07-06 |
%r | 本地化的 12 小时制时间(取决于区域设置) | 下午 06:32:07 |
%R | 等效于 "%H:%M" | 18:32 |
%T | 等效于 "%H:%M:%S"(ISO 8601 时间格式) | 18:32:07 |
%p | 本地化的上午或下午指示符(取决于区域设置) | 下午 |
%z | UTC 偏移量,采用 ISO 8601 格式(例如 -0430),如果时区信息不可用,则不显示字符 | +0800 |
%Z | 取决于区域设置的时区名称或缩写,如果时区信息不可用,则不显示字符 | Z AWST |
示例
<logger>
<level>trace</level>
<log>/var/log/clickhouse-server/clickhouse-server-%F-%T.log</log>
<errorlog>/var/log/clickhouse-server/clickhouse-server-%F-%T.err.log</errorlog>
<size>1000M</size>
<count>10</count>
<stream_compress>true</stream_compress>
</logger>
仅在控制台中打印日志消息
<logger>
<level>information</level>
<console>true</console>
</logger>
按级别覆盖
可以覆盖各个日志名称的日志级别。例如,静音记录器 “Backup” 和 “RBAC” 的所有消息。
<logger>
<levels>
<logger>
<name>Backup</name>
<level>none</level>
</logger>
<logger>
<name>RBAC</name>
<level>none</level>
</logger>
</levels>
</logger>
正则表达式过滤
可以使用正则表达式使用 message_regexp
和 message_regexp_negative
过滤记录的消息。这可以按级别或全局完成。如果同时指定了全局模式和记录器特定的模式,则全局模式将被覆盖(忽略),并且仅应用记录器特定的模式。对于这种情况,正模式和负模式被认为是独立的。注意:使用此功能可能会导致性能略有下降。
<logger>
<level>trace</level>
<!-- Global: Don't log Trace messages -->
<message_regexp_negative>.*Trace.*</message_regexp_negative>
<message_regexps>
<logger>
<!-- For the executeQuery logger, only log if message has "Read", but not "from" -->
<name>executeQuery</name>
<message_regexp>.*Read.*</message_regexp>
<message_regexp_negative>.*from.*</message_regexp_negative>
</logger>
</message_regexps>
</logger>
syslog
将日志消息额外写入 syslog
<logger>
<use_syslog>1</use_syslog>
<syslog>
<address>syslog.remote:10514</address>
<hostname>myhost.local</hostname>
<facility>LOG_LOCAL6</facility>
<format>syslog</format>
</syslog>
</logger>
<syslog>
的键
键 | 描述 |
---|---|
address | syslog 的地址,格式为 host\[:port\] 。如果省略,则使用本地守护程序。 |
hostname | 发送日志的主机名(可选)。 |
facility | syslog facility 关键字。必须指定为大写并带有 “LOG_” 前缀,例如 LOG_USER 、LOG_DAEMON 、LOG_LOCAL3 等。默认值:如果指定了 address ,则为 LOG_USER ,否则为 LOG_DAEMON 。 |
format | 日志消息格式。可能的值:bsd 和 syslog 。 |
日志格式
您可以指定将在控制台日志中输出的日志格式。目前,仅支持 JSON 格式。
示例
这是一个 JSON 输出日志的示例
{
"date_time_utc": "2024-11-06T09:06:09Z",
"date_time": "1650918987.180175",
"thread_name": "#1",
"thread_id": "254545",
"level": "Trace",
"query_id": "",
"logger_name": "BaseDaemon",
"message": "Received signal 2",
"source_file": "../base/daemon/BaseDaemon.cpp; virtual void SignalListener::run()",
"source_line": "192"
}
要启用 JSON 日志记录支持,请使用以下代码片段
<logger>
<formatting>
<type>json</type>
<names>
<date_time>date_time</date_time>
<thread_name>thread_name</thread_name>
<thread_id>thread_id</thread_id>
<level>level</level>
<query_id>query_id</query_id>
<logger_name>logger_name</logger_name>
<message>message</message>
<source_file>source_file</source_file>
<source_line>source_line</source_line>
</names>
</formatting>
</logger>
重命名 JSON 日志的键
可以通过更改 <names>
标签内的标签值来修改键名。例如,要将 DATE_TIME
更改为 MY_DATE_TIME
,您可以使用 <date_time>MY_DATE_TIME</date_time>
。
省略 JSON 日志的键
可以通过注释掉属性来省略日志属性。例如,如果您不希望日志打印 query_id
,您可以注释掉 <query_id>
标签。
send_crash_reports
选择性地向 ClickHouse 核心开发团队通过 Sentry 发送崩溃报告的设置。
启用此功能,尤其是在预生产环境中,将非常感谢。
服务器需要通过 IPv4 访问公共互联网(在撰写本文时 Sentry 不支持 IPv6),此功能才能正常工作。
键
键 | 描述 |
---|---|
enabled | 用于启用该功能的布尔标志,默认为 false 。设置为 true 以允许发送崩溃报告。 |
send_logical_errors | LOGICAL_ERROR 类似于 assert ,它是 ClickHouse 中的一个错误。此布尔标志启用将此类异常发送到 Sentry (默认值: false )。 |
endpoint | 您可以覆盖 Sentry 端点 URL 以发送崩溃报告。它可以是单独的 Sentry 帐户或您自托管的 Sentry 实例。使用 Sentry DSN 语法。 |
anonymize | 避免将服务器主机名附加到崩溃报告中。 |
http_proxy | 配置用于发送崩溃报告的 HTTP 代理。 |
debug | 将 Sentry 客户端设置为调试模式。 |
tmp_path | 临时崩溃报告状态的文件系统路径。 |
environment | ClickHouse 服务器运行环境的任意名称。它将在每个崩溃报告中提及。默认值根据 ClickHouse 版本为 test 或 prod 。 |
推荐用法
<send_crash_reports>
<enabled>true</enabled>
</send_crash_reports>
macros
用于复制表的参数替换。
如果未使用复制表,则可以省略。
有关更多信息,请参阅 创建复制表 部分。
示例
<macros incl="macros" optional="true" />
replica_group_name
Replicated 数据库的副本组名称。
由 Replicated 数据库创建的集群将由同一组中的副本组成。DDL 查询将仅等待同一组中的副本。
默认值为空。
示例
<replica_group_name>backups</replica_group_name>
类型: String
默认值: ""
max_open_files
最大打开文件数。
我们建议在 macOS 中使用此选项,因为 getrlimit()
函数返回不正确的值。
示例
<max_open_files>262144</max_open_files>
max_table_size_to_drop
删除表的限制。
如果 MergeTree 表的大小超过 max_table_size_to_drop
(以字节为单位),则无法使用 DROP
查询或 TRUNCATE
查询删除它。
值 0
表示您可以删除所有表,没有任何限制。
此设置不需要重启 ClickHouse 服务器即可应用。禁用此限制的另一种方法是创建 <clickhouse-path>/flags/force_drop_table
文件。
示例
<max_table_size_to_drop>0</max_table_size_to_drop>
默认值:50 GB。
background_pool_size
设置执行 MergeTree 引擎表的后台合并和突变操作的线程数。
- 此设置也可以在服务器启动时从
default
配置文件应用,以实现 ClickHouse 服务器启动时的向后兼容性。 - 您只能在运行时增加线程数。
- 要减少线程数,您必须重启服务器。
- 通过调整此设置,您可以管理 CPU 和磁盘负载。
较小的池大小会占用较少的 CPU 和磁盘资源,但后台进程推进速度较慢,这最终可能会影响查询性能。
在更改它之前,请同时查看相关的 MergeTree 设置,例如
number_of_free_entries_in_pool_to_lower_max_size_of_merge
.number_of_free_entries_in_pool_to_execute_mutation
.
示例
<background_pool_size>16</background_pool_size>
类型
默认值:16。
merges_mutations_memory_usage_soft_limit
设置允许用于执行合并和突变操作的 RAM 限制。如果 ClickHouse 达到设置的限制,它将不会调度任何新的后台合并或突变操作,但会继续执行已调度的任务。
值 0
表示无限制。
示例
<merges_mutations_memory_usage_soft_limit>0</merges_mutations_memory_usage_soft_limit>
merges_mutations_memory_usage_to_ram_ratio
默认的 merges_mutations_memory_usage_soft_limit
值计算为 memory_amount * merges_mutations_memory_usage_to_ram_ratio
。
另请参阅
默认值:0.5
。
async_load_databases
异步加载数据库和表。
- 如果为
true
,则所有带有Ordinary
、Atomic
和Replicated
引擎的非系统数据库将在 ClickHouse 服务器启动后异步加载。请参阅system.asynchronous_loader
表、tables_loader_background_pool_size
和tables_loader_foreground_pool_size
服务器设置。任何尝试访问尚未加载的表的查询都将等待该表启动。如果加载作业失败,查询将重新抛出错误(而不是在async_load_databases = false
的情况下关闭整个服务器)。至少有一个查询正在等待的表将以更高的优先级加载。数据库上的 DDL 查询将等待该数据库启动。还可以考虑设置max_waiting_queries
限制等待查询的总数。 - 如果为
false
,则所有数据库在服务器启动时加载。
示例
<async_load_databases>true</async_load_databases>
默认值:false
。
async_load_system_database
异步加载系统表。如果 system
数据库中有大量日志表和分区,则此功能很有用。独立于 async_load_databases
设置。
- 如果设置为
true
,则所有带有Ordinary
、Atomic
和Replicated
引擎的系统数据库将在 ClickHouse 服务器启动后异步加载。请参阅system.asynchronous_loader
表、tables_loader_background_pool_size
和tables_loader_foreground_pool_size
服务器设置。任何尝试访问尚未加载的系统表的查询都将等待该表启动。至少有一个查询正在等待的表将以更高的优先级加载。还可以考虑设置max_waiting_queries
设置来限制等待查询的总数。 - 如果设置为
false
,则系统数据库在服务器启动前加载。
示例
<async_load_system_database>true</async_load_system_database>
默认值:false
。
tables_loader_foreground_pool_size
设置在前台池中执行加载作业的线程数。前台池用于在服务器开始监听端口之前同步加载表,以及加载正在等待的表。前台池的优先级高于后台池。这意味着当在前台池中运行作业时,后台池中不会启动任何作业。
值 0
表示将使用所有可用的 CPU。
默认值: 0
tables_loader_background_pool_size
设置在后台池中执行异步加载作业的线程数。后台池用于在服务器启动后异步加载表,以防没有查询等待该表。如果有很多表,则保持后台池中的线程数较低可能是有益的。它将为并发查询执行保留 CPU 资源。
值 0
表示将使用所有可用的 CPU。
默认值: 0
merge_tree
微调 MergeTree 中的表。
有关更多信息,请参阅 MergeTreeSettings.h 头文件。
示例
<merge_tree>
<max_suspicious_broken_parts>5</max_suspicious_broken_parts>
</merge_tree>
metric_log
默认情况下禁用。
启用
要手动开启指标历史记录收集 system.metric_log
,请创建包含以下内容的 /etc/clickhouse-server/config.d/metric_log.xml
<clickhouse>
<metric_log>
<database>system</database>
<table>metric_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<collect_interval_milliseconds>1000</collect_interval_milliseconds>
<max_size_rows>1048576</max_size_rows>
<reserved_size_rows>8192</reserved_size_rows>
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
<flush_on_crash>false</flush_on_crash>
</metric_log>
</clickhouse>
禁用
要禁用 metric_log
设置,您应该创建包含以下内容的 /etc/clickhouse-server/config.d/disable_metric_log.xml
文件
<clickhouse>
<metric_log remove="1" />
</clickhouse>
replicated_merge_tree
微调 ReplicatedMergeTree 中的表。此设置具有更高的优先级。
有关更多信息,请参阅 MergeTreeSettings.h 头文件。
示例
<replicated_merge_tree>
<max_suspicious_broken_parts>5</max_suspicious_broken_parts>
</replicated_merge_tree>
openSSL
SSL 客户端/服务器配置。
SSL 的支持由 libpoco
库提供。可用的配置选项在 SSLManager.h 中进行了解释。默认值可以在 SSLManager.cpp 中找到。
服务器/客户端设置的键
选项 | 描述 | 默认值 |
---|---|---|
privateKeyFile | PEM 证书的密钥文件的路径。该文件可以同时包含密钥和证书。 | |
certificateFile | PEM 格式的客户端/服务器证书文件的路径。如果 privateKeyFile 包含证书,则可以省略它。 | |
caConfig | 包含受信任 CA 证书的文件或目录的路径。如果指向文件,则必须为 PEM 格式,并且可以包含多个 CA 证书。如果指向目录,则每个 CA 证书必须包含一个 .pem 文件。文件名通过 CA 主题名称哈希值查找。详细信息可以在 SSL_CTX_load_verify_locations 的手册页中找到。 | |
verificationMode | 检查节点证书的方法。详细信息在 Context 类的描述中。可能的值:none 、relaxed 、strict 、once 。 | relaxed |
verificationDepth | 验证链的最大长度。如果证书链长度超过设置的值,则验证将失败。 | 9 |
loadDefaultCAFile | 是否使用 OpenSSL 的内置 CA 证书。ClickHouse 假定内置 CA 证书位于文件 /etc/ssl/cert.pem (或目录 /etc/ssl/certs ) 或由环境变量 SSL_CERT_FILE (或 SSL_CERT_DIR ) 指定的文件 (或目录) 中。 | true |
cipherList | 支持的 OpenSSL 加密。 | ALL:!ADH:!LOW:!EXP:!MD5:!3DES:@STRENGTH |
cacheSessions | 启用或禁用会话缓存。必须与 sessionIdContext 结合使用。可接受的值:true 、false 。 | false |
sessionIdContext | 一组唯一的随机字符,服务器将其附加到每个生成的标识符。字符串的长度不得超过 SSL_MAX_SSL_SESSION_ID_LENGTH 。始终建议使用此参数,因为它有助于避免服务器缓存会话和客户端请求缓存时出现问题。 | ${application.name} |
sessionCacheSize | 服务器缓存的最大会话数。值 0 表示会话数不受限制。 | 1024*20 |
sessionTimeout | 在服务器上缓存会话的时间,以小时为单位。 | 2 |
extendedVerification | 如果启用,请验证证书 CN 或 SAN 是否与对等主机名匹配。 | false |
requireTLSv1 | 需要 TLSv1 连接。可接受的值:true 、false 。 | false |
requireTLSv1_1 | 需要 TLSv1.1 连接。可接受的值:true 、false 。 | false |
requireTLSv1_2 | 需要 TLSv1.2 连接。可接受的值:true 、false 。 | false |
fips | 激活 OpenSSL FIPS 模式。如果库的 OpenSSL 版本支持 FIPS,则支持此模式。 | false |
privateKeyPassphraseHandler | 请求用于访问私钥的密码的类 (PrivateKeyPassphraseHandler 子类)。例如:<privateKeyPassphraseHandler> , <name>KeyFileHandler</name> , <options><password>test</password></options> , </privateKeyPassphraseHandler> 。 | KeyConsoleHandler |
invalidCertificateHandler | 用于验证无效证书的类(CertificateHandler 的子类)。例如:<invalidCertificateHandler> <name>RejectCertificateHandler</name> </invalidCertificateHandler> 。 | RejectCertificateHandler |
disableProtocols | 不允许使用的协议。 | |
preferServerCiphers | 客户端首选服务器密码。 | false |
设置示例
<openSSL>
<server>
<!-- openssl req -subj "/CN=localhost" -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/clickhouse-server/server.key -out /etc/clickhouse-server/server.crt -->
<certificateFile>/etc/clickhouse-server/server.crt</certificateFile>
<privateKeyFile>/etc/clickhouse-server/server.key</privateKeyFile>
<!-- openssl dhparam -out /etc/clickhouse-server/dhparam.pem 4096 -->
<dhParamsFile>/etc/clickhouse-server/dhparam.pem</dhParamsFile>
<verificationMode>none</verificationMode>
<loadDefaultCAFile>true</loadDefaultCAFile>
<cacheSessions>true</cacheSessions>
<disableProtocols>sslv2,sslv3</disableProtocols>
<preferServerCiphers>true</preferServerCiphers>
</server>
<client>
<loadDefaultCAFile>true</loadDefaultCAFile>
<cacheSessions>true</cacheSessions>
<disableProtocols>sslv2,sslv3</disableProtocols>
<preferServerCiphers>true</preferServerCiphers>
<!-- Use for self-signed: <verificationMode>none</verificationMode> -->
<invalidCertificateHandler>
<!-- Use for self-signed: <name>AcceptCertificateHandler</name> -->
<name>RejectCertificateHandler</name>
</invalidCertificateHandler>
</client>
</openSSL>
part_log
记录与 MergeTree 关联的事件。例如,添加或合并数据。您可以使用日志来模拟合并算法并比较其特性。您可以可视化合并过程。
查询记录在 system.part_log 表中,而不是在单独的文件中。您可以在 table
参数中配置此表的名称(见下文)。
使用以下参数配置日志记录
参数 | 描述 | 默认值 |
---|---|---|
database | 数据库名称。 | |
table | 系统表的名称。 | |
partition_by | 系统表的自定义分区键。如果定义了 engine ,则不能使用。 | |
order_by | 系统表的自定义排序键。如果定义了 engine ,则不能使用。 | |
engine | 系统表的 MergeTree 引擎定义。如果定义了 partition_by 或 order_by ,则不能使用。 | |
flush_interval_milliseconds | 将内存缓冲区中的数据刷新到表的间隔。 | |
max_size_rows | 日志的最大行数。当未刷新的日志数量达到 max_size 时,日志将转储到磁盘。 | 1048576 |
reserved_size_rows | 日志的预分配内存大小(以行数计)。 | 8192 |
buffer_size_rows_flush_threshold | 行数阈值,达到此阈值会在后台启动将日志刷新到磁盘。 | max_size_rows / 2 |
flush_on_crash | 指示在发生崩溃时是否应将日志转储到磁盘。 | false |
storage_policy | 用于表的存储策略名称(可选) | |
settings | 控制 MergeTree 行为的附加参数(可选)。 |
示例
<part_log>
<database>system</database>
<table>part_log</table>
<partition_by>toMonday(event_date)</partition_by>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<max_size_rows>1048576</max_size_rows>
<reserved_size_rows>8192</reserved_size_rows>
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
<flush_on_crash>false</flush_on_crash>
</part_log>
path
包含数据的目录的路径。
尾部斜杠是强制性的。
示例
<path>/var/lib/clickhouse/</path>
Prometheus
暴露指标数据以从 Prometheus 抓取。
设置
endpoint
– 用于 prometheus 服务器抓取指标的 HTTP 端点。从“/”开始。port
–endpoint
的端口。metrics
– 暴露来自 system.metrics 表的指标。events
– 暴露来自 system.events 表的指标。asynchronous_metrics
– 暴露来自 system.asynchronous_metrics 表的当前指标值。errors
- 暴露自上次服务器重启以来发生的按错误代码分类的错误数。此信息也可以从 system.errors 中获取。
示例
<clickhouse>
<listen_host>0.0.0.0</listen_host>
<http_port>8123</http_port>
<tcp_port>9000</tcp_port>
<prometheus>
<endpoint>/metrics</endpoint>
<port>9363</port>
<metrics>true</metrics>
<events>true</events>
<asynchronous_metrics>true</asynchronous_metrics>
<errors>true</errors>
</prometheus>
</clickhouse>
检查 (将 127.0.0.1
替换为您的 ClickHouse 服务器的 IP 地址或主机名)
curl 127.0.0.1:9363/metrics
query_log
用于记录使用 log_queries=1 设置接收的查询的设置。
查询记录在 system.query_log 表中,而不是在单独的文件中。您可以在 table
参数中更改表的名称(见下文)。
使用以下参数配置日志记录
参数 | 描述 | 默认值 |
---|---|---|
database | 数据库名称。 | |
table | 将在其中记录查询的系统表的名称。 | |
partition_by | 系统表的自定义分区键。如果定义了 engine ,则不能使用。 | |
order_by | 系统表的自定义排序键。如果定义了 engine ,则不能使用。 | |
engine | 系统表的 MergeTree 引擎定义。如果定义了 partition_by 或 order_by ,则不能使用。 | |
flush_interval_milliseconds | 将内存缓冲区中的数据刷新到表的间隔。 | |
max_size_rows | 日志的最大行数。当未刷新的日志数量达到 max_size 时,日志将转储到磁盘。 | 1048576 |
reserved_size_rows | 日志的预分配内存大小(以行数计) | 8192 |
buffer_size_rows_flush_threshold | 行数阈值,达到此阈值会在后台启动将日志刷新到磁盘。 | max_size_rows / 2 |
flush_on_crash | 指示在发生崩溃时是否应将日志转储到磁盘。 | false |
storage_policy | 用于表的存储策略名称(可选) | |
settings | 控制 MergeTree 行为的附加参数(可选) |
如果该表不存在,ClickHouse 将创建它。如果在 ClickHouse 服务器更新时查询日志的结构发生更改,则旧结构的表将被重命名,并自动创建一个新表。
示例
<query_log>
<database>system</database>
<table>query_log</table>
<engine>Engine = MergeTree PARTITION BY event_date ORDER BY event_time TTL event_date + INTERVAL 30 day</engine>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<max_size_rows>1048576</max_size_rows>
<reserved_size_rows>8192</reserved_size_rows>
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
<flush_on_crash>false</flush_on_crash>
</query_log>
query_metric_log
默认情况下禁用。
启用
要手动开启指标历史记录收集 system.query_metric_log
,请创建包含以下内容的 /etc/clickhouse-server/config.d/query_metric_log.xml
<clickhouse>
<query_metric_log>
<database>system</database>
<table>query_metric_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<collect_interval_milliseconds>1000</collect_interval_milliseconds>
<max_size_rows>1048576</max_size_rows>
<reserved_size_rows>8192</reserved_size_rows>
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
<flush_on_crash>false</flush_on_crash>
</query_metric_log>
</clickhouse>
禁用
要禁用 query_metric_log
设置,您应该创建包含以下内容的 /etc/clickhouse-server/config.d/disable_query_metric_log.xml
文件
<clickhouse>
<query_metric_log remove="1" />
</clickhouse>
query_cache
查询缓存配置。
以下设置可用
设置 | 描述 | 默认值 |
---|---|---|
max_size_in_bytes | 最大缓存大小(以字节为单位)。0 表示禁用查询缓存。 | 1073741824 |
max_entries | 缓存中存储的 SELECT 查询结果的最大数量。 | 1024 |
max_entry_size_in_bytes | SELECT 查询结果可以保存在缓存中的最大大小(以字节为单位)。 | 1048576 |
max_entry_size_in_rows | SELECT 查询结果可以保存在缓存中的最大行数。 | 30000000 |
- 更改的设置立即生效。
- 查询缓存的数据分配在 DRAM 中。如果内存稀缺,请确保为
max_size_in_bytes
设置一个较小的值,或完全禁用查询缓存。
示例
<query_cache>
<max_size_in_bytes>1073741824</max_size_in_bytes>
<max_entries>1024</max_entries>
<max_entry_size_in_bytes>1048576</max_entry_size_in_bytes>
<max_entry_size_in_rows>30000000</max_entry_size_in_rows>
</query_cache>
query_thread_log
用于记录使用 log_query_threads=1 设置接收的查询线程的设置。
查询记录在 system.query_thread_log 表中,而不是在单独的文件中。您可以在 table
参数中更改表的名称(见下文)。
使用以下参数配置日志记录
参数 | 描述 | 默认值 |
---|---|---|
database | 数据库名称。 | |
table | 将在其中记录查询的系统表的名称。 | |
partition_by | 系统表的自定义分区键。如果定义了 engine ,则不能使用。 | |
order_by | 系统表的自定义排序键。如果定义了 engine ,则不能使用。 | |
engine | 系统表的 MergeTree 引擎定义。如果定义了 partition_by 或 order_by ,则不能使用。 | |
flush_interval_milliseconds | 将内存缓冲区中的数据刷新到表的间隔。 | |
max_size_rows | 日志的最大行数。当未刷新的日志数量达到 max_size_rows 时,日志将转储到磁盘。 | 1048576 |
reserved_size_rows | 日志的预分配内存大小(以行数计)。 | 8192 |
buffer_size_rows_flush_threshold | 行数阈值,达到此阈值会在后台启动将日志刷新到磁盘。 | max_size_rows / 2 |
flush_on_crash | 指示在发生崩溃时是否应将日志转储到磁盘 | false |
storage_policy | 用于表的存储策略名称(可选) | |
settings | 控制 MergeTree 行为的附加参数(可选)。 |
如果该表不存在,ClickHouse 将创建它。如果在 ClickHouse 服务器更新时查询线程日志的结构发生更改,则旧结构的表将被重命名,并自动创建一个新表。
示例
<query_thread_log>
<database>system</database>
<table>query_thread_log</table>
<partition_by>toMonday(event_date)</partition_by>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<max_size_rows>1048576</max_size_rows>
<reserved_size_rows>8192</reserved_size_rows>
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
<flush_on_crash>false</flush_on_crash>
</query_thread_log>
query_views_log
用于记录与使用 log_query_views=1 设置接收的查询相关的视图(实时视图、物化视图等)的设置。
查询记录在 system.query_views_log 表中,而不是在单独的文件中。您可以在 table
参数中更改表的名称(见下文)。
使用以下参数配置日志记录
参数 | 描述 | 默认值 |
---|---|---|
database | 数据库名称。 | |
table | 将在其中记录查询的系统表的名称。 | |
order_by | 系统表的自定义排序键。如果定义了 engine ,则不能使用。 | |
engine | 系统表的 MergeTree 引擎定义。如果定义了 partition_by 或 order_by ,则不能使用。 | |
flush_interval_milliseconds | 将内存缓冲区中的数据刷新到表的间隔。 | |
max_size_rows | 日志的最大行数。当未刷新的日志数量达到 max_size 时,日志将转储到磁盘。 | 1048576 |
reserved_size_rows | 日志的预分配内存大小(以行数计)。 | 8192 |
buffer_size_rows_flush_threshold | 行数阈值,达到此阈值会在后台启动将日志刷新到磁盘。 | max_size_rows / 2 |
flush_on_crash | 指示在发生崩溃时是否应将日志转储到磁盘。 | false |
storage_policy | 用于表的存储策略名称(可选) | |
settings | 控制 MergeTree 行为的附加参数(可选)。 |
如果该表不存在,ClickHouse 将创建它。如果在 ClickHouse 服务器更新时查询视图日志的结构发生更改,则旧结构的表将被重命名,并自动创建一个新表。
示例
<query_views_log>
<database>system</database>
<table>query_views_log</table>
<partition_by>toYYYYMM(event_date)</partition_by>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<max_size_rows>1048576</max_size_rows>
<reserved_size_rows>8192</reserved_size_rows>
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
<flush_on_crash>false</flush_on_crash>
</query_views_log>
text_log
用于记录文本消息的 text_log 系统表的设置。
参数
参数 | 描述 | 默认值 |
---|---|---|
level | 将存储在表中的最大消息级别(默认为 Trace )。 | Trace |
database | 数据库名称。 | |
table | 将在其中记录查询的系统表的名称。 | |
partition_by | 系统表的自定义分区键。如果定义了 engine ,则不能使用。 | |
order_by | 系统表的自定义排序键。如果定义了 engine ,则不能使用。 | |
engine | 系统表的 MergeTree 引擎定义。如果定义了 partition_by 或 order_by ,则不能使用。 | |
flush_interval_milliseconds | 将内存缓冲区中的数据刷新到表的间隔。 | |
max_size_rows | 日志的最大行数。当未刷新的日志数量达到 max_size 时,日志将转储到磁盘。 | 1048576 |
reserved_size_rows | 日志的预分配内存大小(以行数计)。 | 8192 |
buffer_size_rows_flush_threshold | 行数阈值,达到此阈值会在后台启动将日志刷新到磁盘。 | max_size_rows / 2 |
flush_on_crash | 指示在发生崩溃时是否应将日志转储到磁盘。 | false |
storage_policy | 用于表的存储策略名称(可选) | |
settings | 控制 MergeTree 行为的附加参数(可选)。 |
示例
<clickhouse>
<text_log>
<level>notice</level>
<database>system</database>
<table>text_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<max_size_rows>1048576</max_size_rows>
<reserved_size_rows>8192</reserved_size_rows>
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
<flush_on_crash>false</flush_on_crash>
<!-- <partition_by>event_date</partition_by> -->
<engine>Engine = MergeTree PARTITION BY event_date ORDER BY event_time TTL event_date + INTERVAL 30 day</engine>
</text_log>
</clickhouse>
trace_log
用于 trace_log 系统表操作的设置。
参数
参数 | 描述 | 默认值 |
---|---|---|
database | 用于存储表的数据库。 | |
table | 表的名称。 | |
partition_by | 系统表的自定义分区键。如果定义了 engine ,则不能使用。 | |
order_by | 系统表的自定义排序键。如果定义了 engine ,则不能使用。 | |
engine | 系统表的 MergeTree 引擎定义。如果定义了 partition_by 或 order_by ,则不能使用。 | |
flush_interval_milliseconds | 将内存缓冲区中的数据刷新到表的间隔。 | |
max_size_rows | 日志的最大行数。当未刷新的日志数量达到 max_size 时,日志将转储到磁盘。 | 1048576 |
reserved_size_rows | 日志的预分配内存大小(以行数计)。 | 8192 |
buffer_size_rows_flush_threshold | 行数阈值,达到此阈值会在后台启动将日志刷新到磁盘。 | max_size_rows / 2 |
storage_policy | 用于表的存储策略名称(可选) | |
symbolize | 服务器是否应尝试符号化结果(可选,默认值:false ) | |
settings | 控制 MergeTree 行为的附加参数(可选)。 |
默认服务器配置文件 config.xml
包含以下设置部分
<trace_log>
<database>system</database>
<table>trace_log</table>
<partition_by>toYYYYMM(event_date)</partition_by>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<max_size_rows>1048576</max_size_rows>
<reserved_size_rows>8192</reserved_size_rows>
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
<flush_on_crash>false</flush_on_crash>
<symbolize>false</symbolize>
</trace_log>
asynchronous_insert_log
用于记录异步插入的 asynchronous_insert_log 系统表的设置。
参数
参数 | 描述 | 默认值 |
---|---|---|
database | 数据库名称。 | |
table | 表名。 | |
partition_by | 系统表的自定义分区键。如果定义了 engine ,则不能使用。 | |
engine | 系统表的 MergeTree 引擎定义。如果定义了 partition_by ,则不能使用。 | |
flush_interval_milliseconds | 将内存缓冲区中的数据刷新到表的间隔。 | |
max_size_rows | 日志的最大行数。当未刷新的日志数量达到 max_size 时,日志将转储到磁盘。 | 1048576 |
reserved_size_rows | 日志的预分配内存大小(以行数计)。 | 8192 |
buffer_size_rows_flush_threshold | 行数阈值,达到此阈值会在后台启动将日志刷新到磁盘。 | max_size_rows / 2 |
flush_on_crash | 指示在发生崩溃时是否应将日志转储到磁盘。 | false |
storage_policy | 用于表的存储策略名称(可选) |
示例
<clickhouse>
<asynchronous_insert_log>
<database>system</database>
<table>asynchronous_insert_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<partition_by>toYYYYMM(event_date)</partition_by>
<max_size_rows>1048576</max_size_rows>
<reserved_size_rows>8192</reserved_size_rows>
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
<flush_on_crash>false</flush_on_crash>
<!-- <engine>Engine = MergeTree PARTITION BY event_date ORDER BY event_time TTL event_date + INTERVAL 30 day</engine> -->
</asynchronous_insert_log>
</clickhouse>
crash_log
用于 crash_log 系统表操作的设置。
参数
参数 | 描述 | 默认值 |
---|---|---|
database | 用于存储表的数据库。 | |
table | 表名。 | |
partition_by | 系统表的自定义分区键。如果定义了 engine ,则不能使用。 | |
order_by | 系统表的自定义排序键。如果定义了 engine ,则不能使用。 | |
engine | 系统表的 MergeTree 引擎定义。如果定义了 partition_by 或 order_by ,则不能使用。 | |
flush_interval_milliseconds | 将内存缓冲区中的数据刷新到表的间隔。 | |
max_size_rows | 日志的最大行数。当未刷新的日志数量达到 max_size 时,日志将转储到磁盘。 | 1048576 |
reserved_size_rows | 日志的预分配内存大小(以行数计)。 | 8192 |
buffer_size_rows_flush_threshold | 行数阈值,达到此阈值会在后台启动将日志刷新到磁盘。 | max_size_rows / 2 |
flush_on_crash | 指示在发生崩溃时是否应将日志转储到磁盘。 | false |
storage_policy | 用于表的存储策略名称(可选) | |
settings | 控制 MergeTree 行为的附加参数(可选)。 |
默认服务器配置文件 config.xml
包含以下设置部分
<crash_log>
<database>system</database>
<table>crash_log</table>
<partition_by>toYYYYMM(event_date)</partition_by>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<max_size_rows>1024</max_size_rows>
<reserved_size_rows>1024</reserved_size_rows>
<buffer_size_rows_flush_threshold>512</buffer_size_rows_flush_threshold>
<flush_on_crash>false</flush_on_crash>
</crash_log>
backup_log
用于记录 BACKUP
和 RESTORE
操作的 backup_log 系统表的设置。
参数
参数 | 描述 | 默认值 |
---|---|---|
database | 用于存储表的数据库。 | |
table | 表名。 | |
partition_by | 系统表的自定义分区键。如果定义了 engine ,则不能使用。 | |
order_by | 系统表的自定义排序键。如果定义了 engine ,则不能使用。 | |
engine | 系统表的 MergeTree 引擎定义。如果定义了 partition_by 或 order_by ,则不能使用。 | |
flush_interval_milliseconds | 将内存缓冲区中的数据刷新到表的间隔。 | |
max_size_rows | 日志的最大行数。当未刷新的日志数量达到 max_size 时,日志将转储到磁盘。 | 1048576 |
reserved_size_rows | 日志的预分配内存大小(以行数计)。 | 8192 |
buffer_size_rows_flush_threshold | 行数阈值,达到此阈值会在后台启动将日志刷新到磁盘。 | max_size_rows / 2 |
flush_on_crash | 指示在发生崩溃时是否应将日志转储到磁盘。 | false |
storage_policy | 用于表的存储策略名称(可选) | |
settings | 控制 MergeTree 行为的附加参数(可选)。 |
示例
<clickhouse>
<backup_log>
<database>system</database>
<table>backup_log</table>
<flush_interval_milliseconds>1000</flush_interval_milliseconds>
<partition_by>toYYYYMM(event_date)</partition_by>
<max_size_rows>1048576</max_size_rows>
<reserved_size_rows>8192</reserved_size_rows>
<buffer_size_rows_flush_threshold>524288</buffer_size_rows_flush_threshold>
<flush_on_crash>false</flush_on_crash>
<!-- <engine>Engine = MergeTree PARTITION BY event_date ORDER BY event_time TTL event_date + INTERVAL 30 day</engine> -->
</backup_log>
</clickhouse>
query_masking_rules
基于正则表达式的规则,将应用于查询以及所有日志消息,然后再将其存储在服务器日志、system.query_log
、system.text_log
、system.processes
表中,以及发送到客户端的日志中。这允许防止敏感数据从 SQL 查询(例如姓名、电子邮件、个人标识符或信用卡号)泄漏到日志中。
示例
<query_masking_rules>
<rule>
<name>hide SSN</name>
<regexp>(^|\D)\d{3}-\d{2}-\d{4}($|\D)</regexp>
<replace>000-00-0000</replace>
</rule>
</query_masking_rules>
配置字段:
name
- 规则的名称(可选)regexp
- RE2 兼容的正则表达式(必填)replace
- 敏感数据的替换字符串(可选,默认为六个星号)
参数 | 描述 |
---|---|
name | 规则的名称(可选) |
regexp | RE2 兼容的正则表达式(必填) |
replace | 敏感数据的替换字符串(可选,默认为六个星号) |
掩码规则应用于整个查询(以防止敏感数据从格式错误/不可解析的查询中泄漏)。
system.events
表具有计数器 QueryMaskingRulesMatch
,其中包含查询掩码规则匹配的总数。
对于分布式查询,每个服务器都必须单独配置,否则,传递到其他节点的子查询将不进行掩码存储。
remote_servers
由 Distributed 表引擎和 cluster
表函数使用的集群的配置。
示例
<remote_servers incl="clickhouse_remote_servers" />
对于 incl
属性的值,请参阅 “配置文件” 部分。
另请参阅
timezone
服务器的时区。
指定为 UTC 时区或地理位置的 IANA 标识符(例如,Africa/Abidjan)。
时区对于在文本格式(在屏幕或文件中打印)中输出 DateTime 字段以及从字符串获取 DateTime 时,在 String 和 DateTime 格式之间进行转换是必要的。此外,时区用于处理时间和日期的函数中,如果这些函数在输入参数中没有收到时区。
示例
<timezone>Asia/Istanbul</timezone>
另请参阅
tcp_port
用于通过 TCP 协议与客户端通信的端口。
示例
<tcp_port>9000</tcp_port>
tcp_port_secure
用于与客户端进行安全通信的 TCP 端口。与 OpenSSL 设置一起使用。
默认值
<tcp_port_secure>9440</tcp_port_secure>
mysql_port
用于通过 MySQL 协议与客户端通信的端口。
- 正整数指定要监听的端口号
- 空值用于禁用通过 MySQL 协议与客户端的通信。
示例
<mysql_port>9004</mysql_port>
postgresql_port
用于通过 PostgreSQL 协议与客户端通信的端口。
- 正整数指定要监听的端口号
- 空值用于禁用通过 MySQL 协议与客户端的通信。
示例
<postgresql_port>9005</postgresql_port>
tmp_path
本地文件系统上用于存储处理大型查询的临时数据的路径。
- 只能使用一个选项来配置临时数据存储:
tmp_path
、tmp_policy
、temporary_data_in_cache
。 - 尾部斜杠是强制性的。
示例
<tmp_path>/var/lib/clickhouse/tmp/</tmp_path>
user_files_path
包含用户文件的目录。用于表函数 file(), fileCluster()。
示例
<user_files_path>/var/lib/clickhouse/user_files/</user_files_path>
user_scripts_path
包含用户脚本文件的目录。用于可执行用户定义函数 可执行用户定义函数。
示例
<user_scripts_path>/var/lib/clickhouse/user_scripts/</user_scripts_path>
类型
默认值
user_defined_path
包含用户定义文件的目录。用于 SQL 用户定义函数 SQL 用户定义函数。
示例
<user_defined_path>/var/lib/clickhouse/user_defined/</user_defined_path>
users_config
包含以下内容的文件路径
- 用户配置。
- 访问权限。
- 设置配置文件。
- 配额设置。
示例
<users_config>users.xml</users_config>
wait_dictionaries_load_at_startup
此设置允许在 dictionaries_lazy_load
为 false
时指定行为。(如果 dictionaries_lazy_load
为 true
,则此设置不影响任何内容。)
如果 wait_dictionaries_load_at_startup
为 false
,则服务器将在启动时开始加载所有字典,并且它将与加载并行接收连接。当首次在查询中使用字典时,如果字典尚未加载,则查询将等待直到字典加载完成。将 wait_dictionaries_load_at_startup
设置为 false
可以使 ClickHouse 启动更快,但是某些查询的执行速度可能会变慢(因为它们将不得不等待某些字典加载)。
如果 wait_dictionaries_load_at_startup
为 true
,则服务器将在启动时等待直到所有字典完成加载(成功或失败),然后再接收任何连接。
示例
<wait_dictionaries_load_at_startup>true</wait_dictionaries_load_at_startup>
默认值: true
zookeeper
包含允许 ClickHouse 与 ZooKeeper 集群交互的设置。当使用复制表时,ClickHouse 使用 ZooKeeper 存储副本的元数据。如果未使用复制表,则可以省略此参数部分。
此部分包含以下参数
参数 | 描述 |
---|---|
node | ZooKeeper 端点。您可以设置多个端点。例如 <node index="1"><host>example_host</host><port>2181</port></node> 。index 属性指定尝试连接到 ZooKeeper 集群时的节点顺序。 |
session_timeout_ms | 客户端会话的最长超时时间(以毫秒为单位)。 |
operation_timeout_ms | 单个操作的最长超时时间(以毫秒为单位)。 |
root (可选) | 用作 ClickHouse 服务器使用的 znodes 的根 znode。 |
fallback_session_lifetime.min (可选) | 当主节点不可用(负载均衡)时,ZooKeeper 会话到后备节点的最小生存时间限制。以秒为单位设置。默认值:3 小时。 |
fallback_session_lifetime.max (可选) | 当主节点不可用(负载均衡)时,ZooKeeper 会话到后备节点的最大生存时间限制。以秒为单位设置。默认值:6 小时。 |
identity (可选) | ZooKeeper 访问请求的 znodes 所需的用户和密码。 |
use_compression (可选) | 如果设置为 true,则在 Keeper 协议中启用压缩。 |
还有一个 zookeeper_load_balancing
参数(可选),可用于选择 ZooKeeper 节点选择的算法
算法名称 | 描述 |
---|---|
random | 随机选择一个 ZooKeeper 节点。 |
in_order | 选择第一个 ZooKeeper 节点,如果不可用,则选择第二个,依此类推。 |
nearest_hostname | 选择主机名与服务器主机名最相似的 ZooKeeper 节点,主机名与名称前缀进行比较。 |
hostname_levenshtein_distance | 与 nearest_hostname 类似,但它以 Levenshtein 距离方式比较主机名。 |
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>
</zookeeper>
另请参阅
use_minimalistic_part_header_in_zookeeper
ZooKeeper 中数据部分标头的存储方法。此设置仅适用于 MergeTree
系列。可以指定
全局地在 config.xml
文件的 merge_tree 部分中
ClickHouse 对服务器上的所有表使用此设置。您可以随时更改设置。现有表会在设置更改时更改其行为。
对于每个表
创建表时,请指定相应的引擎设置。即使全局设置更改,现有表的行为也不会改变。
可能的值
0
— 功能已关闭。1
— 功能已开启。
如果 use_minimalistic_part_header_in_zookeeper = 1
,则 replicated 表会使用单个 znode
紧凑地存储数据部分的标头。如果表包含许多列,则此存储方法可以显著减少存储在 ZooKeeper 中的数据量。
应用 use_minimalistic_part_header_in_zookeeper = 1
后,您无法将 ClickHouse 服务器降级到不支持此设置的版本。在集群中的服务器上升级 ClickHouse 时要小心。不要一次升级所有服务器。最好在测试环境或集群中的少数几台服务器上测试新版本的 ClickHouse。
已经使用此设置存储的数据部分标头无法恢复为其之前的(非紧凑型)表示形式。
类型:UInt8
默认值: 0
distributed_ddl
管理在集群上执行 分布式 DDL 查询 (CREATE
、DROP
、ALTER
、RENAME
)。仅当 ZooKeeper 启用时才有效。
<distributed_ddl>
中的可配置设置包括
设置 | 描述 | 默认值 |
---|---|---|
path | Keeper 中用于 DDL 查询的 task_queue 的路径 | |
profile | 用于执行 DDL 查询的 profile | |
pool_size | 可以同时运行多少个 ON CLUSTER 查询 | |
max_tasks_in_queue | 队列中可以容纳的最大任务数。 | 1,000 |
task_max_lifetime | 如果节点的年龄大于此值,则删除节点。 | 7 * 24 * 60 * 60 (一周,以秒为单位) |
cleanup_delay_period | 如果上次清理时间不早于 cleanup_delay_period 秒前,则在收到新的节点事件后开始清理。 | 60 秒 |
示例
<distributed_ddl>
<!-- Path in ZooKeeper to queue with DDL queries -->
<path>/clickhouse/task_queue/ddl</path>
<!-- Settings from this profile will be used to execute DDL queries -->
<profile>default</profile>
<!-- Controls how much ON CLUSTER queries can be run simultaneously. -->
<pool_size>1</pool_size>
<!--
Cleanup settings (active tasks will not be removed)
-->
<!-- Controls task TTL (default 1 week) -->
<task_max_lifetime>604800</task_max_lifetime>
<!-- Controls how often cleanup should be performed (in seconds) -->
<cleanup_delay_period>60</cleanup_delay_period>
<!-- Controls how many tasks could be in the queue -->
<max_tasks_in_queue>1000</max_tasks_in_queue>
</distributed_ddl>
access_control_path
ClickHouse 服务器存储通过 SQL 命令创建的用户和角色配置的文件夹路径。
另请参阅
类型: String
默认值:/var/lib/clickhouse/access/
。
user_directories
配置文件中包含设置的部分
- 包含预定义用户的配置文件的路径。
- 存储通过 SQL 命令创建的用户的文件夹路径。
- ZooKeeper 节点路径,用于存储和复制通过 SQL 命令创建的用户(实验性功能)。
如果指定了此部分,则不会使用来自 users_config 和 access_control_path 的路径。
user_directories
部分可以包含任意数量的项,项的顺序表示其优先级(项的位置越高,优先级越高)。
示例
<user_directories>
<users_xml>
<path>/etc/clickhouse-server/users.xml</path>
</users_xml>
<local_directory>
<path>/var/lib/clickhouse/access/</path>
</local_directory>
</user_directories>
用户、角色、行策略、配额和 profile 也可以存储在 ZooKeeper 中
<user_directories>
<users_xml>
<path>/etc/clickhouse-server/users.xml</path>
</users_xml>
<replicated>
<zookeeper_path>/clickhouse/access/</zookeeper_path>
</replicated>
</user_directories>
您还可以定义 memory
部分 — 表示仅在内存中存储信息,而不写入磁盘;以及 ldap
部分 — 表示在 LDAP 服务器上存储信息。
要将 LDAP 服务器添加为未在本地定义用户的远程用户目录,请定义一个包含以下参数的 ldap
部分
参数 | 描述 |
---|---|
server | 在 ldap_servers 配置部分中定义的 LDAP 服务器名称之一。此参数是必需的,不能为空。 |
roles | 包含本地定义的角色列表的部分,这些角色将分配给从 LDAP 服务器检索的每个用户。如果未指定任何角色,则用户在身份验证后将无法执行任何操作。如果在身份验证时任何列出的角色未在本地定义,则身份验证尝试将失败,就像提供的密码不正确一样。 |
示例
<ldap>
<server>my_ldap_server</server>
<roles>
<my_local_role1 />
<my_local_role2 />
</roles>
</ldap>
total_memory_profiler_step
设置每个峰值分配步骤中堆栈跟踪的内存大小(以字节为单位)。数据存储在 system.trace_log 系统表中,其中 query_id
等于空字符串。
默认值:4194304
。
total_memory_tracker_sample_probability
允许收集随机分配和释放,并将它们写入 system.trace_log 系统表中,其中 trace_type
等于具有指定概率的 MemorySample
。概率适用于每次分配或释放,无论分配大小如何。请注意,仅当未跟踪内存量超过未跟踪内存限制(默认值为 4
MiB)时才会进行采样。如果降低 total_memory_profiler_step,则可以降低此限制。您可以将 total_memory_profiler_step
设置为 1
以进行更精细的采样。
可能的值
- 正整数。
0
— 禁用在system.trace_log
系统表中写入随机分配和释放。
默认值:0
。
compiled_expression_cache_size
设置 已编译表达式 的缓存大小(以字节为单位)。
默认值:134217728
。
compiled_expression_cache_elements_size
设置 已编译表达式 的缓存大小(以元素为单位)。
默认值:10000
。
display_secrets_in_show_and_select
启用或禁用在 SHOW
和 SELECT
查询中显示表、数据库、表函数和字典的密钥。
希望查看密钥的用户还必须启用 format_display_secrets_in_show_and_select
格式设置 和 displaySecretsInShowAndSelect
权限。
可能的值
0
— 已禁用。1
— 已启用。
默认值: 0
proxy
为 HTTP 和 HTTPS 请求定义代理服务器,当前 S3 存储、S3 表函数和 URL 函数支持代理服务器。
有三种定义代理服务器的方法
- 环境变量
- 代理列表
- 远程代理解析器。
使用 no_proxy
也支持绕过特定主机的代理服务器。
环境变量
http_proxy
和 https_proxy
环境变量允许您为给定协议指定代理服务器。如果您在系统上设置了它,它应该可以无缝工作。
如果给定协议只有一个代理服务器且该代理服务器不更改,这是最简单的方法。
代理列表
此方法允许您为一个协议指定一个或多个代理服务器。如果定义了多个代理服务器,ClickHouse 会以轮询方式使用不同的代理,从而平衡服务器之间的负载。如果一个协议有多个代理服务器且代理服务器列表不更改,这是最简单的方法。
配置模板
<proxy>
<http>
<uri>http://proxy1</uri>
<uri>http://proxy2:3128</uri>
</http>
<https>
<uri>http://proxy1:3128</uri>
</https>
</proxy>
在下面的选项卡中选择父字段以查看其子字段
- <proxy>
- <http> 和 <https>
字段 | 描述 |
---|---|
<http> | 一个或多个 HTTP 代理的列表 |
<https> | 一个或多个 HTTPS 代理的列表 |
字段 | 描述 |
---|---|
<uri> | 代理的 URI |
远程代理解析器
代理服务器可能会动态更改。在这种情况下,您可以定义解析器的端点。ClickHouse 向该端点发送一个空的 GET 请求,远程解析器应返回代理主机。ClickHouse 将使用它来使用以下模板形成代理 URI:{proxy_scheme}://{proxy_host}:{proxy_port}
配置模板
<proxy>
<http>
<resolver>
<endpoint>http://resolver:8080/hostname</endpoint>
<proxy_scheme>http</proxy_scheme>
<proxy_port>80</proxy_port>
<proxy_cache_time>10</proxy_cache_time>
</resolver>
</http>
<https>
<resolver>
<endpoint>http://resolver:8080/hostname</endpoint>
<proxy_scheme>http</proxy_scheme>
<proxy_port>3128</proxy_port>
<proxy_cache_time>10</proxy_cache_time>
</resolver>
</https>
</proxy>
在下面的选项卡中选择父字段以查看其子字段
- <proxy>
- <http> 和 <https>
- <resolver>
字段 | 描述 |
---|---|
<http> | 一个或多个解析器的列表* |
<https> | 一个或多个解析器的列表* |
字段 | 描述 |
---|---|
<resolver> | 解析器的端点和其他详细信息 |
您可以有多个 <resolver>
元素,但仅使用给定协议的第一个 <resolver>
。该协议的任何其他 <resolver>
元素都将被忽略。这意味着负载均衡(如果需要)应由远程解析器实现。
字段 | 描述 |
---|---|
<endpoint> | 代理解析器的 URI |
<proxy_scheme> | 最终代理 URI 的协议。可以是 http 或 https 。 |
<proxy_port> | 代理解析器的端口号 |
<proxy_cache_time> | ClickHouse 应该缓存来自解析器的值的秒数。将此值设置为 0 会导致 ClickHouse 为每个 HTTP 或 HTTPS 请求联系解析器。 |
优先级
代理设置按以下顺序确定
顺序 | 设置 |
---|---|
1. | 远程代理解析器 |
2. | 代理列表 |
3. | 环境变量 |
ClickHouse 将检查请求协议的最高优先级解析器类型。如果未定义,它将检查下一个最高优先级解析器类型,直到到达环境变量解析器。这也允许混合使用解析器类型。
disable_tunneling_for_https_requests_over_http_proxy
默认情况下,隧道(即 HTTP CONNECT)用于通过 HTTP 代理发出 HTTPS 请求。此设置可用于禁用它。
no_proxy
默认情况下,所有请求都将通过代理。为了为特定主机禁用它,必须设置 no_proxy
变量。可以在 <proxy>
子句中为列表和远程解析器设置它,也可以作为环境变量为环境变量解析器设置它。它支持 IP 地址、域、子域和 '*'
通配符以实现完全绕过。前导点会被剥离,就像 curl 所做的那样。
示例
以下配置绕过对 clickhouse.cloud
及其所有子域(例如 auth.clickhouse.cloud
)的代理请求。这同样适用于 GitLab,即使它有一个前导点。gitlab.com
和 about.gitlab.com
都会绕过代理。
<proxy>
<no_proxy>clickhouse.cloud,.gitlab.com</no_proxy>
<http>
<uri>http://proxy1</uri>
<uri>http://proxy2:3128</uri>
</http>
<https>
<uri>http://proxy1:3128</uri>
</https>
</proxy>
max_materialized_views_count_for_table
附加到表的物化视图数量的限制。
这里只考虑直接依赖的视图,而不考虑在一个视图之上创建另一个视图。
默认值:0
。
format_alter_operations_with_parentheses
如果设置为 true
,则 alter 操作将在格式化查询中用括号括起来。这使得格式化 alter 查询的解析不太容易产生歧义。
类型: Bool
默认值: 0
ignore_empty_sql_security_in_create_view_query
如果为 true,则 ClickHouse 不会在 CREATE VIEW
查询中为空的 SQL security 语句写入默认值。
此设置仅在迁移期间是必要的,并且将在 24.4 版本中过时
类型: Bool
默认值: 1
merge_workload
用于调节合并和其他工作负载之间如何利用和共享资源。指定值用作所有后台合并的 workload
设置值。可以被 merge tree 设置覆盖。
类型: String
默认值: default
另请参阅
mutation_workload
用于调节 mutation 和其他工作负载之间如何利用和共享资源。指定值用作所有后台 mutation 的 workload
设置值。可以被 merge tree 设置覆盖。
另请参阅
类型: String
默认值: default
workload_path
用作所有 CREATE WORKLOAD
和 CREATE RESOURCE
查询的存储的目录。默认情况下,使用服务器工作目录下的 /workload/
文件夹。
示例
<workload_path>/var/lib/clickhouse/workload/</workload_path>
另请参阅
workload_zookeeper_path
ZooKeeper 节点的路径,用作所有 CREATE WORKLOAD
和 CREATE RESOURCE
查询的存储。为了保持一致性,所有 SQL 定义都存储为此单个 znode 的值。默认情况下,不使用 ZooKeeper,定义存储在 磁盘上。
示例
<workload_zookeeper_path>/clickhouse/workload/definitions.sql</workload_zookeeper_path>
另请参阅
use_legacy_mongodb_integration
使用旧版 MongoDB 集成实现。已弃用。
类型: Bool
默认值:true
。
max_authentication_methods_per_user
用户可以创建或更改的最大身份验证方法数。更改此设置不会影响现有用户。如果创建/更改身份验证相关查询超出此设置中指定的限制,则会失败。非身份验证创建/更改查询将成功。
值 0
表示无限制。
类型: UInt64
默认值: 100
allow_feature_tier
控制用户是否可以更改与不同功能层相关的设置。
0
- 允许更改任何设置(实验性、beta 版、生产版)。1
- 仅允许更改 beta 版和生产版功能设置。拒绝更改实验性设置。2
- 仅允许更改生产版设置。拒绝更改实验性或 beta 版设置。
这相当于对所有 EXPERIMENTAL
/ BETA
功能设置只读约束。
值为 0
表示可以更改所有设置。
类型: UInt32
默认值: 0