Server Settings

builtin_dictionaries_reload_interval

The interval in seconds before reloading built-in dictionaries.

ClickHouse reloads built-in dictionaries every x seconds. This makes it possible to edit dictionaries “on the fly” without restarting the server.

Default value: 3600.

Example

  1. <builtin_dictionaries_reload_interval>3600</builtin_dictionaries_reload_interval>

compression

Data compression settings for MergeTree-engine tables.

Warning

Don’t use it if you have just started using ClickHouse.

Configuration template:

  1. <compression>
  2. <case>
  3. <min_part_size>...</min_part_size>
  4. <min_part_size_ratio>...</min_part_size_ratio>
  5. <method>...</method>
  6. </case>
  7. ...
  8. </compression>

<case> fields:

  • 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 or zstd.

You can configure multiple <case> sections.

Actions when conditions are met:

  • If a data part matches a condition set, ClickHouse uses the specified compression method.
  • If a data part matches multiple condition sets, ClickHouse uses the first matched condition set.

If no conditions met for a data part, ClickHouse uses the lz4 compression.

Example

  1. <compression incl="clickhouse_compression">
  2. <case>
  3. <min_part_size>10000000000</min_part_size>
  4. <min_part_size_ratio>0.01</min_part_size_ratio>
  5. <method>zstd</method>
  6. </case>
  7. </compression>

custom_settings_prefixes

List of prefixes for custom settings. The prefixes must be separated with commas.

Example

  1. <custom_settings_prefixes>custom_</custom_settings_prefixes>

See Also

core_dump

Configures soft limit for core dump file size.

Possible values:

  • Positive integer.

Default value: 1073741824 (1 GB).

Note

Hard limit is configured via system tools

Example

  1. <core_dump>
  2. <size_limit>1073741824</size_limit>
  3. </core_dump>

default_database

The default database.

To get a list of databases, use the SHOW DATABASES query.

Example

  1. <default_database>default</default_database>

default_profile

Default settings profile.

Settings profiles are located in the file specified in the parameter user_config.

Example

  1. <default_profile>default</default_profile>

dictionaries_config

The path to the config file for external dictionaries.

Path:

  • Specify the absolute path or the path relative to the server config file.
  • The path can contain wildcards * and ?.

See also “External dictionaries”.

Example

  1. <dictionaries_config>*_dictionary.xml</dictionaries_config>

dictionaries_lazy_load

Lazy loading of dictionaries.

If true, then each dictionary is created on first use. If dictionary creation failed, the function that was using the dictionary throws an exception.

If false, all dictionaries are created when the server starts, if the dictionary or dictionaries are created too long or are created with errors, then the server boots without of these dictionaries and continues to try to create these dictionaries.

The default is true.

Example

  1. <dictionaries_lazy_load>true</dictionaries_lazy_load>

format_schema_path

The path to the directory with the schemes for the input data, such as schemas for the CapnProto format.

Example

  1. <!-- Directory containing schema files for various input formats. -->
  2. <format_schema_path>format_schemas/</format_schema_path>

graphite

Sending data to Graphite.

Settings:

  • 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 system.metrics table.
  • events – Sending deltas data accumulated for the time period from the system.events table.
  • events_cumulative – Sending cumulative data from the system.events table.
  • asynchronous_metrics – Sending data from the system.asynchronous_metrics table.

You can configure multiple <graphite> clauses. For instance, you can use this for sending different data at different intervals.

Example

  1. <graphite>
  2. <host>localhost</host>
  3. <port>42000</port>
  4. <timeout>0.1</timeout>
  5. <interval>60</interval>
  6. <root_path>one_min</root_path>
  7. <metrics>true</metrics>
  8. <events>true</events>
  9. <events_cumulative>false</events_cumulative>
  10. <asynchronous_metrics>true</asynchronous_metrics>
  11. </graphite>

graphite_rollup

Settings for thinning data for Graphite.

For more details, see GraphiteMergeTree.

