服务器配置
builtin_dictionaries_reload_interval
重新加载内置字典的间隔时间(以秒为单位)。
ClickHouse每x秒重新加载内置字典。 这使得编辑字典 “on the fly”,而无需重新启动服务器。
默认值:3600.
示例
压缩
数据压缩配置 MergeTree-引擎表。
!!! warning "警告" 如果您刚开始使用ClickHouse,请不要使用它。
配置模板:
<case>
参数:
min_part_size
– The minimum size of a data part.min_part_size_ratio
– The ratio of the data part size to the table size.method
– Compression method. Acceptable values:lz4
或zstd
.
您可以配置多个 <case>
部分。
满足条件时的操作:
- 如果数据部分与条件集匹配,ClickHouse将使用指定的压缩方法。
- 如果数据部分匹配多个条件集,ClickHouse将使用第一个匹配的条件集。
如果没有满足数据部分的条件,ClickHouse使用 lz4
压缩。
示例
default_database
默认数据库。
要获取数据库列表,请使用 SHOW DATABASES 查询。
示例
default_profile
默认配置文件。
配置文件位于user_config
参数指定的文件中 .
示例
dictionaries_config
外部字典的配置文件的路径。
路径:
- 指定相对于服务器配置文件的绝对路径或路径。
- 路径可以包含通配符*和?.
另请参阅 “外部字典”.
示例
dictionaries_lazy_load
延迟加载字典。
如果 true
,然后在第一次使用时创建每个字典。 如果字典创建失败,则使用该字典的函数将引发异常。
如果 false
,服务器启动时创建所有字典,如果出现错误,服务器将关闭。
默认值为 true
.
示例
format_schema_path
包含输入数据方案的目录路径,例如输入数据的方案 CapnProto 格式。
示例
石墨
将数据发送到 石墨.
设置:
- host – The Graphite server.
- port – The port on the Graphite server.
- interval – The interval for sending, in seconds.
- timeout – The timeout for sending data, in seconds.
- root_path – Prefix for keys.
- metrics – Sending data from the 系统。指标 桌子
- events – Sending deltas data accumulated for the time period from the 系统。活动 桌子
- events_cumulative – Sending cumulative data from the 系统。活动 桌子
- asynchronous_metrics – Sending data from the 系统。asynchronous_metrics 桌子
您可以配置多个 <graphite>
条款 例如,您可以使用它以不同的时间间隔发送不同的数据。
示例
graphite_rollup
石墨细化数据的设置。
有关详细信息,请参阅 GraphiteMergeTree.
示例
http_port/https_port
通过HTTP连接到服务器的端口。
如果 https_port
被指定, openSSL 必须配置。
如果 http_port
指定时,即使设置了OpenSSL配置,也会忽略该配置。
示例
http_server_default_response
访问ClickHouse HTTP(s)服务器时默认显示的页面。 默认值为 “Ok.” (最后有换行符)
示例
打开 https://tabix.io/
访问时 http://localhost: http_port
.
包括_从
带替换的文件的路径。
有关详细信息,请参阅部分 “配置文件”.
示例
interserver_http_port
用于在ClickHouse服务器之间交换数据的端口。
示例
interserver_http_host
其他服务器可用于访问此服务器的主机名。
如果省略,它以相同的方式作为定义 hostname-f
指挥部
用于脱离特定的网络接口。
示例
interserver_http_credentials
用户名和密码用于在以下期间进行身份验证 复制 与复制*引擎。 这些凭据仅用于副本之间的通信,与ClickHouse客户端的凭据无关。 服务器正在检查这些凭据以连接副本,并在连接到其他副本时使用相同的凭据。 因此,这些凭据应该为集群中的所有副本设置相同。 默认情况下,不使用身份验证。
本节包含以下参数:
user
— username.password
— password.
示例
keep_alive_timeout
ClickHouse在关闭连接之前等待传入请求的秒数。默认为10秒。
示例
listen_host
对请求可能来自的主机的限制。 如果您希望服务器回答所有这些问题,请指定 ::
.
例:
记录器
日志记录设置。
键:
- level – Logging level. Acceptable values:
trace
,debug
,information
,warning
,error
. - log – The log file. Contains all the entries according to
level
. - errorlog – Error log file.
- size – Size of the file. Applies to
log
和errorlog
. 一旦文件到达size
,ClickHouse存档并重命名它,并在其位置创建一个新的日志文件。 - count – The number of archived log files that ClickHouse stores.
示例
还支持写入系统日志。 配置示例:
键:
- use_syslog — Required setting if you want to write to the syslog.
- address — The host[:port] of syslogd. If omitted, the local daemon is used.
- hostname — Optional. The name of the host that logs are sent from.
- facility — 系统日志工具关键字 在大写字母与 “LOG_” 前缀: (
LOG_USER
,LOG_DAEMON
,LOG_LOCAL3
,等等)。 默认值:LOG_USER
如果address
被指定,LOG_DAEMON otherwise.
- format – Message format. Possible values:
bsd
和syslog.
宏
复制表的参数替换。
如果不使用复制的表,则可以省略。
有关详细信息,请参阅部分 “创建复制的表”.
示例
mark_cache_size
表引擎使用的标记缓存的近似大小(以字节为单位) MergeTree 家人
缓存为服务器共享,并根据需要分配内存。 缓存大小必须至少为5368709120。
示例
max_concurrent_queries
同时处理的请求的最大数量。
示例
max_connections
入站连接的最大数量。
示例
max_open_files
打开文件的最大数量。
默认情况下: maximum
.
我们建议在Mac OS X中使用此选项,因为 getrlimit()
函数返回一个不正确的值。
示例
max_table_size_to_drop
限制删除表。
如果一个大小 MergeTree 表超过 max_table_size_to_drop
(以字节为单位),您无法使用删除查询将其删除。
如果仍然需要在不重新启动ClickHouse服务器的情况下删除表,请创建 <clickhouse-path>/flags/force_drop_table
文件并运行DROP查询。
默认值:50GB。
值0表示您可以删除所有表而不受任何限制。
示例
merge_tree
微调中的表 MergeTree.
有关详细信息,请参阅MergeTreeSettings。h头文件。
示例
openSSL
SSL客户端/服务器配置。
对SSL的支持由 libpoco
图书馆. 该接口在文件中描述 SSLManager.h
服务器/客户端设置的密钥:
- privateKeyFile – The path to the file with the secret key of the PEM certificate. The file may contain a key and certificate at the same time.
- certificateFile – The path to the client/server certificate file in PEM format. You can omit it if
privateKeyFile
包含证书。 - caConfig – The path to the file or directory that contains trusted root certificates.
- verificationMode – The method for checking the node’s certificates. Details are in the description of the A.背景 同学们 可能的值:
none
,relaxed
,strict
,once
. - verificationDepth – The maximum length of the verification chain. Verification will fail if the certificate chain length exceeds the set value.
- loadDefaultCAFile – Indicates that built-in CA certificates for OpenSSL will be used. Acceptable values:
true
,false
. | - cipherList – Supported OpenSSL encryptions. For example:
ALL:!ADH:!LOW:!EXP:!MD5:!3DES:@STRENGTH
. - cacheSessions – Enables or disables caching sessions. Must be used in combination with
sessionIdContext
. 可接受的值:true
,false
. - sessionIdContext – A unique set of random characters that the server appends to each generated identifier. The length of the string must not exceed
SSL_MAX_SSL_SESSION_ID_LENGTH
. 始终建议使用此参数,因为如果服务器缓存会话,以及客户端请求缓存,它有助于避免出现问题。 默认值:${application.name}
. - sessionCacheSize – The maximum number of sessions that the server caches. Default value: 1024*20. 0 – Unlimited sessions.
- sessionTimeout – Time for caching the session on the server.
- extendedVerification – Automatically extended verification of certificates after the session ends. Acceptable values:
true
,false
. - requireTLSv1 – Require a TLSv1 connection. Acceptable values:
true
,false
. - requireTLSv1_1 – Require a TLSv1.1 connection. Acceptable values:
true
,false
. - requireTLSv1_2 – Require a TLSv1.2 connection. Acceptable values:
true
,false
. - fips – Activates OpenSSL FIPS mode. Supported if the library’s OpenSSL version supports FIPS.
- privateKeyPassphraseHandler – Class (PrivateKeyPassphraseHandler subclass) that requests the passphrase for accessing the private key. For example:
<privateKeyPassphraseHandler>
,<name>KeyFileHandler</name>
,<options><password>test</password></options>
,</privateKeyPassphraseHandler>
. - invalidCertificateHandler – Class (a subclass of CertificateHandler) for verifying invalid certificates. For example:
<invalidCertificateHandler> <name>RejectCertificateHandler</name> </invalidCertificateHandler>
. - disableProtocols – Protocols that are not allowed to use.
- preferServerCiphers – Preferred server ciphers on the client.
设置示例:
part_log
记录与之关联的事件 MergeTree. 例如,添加或合并数据。 您可以使用日志来模拟合并算法并比较它们的特征。 您可以可视化合并过程。
查询记录在 系统。part_log 表,而不是在一个单独的文件。 您可以在以下命令中配置此表的名称 table
参数(见下文)。
使用以下参数配置日志记录:
database
– Name of the database.table
– Name of the system table.partition_by
– Sets a 自定义分区键.flush_interval_milliseconds
– Interval for flushing data from the buffer in memory to the table.
示例
路径
包含数据的目录的路径。
尾部斜杠是强制性的。
示例
query_log
用于记录接收到的查询的设置 log_queries=1 设置。
查询记录在 系统。query_log 表,而不是在一个单独的文件。 您可以更改表的名称 table
参数(见下文)。
使用以下参数配置日志记录:
database
– Name of the database.table
– Name of the system table the queries will be logged in.partition_by
– Sets a 自定义分区键 为了一张桌子flush_interval_milliseconds
– Interval for flushing data from the buffer in memory to the table.
如果该表不存在,ClickHouse将创建它。 如果在ClickHouse服务器更新时查询日志的结构发生了更改,则会重命名具有旧结构的表,并自动创建新表。
示例
query_thread_log
设置用于记录接收到的查询的线程 log_query_threads=1 设置。
查询记录在 系统。query_thread_log 表,而不是在一个单独的文件。 您可以更改表的名称 table
参数(见下文)。
使用以下参数配置日志记录:
database
– Name of the database.table
– Name of the system table the queries will be logged in.partition_by
– Sets a 自定义分区键 对于一个系统表。flush_interval_milliseconds
– Interval for flushing data from the buffer in memory to the table.
如果该表不存在,ClickHouse将创建它。 如果更新ClickHouse服务器时查询线程日志的结构发生了更改,则会重命名具有旧结构的表,并自动创建新表。
示例
trace_log
设置为 trace_log 系统表操作。
参数:
database
— Database for storing a table.table
— Table name.partition_by
— 自定义分区键 对于一个系统表。flush_interval_milliseconds
— Interval for flushing data from the buffer in memory to the table.
默认服务器配置文件 config.xml
包含以下设置部分:
query_masking_rules
基于正则表达式的规则,在将查询以及所有日志消息存储在服务器日志中之前,这些规则将应用于查询以及所有日志消息,
system.query_log
, system.text_log
, system.processes
表,并在日志中发送给客户端。 这允许防止
从SQL查询敏感数据泄漏(如姓名,电子邮件,个人
标识符或信用卡号码)记录。
示例
配置字段:
name
-规则的名称(可选)regexp
-RE2兼容正则表达式(强制性)replace
-敏感数据的替换字符串(可选,默认情况下-六个星号)
屏蔽规则应用于整个查询(以防止敏感数据从格式错误/不可解析的查询泄漏)。
system.events
表有计数器 QueryMaskingRulesMatch
其中具有匹配的查询屏蔽规则的总数。
对于分布式查询,每个服务器必须单独配置,否则,子查询传递给其他 节点将被存储而不屏蔽。
remote_servers
所使用的集群的配置 分布 表引擎和由 cluster
表功能。
示例
对于该值 incl
属性,请参阅部分 “配置文件”.
另请参阅
时区
服务器的时区。
指定为UTC时区或地理位置(例如,非洲/阿比让)的IANA标识符。
当DateTime字段输出为文本格式(打印在屏幕上或文件中)时,以及从字符串获取DateTime时,时区对于字符串和DateTime格式之间的转换是必需的。 此外,如果在输入参数中没有收到时区,则时区用于处理时间和日期的函数。
示例
tcp_port
通过TCP协议与客户端通信的端口。
示例
tcp_port_secure
TCP端口,用于与客户端进行安全通信。 使用它与 OpenSSL 设置。
可能的值
整数。
默认值
mysql_port
通过MySQL协议与客户端通信的端口。
可能的值
整数。
示例
tmp_path
用于处理大型查询的临时数据的路径。
尾部斜杠是强制性的。
示例
tmp_policy
从政策 storage_configuration
存储临时文件。
如果没有设置 tmp_path
被使用,否则被忽略。
move_factor
被忽略keep_free_space_bytes
被忽略max_data_part_size_bytes
被忽略 -您必须在该政策中只有一个卷
uncompressed_cache_size
表引擎使用的未压缩数据的缓存大小(以字节为单位) MergeTree.
服务器有一个共享缓存。 内存按需分配。 如果选项使用缓存 use_uncompressed_cache 被启用。
在个别情况下,未压缩的缓存对于非常短的查询是有利的。
示例
user_files_path
包含用户文件的目录。 在表函数中使用 文件().
示例
users_config
包含文件的路径:
- 用户配置。
- 访问权限。
- 设置配置文件。
- 配额设置。
示例
zookeeper
包含允许ClickHouse与 zookeeper 集群。
ClickHouse使用ZooKeeper存储复制表副本的元数据。 如果未使用复制的表,则可以省略此部分参数。
本节包含以下参数:
-
node
— ZooKeeper endpoint. You can set multiple endpoints.例如:
The index
attribute specifies the node order when trying to connect to the ZooKeeper cluster.
session_timeout
— Maximum timeout for the client session in milliseconds.root
— The znode被用作根由ClickHouse服务器使用znodes 可选。identity
— User and password, that can be required by ZooKeeper to give access to requested znodes. Optional.
配置示例
另请参阅
use_minimalistic_part_header_in_zookeeper
ZooKeeper中数据部分头的存储方法。
此设置仅适用于 MergeTree
家人 它可以指定:
-
在全球范围内 merge_tree 一节
config.xml
文件ClickHouse使用服务器上所有表的设置。 您可以随时更改设置。 当设置更改时,现有表会更改其行为。
-
对于每个表。
创建表时,指定相应的 发动机设置. 即使全局设置更改,具有此设置的现有表的行为也不会更改。
可能的值
- 0 — Functionality is turned off.
- 1 — Functionality is turned on.
如果 use_minimalistic_part_header_in_zookeeper = 1
,然后 复制 表存储的数据部分的头紧凑使用一个单一的 znode
. 如果表包含许多列,则此存储方法显着减少了Zookeeper中存储的数据量。
申请后 use_minimalistic_part_header_in_zookeeper = 1
,您不能将ClickHouse服务器降级到不支持此设置的版本。 在集群中的服务器上升级ClickHouse时要小心。 不要一次升级所有服务器。 在测试环境中或在集群的几台服务器上测试ClickHouse的新版本更安全。
Data part headers already stored with this setting can't be restored to their previous (non-compact) representation.
默认值: 0.
disable_internal_dns_cache
禁用内部DNS缓存。 推荐用于在系统中运行ClickHouse 随着频繁变化的基础设施,如Kubernetes。
默认值: 0.
dns_cache_update_period
更新存储在ClickHouse内部DNS缓存中的IP地址的周期(以秒为单位)。 更新是在一个单独的系统线程中异步执行的。
默认值: 15.