Example

  1. <graphite_rollup_example>
  2. <default>
  3. <function>max</function>
  4. <retention>
  5. <age>0</age>
  6. <precision>60</precision>
  7. </retention>
  8. <retention>
  9. <age>3600</age>
  10. <precision>300</precision>
  11. </retention>
  12. <retention>
  13. <age>86400</age>
  14. <precision>3600</precision>
  15. </retention>
  16. </default>
  17. </graphite_rollup_example>

http_port/https_port

The port for connecting to the server over HTTP(s).

If https_port is specified, openSSL must be configured.

If http_port is specified, the OpenSSL configuration is ignored even if it is set.

Example

  1. <https_port>9999</https_port>

http_server_default_response

The page that is shown by default when you access the ClickHouse HTTP(s) server.
The default value is “Ok.” (with a line feed at the end)

Example

Opens https://tabix.io/ when accessing http://localhost: http_port.

  1. <http_server_default_response>
  2. <![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>]]>
  3. </http_server_default_response>

include_from

The path to the file with substitutions.

For more information, see the section “Configuration files”.

Example

  1. <include_from>/etc/metrica.xml</include_from>

interserver_http_port

Port for exchanging data between ClickHouse servers.

Example

  1. <interserver_http_port>9009</interserver_http_port>

interserver_http_host

The hostname that can be used by other servers to access this server.

If omitted, it is defined in the same way as the hostname-f command.

Useful for breaking away from a specific network interface.

Example

  1. <interserver_http_host>example.yandex.ru</interserver_http_host>

interserver_https_port

Port for exchanging data between ClickHouse servers over HTTPS.

Example

  1. <interserver_https_port>9010</interserver_https_port>

interserver_https_host

Similar to interserver_http_host, except that this hostname can be used by other servers to access this server over HTTPS.

Example

  1. <interserver_https_host>example.yandex.ru</interserver_https_host>

interserver_http_credentials

The username and password used to authenticate during replication with the Replicated* engines. These credentials are used only for communication between replicas and are unrelated to credentials for ClickHouse clients. The server is checking these credentials for connecting replicas and use the same credentials when connecting to other replicas. So, these credentials should be set the same for all replicas in a cluster.
By default, the authentication is not used.

Note: These credentials are common for replication through HTTP and HTTPS.

This section contains the following parameters:

  • user — username.
  • password — password.

Example

  1. <interserver_http_credentials>
  2. <user>admin</user>
  3. <password>222</password>
  4. </interserver_http_credentials>

keep_alive_timeout

The number of seconds that ClickHouse waits for incoming requests before closing the connection. Defaults to 3 seconds.

Example

  1. <keep_alive_timeout>3</keep_alive_timeout>

listen_host

Restriction on hosts that requests can come from. If you want the server to answer all of them, specify ::.

Examples:

  1. <listen_host>::1</listen_host>
  2. <listen_host>127.0.0.1</listen_host>

logger

Logging settings.

Keys:

  • 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 loganderrorlog. Once the file reaches size, ClickHouse archives and renames it, and creates a new log file in its place.
  • count – The number of archived log files that ClickHouse stores.

Example

  1. <logger>
  2. <level>trace</level>
  3. <log>/var/log/clickhouse-server/clickhouse-server.log</log>
  4. <errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>
  5. <size>1000M</size>
  6. <count>10</count>
  7. </logger>

Writing to the syslog is also supported. Config example:

  1. <logger>
  2. <use_syslog>1</use_syslog>
  3. <syslog>
  4. <address>syslog.remote:10514</address>
  5. <hostname>myhost.local</hostname>
  6. <facility>LOG_LOCAL6</facility>
  7. <format>syslog</format>
  8. </syslog>
  9. </logger>

Keys for syslog:

  • 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 — The syslog facility keyword in uppercase letters with the “LOG_” prefix: (LOG_USER, LOG_DAEMON, LOG_LOCAL3, and so on).
    Default value: LOG_USER if address is specified, LOG_DAEMON otherwise.
  • format – Message format. Possible values: bsd and syslog.

send_crash_reports

Settings for opt-in sending crash reports to the ClickHouse core developers team via Sentry.
Enabling it, especially in pre-production environments, is highly appreciated.

The server will need access to the public Internet via IPv4 (at the time of writing IPv6 is not supported by Sentry) for this feature to be functioning properly.

Keys:

  • enabled – Boolean flag to enable the feature, false by default. Set to true to allow sending crash reports.
  • endpoint – You can override the Sentry endpoint URL for sending crash reports. It can be either a separate Sentry account or your self-hosted Sentry instance. Use the Sentry DSN syntax.
  • anonymize - Avoid attaching the server hostname to the crash report.
  • http_proxy - Configure HTTP proxy for sending crash reports.
  • debug - Sets the Sentry client into debug mode.
  • tmp_path - Filesystem path for temporary crash report state.

Recommended way to use

  1. <send_crash_reports>
  2. <enabled>true</enabled>
  3. </send_crash_reports>

macros

Parameter substitutions for replicated tables.

Can be omitted if replicated tables are not used.

For more information, see the section “Creating replicated tables”.

Example

  1. <macros incl="macros" optional="true" />

mark_cache_size

Approximate size (in bytes) of the cache of marks used by table engines of the MergeTree family.

The cache is shared for the server and memory is allocated as needed. The cache size must be at least 5368709120.

Example

  1. <mark_cache_size>5368709120</mark_cache_size>

max_server_memory_usage

Limits total RAM usage by the ClickHouse server.

Possible values:

  • Positive integer.
  • 0 — Auto.

Default value: 0.

Additional Info

The default max_server_memory_usage value is calculated as memory_amount * max_server_memory_usage_to_ram_ratio.

See also

max_server_memory_usage_to_ram_ratio

Defines the fraction of total physical RAM amount, available to the Clickhouse server. If the server tries to utilize more, the memory is cut down to the appropriate amount.

Possible values:

  • Positive double.
  • 0 — The Clickhouse server can use all available RAM.

Default value: 0.

Usage

On hosts with low RAM and swap, you possibly need setting max_server_memory_usage_to_ram_ratio larger than 1.

Example

  1. <max_server_memory_usage_to_ram_ratio>0.9</max_server_memory_usage_to_ram_ratio>

See Also

max_concurrent_queries

The maximum number of simultaneously processed requests.

Example

  1. <max_concurrent_queries>100</max_concurrent_queries>

max_concurrent_queries_for_all_users

Throw exception if the value of this setting is less or equal than the current number of simultaneously processed queries.

Example: max_concurrent_queries_for_all_users can be set to 99 for all users and database administrator can set it to 100 for itself to run queries for investigation even when the server is overloaded.

Modifying the setting for one query or user does not affect other queries.

Default value: 0 that means no limit.

Example

  1. <max_concurrent_queries_for_all_users>99</max_concurrent_queries_for_all_users>

See Also

max_connections

The maximum number of inbound connections.

Example

  1. <max_connections>4096</max_connections>

max_open_files

The maximum number of open files.

By default: maximum.

We recommend using this option in Mac OS X since the getrlimit() function returns an incorrect value.

Example

  1. <max_open_files>262144</max_open_files>

max_table_size_to_drop

Restriction on deleting tables.

If the size of a MergeTree table exceeds max_table_size_to_drop (in bytes), you can’t delete it using a DROP query.

If you still need to delete the table without restarting the ClickHouse server, create the <clickhouse-path>/flags/force_drop_table file and run the DROP query.

Default value: 50 GB.

The value 0 means that you can delete all tables without any restrictions.

Example

  1. <max_table_size_to_drop>0</max_table_size_to_drop>

max_thread_pool_size

The maximum number of threads in the Global Thread pool.

Default value: 10000.

Example

  1. <max_thread_pool_size>12000</max_thread_pool_size>

merge_tree

Fine tuning for tables in the MergeTree.

For more information, see the MergeTreeSettings.h header file.

Example

  1. <merge_tree>
  2. <max_suspicious_broken_parts>5</max_suspicious_broken_parts>
  3. </merge_tree>

metric_log

It is enabled by default. If it`s not, you can do this manually.

Enabling

To manually turn on metrics history collection system.metric_log, create /etc/clickhouse-server/config.d/metric_log.xml with the following content:

  1. <yandex>
  2. <metric_log>
  3. <database>system</database>
  4. <table>metric_log</table>
  5. <flush_interval_milliseconds>7500</flush_interval_milliseconds>
  6. <collect_interval_milliseconds>1000</collect_interval_milliseconds>
  7. </metric_log>
  8. </yandex>

Disabling

To disable metric_log setting, you should create the following file /etc/clickhouse-server/config.d/disable_metric_log.xml with the following content:

  1. <yandex>
  2. <metric_log remove="1" />
  3. </yandex>

replicated_merge_tree

Fine tuning for tables in the ReplicatedMergeTree.

This setting has a higher priority.

For more information, see the MergeTreeSettings.h header file.

Example

  1. <replicated_merge_tree>
  2. <max_suspicious_broken_parts>5</max_suspicious_broken_parts>
  3. </replicated_merge_tree>

openSSL

SSL client/server configuration.

Support for SSL is provided by the libpoco library. The interface is described in the file SSLManager.h

Keys for server/client settings:

  • 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 contains the certificate.
  • 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 Context class. Possible values: 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:@STRENGTH.
  • cacheSessions – Enables or disables caching sessions. Must be used in combination with sessionIdContext. Acceptable values: 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. This parameter is always recommended since it helps avoid problems both if the server caches the session and if the client requested caching. Default value: ${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 – 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>ConsoleCertificateHandler</name> </invalidCertificateHandler> .
  • disableProtocols – Protocols that are not allowed to use.
  • preferServerCiphers – Preferred server ciphers on the client.

Example of settings:

  1. <openSSL>
  2. <server>
  3. <!-- 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 -->
  4. <certificateFile>/etc/clickhouse-server/server.crt</certificateFile>
  5. <privateKeyFile>/etc/clickhouse-server/server.key</privateKeyFile>
  6. <!-- openssl dhparam -out /etc/clickhouse-server/dhparam.pem 4096 -->
  7. <dhParamsFile>/etc/clickhouse-server/dhparam.pem</dhParamsFile>
  8. <verificationMode>none</verificationMode>
  9. <loadDefaultCAFile>true</loadDefaultCAFile>
  10. <cacheSessions>true</cacheSessions>
  11. <disableProtocols>sslv2,sslv3</disableProtocols>
  12. <preferServerCiphers>true</preferServerCiphers>
  13. </server>
  14. <client>
  15. <loadDefaultCAFile>true</loadDefaultCAFile>
  16. <cacheSessions>true</cacheSessions>
  17. <disableProtocols>sslv2,sslv3</disableProtocols>
  18. <preferServerCiphers>true</preferServerCiphers>
  19. <!-- Use for self-signed: <verificationMode>none</verificationMode> -->
  20. <invalidCertificateHandler>
  21. <!-- Use for self-signed: <name>AcceptCertificateHandler</name> -->
  22. <name>RejectCertificateHandler</name>
  23. </invalidCertificateHandler>
  24. </client>
  25. </openSSL>

part_log

Logging events that are associated with MergeTree. For instance, adding or merging data. You can use the log to simulate merge algorithms and compare their characteristics. You can visualize the merge process.

Queries are logged in the system.part_log table, not in a separate file. You can configure the name of this table in the table parameter (see below).

Use the following parameters to configure logging:

  • database – Name of the database.
  • table – Name of the system table.
  • partition_byCustom partitioning key for a system table. Can’t be used if engine defined.
  • engine - MergeTree Engine Definition for a system table. Can’t be used if partition_by defined.
  • flush_interval_milliseconds – Interval for flushing data from the buffer in memory to the table.

Example

  1. <part_log>
  2. <database>system</database>
  3. <table>part_log</table>
  4. <partition_by>toMonday(event_date)</partition_by>
  5. <flush_interval_milliseconds>7500</flush_interval_milliseconds>
  6. </part_log>

path

The path to the directory containing data.

Note

The trailing slash is mandatory.

Example

  1. <path>/var/lib/clickhouse/</path>

prometheus

Exposing metrics data for scraping from Prometheus.

Settings:

  • endpoint – HTTP endpoint for scraping metrics by prometheus server. Start from ‘/’.
  • port – Port for endpoint.
  • metrics – Flag that sets to expose metrics from the system.metrics table.
  • events – Flag that sets to expose metrics from the system.events table.
  • asynchronous_metrics – Flag that sets to expose current metrics values from the system.asynchronous_metrics table.

Example

  1. <prometheus>
  2. <endpoint>/metrics</endpoint>
  3. <port>8001</port>
  4. <metrics>true</metrics>
  5. <events>true</events>
  6. <asynchronous_metrics>true</asynchronous_metrics>
  7. </prometheus>

query_log

Setting for logging queries received with the log_queries=1 setting.

Queries are logged in the system.query_log table, not in a separate file. You can change the name of the table in the table parameter (see below).

Use the following parameters to configure logging:

  • database – Name of the database.
  • table – Name of the system table the queries will be logged in.
  • partition_byCustom partitioning key for a system table. Can’t be used if engine defined.
  • engine - MergeTree Engine Definition for a system table. Can’t be used if partition_by defined.
  • flush_interval_milliseconds – Interval for flushing data from the buffer in memory to the table.

If the table doesn’t exist, ClickHouse will create it. If the structure of the query log changed when the ClickHouse server was updated, the table with the old structure is renamed, and a new table is created automatically.

Example

  1. <query_log>
  2. <database>system</database>
  3. <table>query_log</table>
  4. <engine>Engine = MergeTree PARTITION BY event_date ORDER BY event_time TTL event_date + INTERVAL 30 day</engine>
  5. <flush_interval_milliseconds>7500</flush_interval_milliseconds>
  6. </query_log>

query_thread_log

Setting for logging threads of queries received with the log_query_threads=1 setting.

Queries are logged in the system.query_thread_log table, not in a separate file. You can change the name of the table in the table parameter (see below).

Use the following parameters to configure logging:

  • database – Name of the database.
  • table – Name of the system table the queries will be logged in.
  • partition_byCustom partitioning key for a system table. Can’t be used if engine defined.
  • engine - MergeTree Engine Definition for a system table. Can’t be used if partition_by defined.
  • flush_interval_milliseconds – Interval for flushing data from the buffer in memory to the table.

If the table doesn’t exist, ClickHouse will create it. If the structure of the query thread log changed when the ClickHouse server was updated, the table with the old structure is renamed, and a new table is created automatically.

Example

  1. <query_thread_log>
  2. <database>system</database>
  3. <table>query_thread_log</table>
  4. <partition_by>toMonday(event_date)</partition_by>
  5. <flush_interval_milliseconds>7500</flush_interval_milliseconds>
  6. </query_thread_log>

text_log

Settings for the text_log system table for logging text messages.

Parameters:

  • level — Maximum Message Level (by default Trace) which will be stored in a table.
  • database — Database name.
  • table — Table name.
  • partition_byCustom partitioning key for a system table. Can’t be used if engine defined.
  • engine - MergeTree Engine Definition for a system table. Can’t be used if partition_by defined.
  • flush_interval_milliseconds — Interval for flushing data from the buffer in memory to the table.

Example

  1. <yandex>
  2. <text_log>
  3. <level>notice</level>
  4. <database>system</database>
  5. <table>text_log</table>
  6. <flush_interval_milliseconds>7500</flush_interval_milliseconds>
  7. <!-- <partition_by>event_date</partition_by> -->
  8. <engine>Engine = MergeTree PARTITION BY event_date ORDER BY event_time TTL event_date + INTERVAL 30 day</engine>
  9. </text_log>
  10. </yandex>

trace_log

Settings for the trace_log system table operation.

Parameters:

  • database — Database for storing a table.
  • table — Table name.
  • partition_byCustom partitioning key for a system table. Can’t be used if engine defined.
  • engine - MergeTree Engine Definition for a system table. Can’t be used if partition_by defined.
  • flush_interval_milliseconds — Interval for flushing data from the buffer in memory to the table.

The default server configuration file config.xml contains the following settings section:

  1. <trace_log>
  2. <database>system</database>
  3. <table>trace_log</table>
  4. <partition_by>toYYYYMM(event_date)</partition_by>
  5. <flush_interval_milliseconds>7500</flush_interval_milliseconds>
  6. </trace_log>

query_masking_rules

Regexp-based rules, which will be applied to queries as well as all log messages before storing them in server logs,
system.query_log, system.text_log, system.processes tables, and in logs sent to the client. That allows preventing
sensitive data leakage from SQL queries (like names, emails, personal
identifiers or credit card numbers) to logs.

Example

  1. <query_masking_rules>
  2. <rule>
  3. <name>hide SSN</name>
  4. <regexp>(^|\D)\d{3}-\d{2}-\d{4}($|\D)</regexp>
  5. <replace>000-00-0000</replace>
  6. </rule>
  7. </query_masking_rules>

Config fields:
- name - name for the rule (optional)
- regexp - RE2 compatible regular expression (mandatory)
- replace - substitution string for sensitive data (optional, by default - six asterisks)

The masking rules are applied to the whole query (to prevent leaks of sensitive data from malformed / non-parsable queries).

system.events table have counter QueryMaskingRulesMatch which have an overall number of query masking rules matches.

For distributed queries each server have to be configured separately, otherwise, subqueries passed to other
nodes will be stored without masking.

remote_servers

Configuration of clusters used by the Distributed table engine and by the cluster table function.

Example

  1. <remote_servers incl="clickhouse_remote_servers" />

For the value of the incl attribute, see the section “Configuration files”.

See Also

timezone

The server’s time zone.

Specified as an IANA identifier for the UTC timezone or geographic location (for example, Africa/Abidjan).

The time zone is necessary for conversions between String and DateTime formats when DateTime fields are output to text format (printed on the screen or in a file), and when getting DateTime from a string. Besides, the time zone is used in functions that work with the time and date if they didn’t receive the time zone in the input parameters.

Example

  1. <timezone>Europe/Moscow</timezone>

tcp_port

Port for communicating with clients over the TCP protocol.

Example

  1. <tcp_port>9000</tcp_port>

tcp_port_secure

TCP port for secure communication with clients. Use it with OpenSSL settings.

Possible values

Positive integer.

Default value

  1. <tcp_port_secure>9440</tcp_port_secure>

mysql_port

Port for communicating with clients over MySQL protocol.

Possible values

Positive integer.

Example

  1. <mysql_port>9004</mysql_port>

tmp_path

Path to temporary data for processing large queries.

Note

The trailing slash is mandatory.

Example

  1. <tmp_path>/var/lib/clickhouse/tmp/</tmp_path>

tmp_policy

Policy from storage_configuration to store temporary files.

If not set, tmp_path is used, otherwise it is ignored.

Note

  • move_factor is ignored.

  • keep_free_space_bytes is ignored.

  • max_data_part_size_bytes is ignored.
  • Уou must have exactly one volume in that policy.

uncompressed_cache_size

Cache size (in bytes) for uncompressed data used by table engines from the MergeTree.

There is one shared cache for the server. Memory is allocated on demand. The cache is used if the option use_uncompressed_cache is enabled.

The uncompressed cache is advantageous for very short queries in individual cases.

Example

  1. <uncompressed_cache_size>8589934592</uncompressed_cache_size>

user_files_path

The directory with user files. Used in the table function file().

Example

  1. <user_files_path>/var/lib/clickhouse/user_files/</user_files_path>

users_config

Path to the file that contains:

  • User configurations.
  • Access rights.
  • Settings profiles.
  • Quota settings.

Example

  1. <users_config>users.xml</users_config>

zookeeper

Contains settings that allow ClickHouse to interact with a ZooKeeper cluster.

ClickHouse uses ZooKeeper for storing metadata of replicas when using replicated tables. If replicated tables are not used, this section of parameters can be omitted.

This section contains the following parameters:

  • node — ZooKeeper endpoint. You can set multiple endpoints.

    For example:

  1. <node index="1">
  2. <host>example_host</host>
  3. <port>2181</port>
  4. </node>
  1. 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 that is used as the root for znodes used by the ClickHouse server. Optional.
  • identity — User and password, that can be required by ZooKeeper to give access to requested znodes. Optional.

Example configuration

  1. <zookeeper>
  2. <node>
  3. <host>example1</host>
  4. <port>2181</port>
  5. </node>
  6. <node>
  7. <host>example2</host>
  8. <port>2181</port>
  9. </node>
  10. <session_timeout_ms>30000</session_timeout_ms>
  11. <operation_timeout_ms>10000</operation_timeout_ms>
  12. <!-- Optional. Chroot suffix. Should exist. -->
  13. <root>/path/to/zookeeper/node</root>
  14. <!-- Optional. Zookeeper digest ACL string. -->
  15. <identity>user:password</identity>
  16. </zookeeper>

See Also

use_minimalistic_part_header_in_zookeeper

Storage method for data part headers in ZooKeeper.

This setting only applies to the MergeTree family. It can be specified:

  • Globally in the merge_tree section of the config.xml file.

    ClickHouse uses the setting for all the tables on the server. You can change the setting at any time. Existing tables change their behaviour when the setting changes.

  • For each table.

    When creating a table, specify the corresponding engine setting. The behaviour of an existing table with this setting does not change, even if the global setting changes.

Possible values

  • 0 — Functionality is turned off.
  • 1 — Functionality is turned on.

If use_minimalistic_part_header_in_zookeeper = 1, then replicated tables store the headers of the data parts compactly using a single znode. If the table contains many columns, this storage method significantly reduces the volume of the data stored in Zookeeper.

Attention

After applying use_minimalistic_part_header_in_zookeeper = 1, you can’t downgrade the ClickHouse server to a version that doesn’t support this setting. Be careful when upgrading ClickHouse on servers in a cluster. Don’t upgrade all the servers at once. It is safer to test new versions of ClickHouse in a test environment, or on just a few servers of a cluster.

Data part headers already stored with this setting can’t be restored to their previous (non-compact) representation.

Default value: 0.

disable_internal_dns_cache

Disables the internal DNS cache. Recommended for operating ClickHouse in systems
with frequently changing infrastructure such as Kubernetes.

Default value: 0.

dns_cache_update_period

The period of updating IP addresses stored in the ClickHouse internal DNS cache (in seconds).
The update is performed asynchronously, in a separate system thread.

Default value: 15.

See also

access_control_path

Path to a folder where a ClickHouse server stores user and role configurations created by SQL commands.

Default value: /var/lib/clickhouse/access/.

See also

user_directories

Section of the configuration file that contains settings:
- Path to configuration file with predefined users.
- Path to folder where users created by SQL commands are stored.

If this section is specified, the path from users_config and access_control_path won’t be used.

The user_directories section can contain any number of items, the order of the items means their precedence (the higher the item the higher the precedence).

Example

  1. <user_directories>
  2. <users_xml>
  3. <path>/etc/clickhouse-server/users.xml</path>
  4. </users_xml>
  5. <local_directory>
  6. <path>/var/lib/clickhouse/access/</path>
  7. </local_directory>
  8. </user_directories>

You can also specify settings memory — means storing information only in memory, without writing to disk, and ldap — means storing information on an LDAP server.

To add an LDAP server as a remote user directory of users that are not defined locally, define a single ldap section with a following parameters:
- server — one of LDAP server names defined in ldap_servers config section. This parameter is mandatory and cannot be empty.
- roles — section with a list of locally defined roles that will be assigned to each user retrieved from the LDAP server. If no roles are specified, user will not be able to perform any actions after authentication. If any of the listed roles is not defined locally at the time of authentication, the authenthication attept will fail as if the provided password was incorrect.

Example

  1. <ldap>
  2. <server>my_ldap_server</server>
  3. <roles>
  4. <my_local_role1 />
  5. <my_local_role2 />
  6. </roles>
  7. </ldap>

Original article