//需要先搭建zookeeper集群。
机器1:
sudo docker run -d \
--name clickhouse --ulimit nofile=262144:262144 \
-p 8123:8123 -p 9000:9000 -p 9009:9009 \
-v /etc/clickhouse-server/config.xml:/etc/clickhouse-server/config.xml \
-v /var/log/clickhouse-server/:/var/log/clickhouse-server/ \
--add-host pandora-cpu-1.novalocal:172.16.12.130 \
--add-host pandora-cpu-2.novalocal:172.16.12.154 \
--add-host pandora-cpu-3.novalocal:172.16.12.163 \
--hostname pandora-cpu-1.novalocal \
yandex/clickhouse-server
机器2:
sudo docker run -d \
--name clickhouse --ulimit nofile=262144:262144 \
-p 8123:8123 -p 9000:9000 -p 9009:9009 \
-v /etc/clickhouse-server/config.xml:/etc/clickhouse-server/config.xml \
-v /var/log/clickhouse-server/:/var/log/clickhouse-server/ \
--add-host pandora-cpu-1.novalocal:172.16.12.130 \
--add-host pandora-cpu-2.novalocal:172.16.12.154 \
--add-host pandora-cpu-3.novalocal:172.16.12.163 \
--hostname pandora-cpu-2.novalocal \
yandex/clickhouse-server
机器3:
sudo docker run -d \
--name clickhouse --ulimit nofile=262144:262144 \
-p 8123:8123 -p 9000:9000 -p 9009:9009 \
-v /etc/clickhouse-server/config.xml:/etc/clickhouse-server/config.xml \
-v /var/log/clickhouse-server/:/var/log/clickhouse-server/ \
--add-host pandora-cpu-1.novalocal:172.16.12.130 \
--add-host pandora-cpu-2.novalocal:172.16.12.154 \
--add-host pandora-cpu-3.novalocal:172.16.12.163 \
--hostname pandora-cpu-3.novalocal \
yandex/clickhouse-server
停止删除命令
sudo docker stop clickhouse && sudo docker rm clickhouse
/etc/clickhouse-server/config.xml
<!-- Per level overrides (legacy):
For example to suppress logging of the ConfigReloader you can use:
NOTE: levels.logger is reserved, see below.
-->
<!--
<levels>
<ConfigReloader>none</ConfigReloader>
</levels>
-->
<!-- Per level overrides:
For example to suppress logging of the RBAC for default user you can use:
(But please note that the logger name maybe changed from version to version, even after minor upgrade)
-->
<!--
<levels>
<logger>
<name>ContextAccess (default)</name>
<level>none</level>
</logger>
<logger>
<name>DatabaseOrdinary (test)</name>
<level>none</level>
</logger>
</levels>
-->
</logger>
<send\_crash\_reports>
<!-- Changing <enabled> to true allows sending crash reports to -->
<!-- the ClickHouse core developers team via Sentry https://sentry.io -->
<!-- Doing so at least in pre-production environments is highly appreciated -->
<enabled>false</enabled>
<!-- Change <anonymize> to true if you don't feel comfortable attaching the server hostname to the crash report -->
<anonymize>false</anonymize>
<!-- Default endpoint should be changed to different Sentry DSN only if you have -->
<!-- some in-house engineers or hired consultants who're going to debug ClickHouse issues for you -->
<endpoint>https://6f33034cfe684dd7a3ab9875e57b1c8d@o388870.ingest.sentry.io/5226277</endpoint>
</send\_crash\_reports>
<!--display\_name>production</display\_name--> <!-- It is the name that will be shown in the client -->
<http\_port>8123</http\_port>
<tcp\_port>9000</tcp\_port>
<mysql\_port>9004</mysql\_port>
<!-- For HTTPS and SSL over native protocol. -->
<!--
<https\_port>8443</https\_port>
<tcp\_port\_secure>9440</tcp\_port\_secure>
-->
<!-- Used with https\_port and tcp\_port\_secure. Full ssl options list: https://github.com/ClickHouse-Extras/poco/blob/master/NetSSL\_OpenSSL/include/Poco/Net/SSLManager.h#L71 -->
<openSSL>
<server> <!-- Used for https server AND secure tcp port -->
<!-- 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> <!-- Used for connecting to https dictionary source and secured Zookeeper communication -->
<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>
<!-- Default root page on http\[s\] server. For example load UI from https://tabix.io/ when opening http://localhost:8123 -->
<!--
<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>
-->
<!-- Port for communication between replicas. Used for data exchange. -->
<interserver\_http\_port>9009</interserver\_http\_port>
<!-- Hostname that is used by other replicas to request this server.
If not specified, than it is determined analogous to 'hostname -f' command.
This setting could be used to switch replication to another network interface.
-->
<!--
<interserver\_http\_host>example.yandex.ru</interserver\_http\_host>
-->
<!-- Listen specified host. use :: (wildcard IPv6 address), if you want to accept connections both with IPv4 and IPv6 from everywhere. -->
<listen\_host>::</listen\_host>
<!-- Same for hosts with disabled ipv6: -->
<!-- <listen\_host>0.0.0.0</listen\_host> -->
<!-- Default values - try listen localhost on ipv4 and ipv6: -->
<!--
<listen\_host>::1</listen\_host>
<listen\_host>127.0.0.1</listen\_host>
-->
<!-- Don't exit if ipv6 or ipv4 unavailable, but listen\_host with this protocol specified -->
<!-- <listen\_try>0</listen\_try> -->
<!-- Allow listen on same address:port -->
<!-- <listen\_reuse\_port>0</listen\_reuse\_port> -->
<!-- <listen\_backlog>64</listen\_backlog> -->
<max\_connections>4096</max\_connections>
<keep\_alive\_timeout>3</keep\_alive\_timeout>
<!-- Maximum number of concurrent queries. -->
<max\_concurrent\_queries>100</max\_concurrent\_queries>
<!-- Maximum memory usage (resident set size) for server process.
Zero value or unset means default. Default is "max\_server\_memory\_usage\_to\_ram\_ratio" of available physical RAM.
If the value is larger than "max\_server\_memory\_usage\_to\_ram\_ratio" of available physical RAM, it will be cut down.
The constraint is checked on query execution time.
If a query tries to allocate memory and the current memory usage plus allocation is greater
than specified threshold, exception will be thrown.
It is not practical to set this constraint to small values like just a few gigabytes,
because memory allocator will keep this amount of memory in caches and the server will deny service of queries.
-->
<max\_server\_memory\_usage>0</max\_server\_memory\_usage>
<!-- Maximum number of threads in the Global thread pool.
This will default to a maximum of 10000 threads if not specified.
This setting will be useful in scenarios where there are a large number
of distributed queries that are running concurrently but are idling most
of the time, in which case a higher number of threads might be required.
-->
<max\_thread\_pool\_size>10000</max\_thread\_pool\_size>
<!-- On memory constrained environments you may have to set this to value larger than 1.
-->
<max\_server\_memory\_usage\_to\_ram\_ratio>0.9</max\_server\_memory\_usage\_to\_ram\_ratio>
<!-- Simple server-wide memory profiler. Collect a stack trace at every peak allocation step (in bytes).
Data will be stored in system.trace\_log table with query\_id = empty string.
Zero means disabled.
-->
<total\_memory\_profiler\_step>4194304</total\_memory\_profiler\_step>
<!-- Collect random allocations and deallocations and write them into system.trace\_log with 'MemorySample' trace\_type.
The probability is for every alloc/free regardless to the size of the allocation.
Note that sampling happens only when the amount of untracked memory exceeds the untracked memory limit,
which is 4 MiB by default but can be lowered if 'total\_memory\_profiler\_step' is lowered.
You may want to set 'total\_memory\_profiler\_step' to 1 for extra fine grained sampling.
-->
<total\_memory\_tracker\_sample\_probability>0</total\_memory\_tracker\_sample\_probability>
<!-- Set limit on number of open files (default: maximum). This setting makes sense on Mac OS X because getrlimit() fails to retrieve
correct maximum value. -->
<!-- <max\_open\_files>262144</max\_open\_files> -->
<!-- Size of cache of uncompressed blocks of data, used in tables of MergeTree family.
In bytes. Cache is single for server. Memory is allocated only on demand.
Cache is used when 'use\_uncompressed\_cache' user setting turned on (off by default).
Uncompressed cache is advantageous only for very short queries and in rare cases.
-->
<uncompressed\_cache\_size>8589934592</uncompressed\_cache\_size>
<!-- Approximate size of mark cache, used in tables of MergeTree family.
In bytes. Cache is single for server. Memory is allocated only on demand.
You should not lower this value.
-->
<mark\_cache\_size>5368709120</mark\_cache\_size>
<!-- Path to data directory, with trailing slash. -->
<path>/var/lib/clickhouse/</path>
<!-- Path to temporary data for processing hard queries. -->
<tmp\_path>/var/lib/clickhouse/tmp/</tmp\_path>
<!-- Policy from the <storage\_configuration> for the temporary files.
If not set <tmp\_path> is used, otherwise <tmp\_path> is ignored.
Notes:
- move\_factor is ignored
- keep\_free\_space\_bytes is ignored
- max\_data\_part\_size\_bytes is ignored
- you must have exactly one volume in that policy
-->
<!-- <tmp\_policy>tmp</tmp\_policy> -->
<!-- Directory with user provided files that are accessible by 'file' table function. -->
<user\_files\_path>/var/lib/clickhouse/user\_files/</user\_files\_path>
<!-- LDAP server definitions. -->
<ldap\_servers>
<!-- List LDAP servers with their connection parameters here to later 1) use them as authenticators for dedicated local users,
who have 'ldap' authentication mechanism specified instead of 'password', or to 2) use them as remote user directories.
Parameters:
host - LDAP server hostname or IP, this parameter is mandatory and cannot be empty.
port - LDAP server port, default is 636 if enable\_tls is set to true, 389 otherwise.
auth\_dn\_prefix, auth\_dn\_suffix - prefix and suffix used to construct the DN to bind to.
Effectively, the resulting DN will be constructed as auth\_dn\_prefix + escape(user\_name) + auth\_dn\_suffix string.
Note, that this implies that auth\_dn\_suffix should usually have comma ',' as its first non-space character.
enable\_tls - flag to trigger use of secure connection to the LDAP server.
Specify 'no' for plain text (ldap://) protocol (not recommended).
Specify 'yes' for LDAP over SSL/TLS (ldaps://) protocol (recommended, the default).
Specify 'starttls' for legacy StartTLS protocol (plain text (ldap://) protocol, upgraded to TLS).
tls\_minimum\_protocol\_version - the minimum protocol version of SSL/TLS.
Accepted values are: 'ssl2', 'ssl3', 'tls1.0', 'tls1.1', 'tls1.2' (the default).
tls\_require\_cert - SSL/TLS peer certificate verification behavior.
Accepted values are: 'never', 'allow', 'try', 'demand' (the default).
tls\_cert\_file - path to certificate file.
tls\_key\_file - path to certificate key file.
tls\_ca\_cert\_file - path to CA certificate file.
tls\_ca\_cert\_dir - path to the directory containing CA certificates.
tls\_cipher\_suite - allowed cipher suite (in OpenSSL notation).
Example:
<my\_ldap\_server>
<host>localhost</host>
<port>636</port>
<auth\_dn\_prefix>uid=</auth\_dn\_prefix>
<auth\_dn\_suffix>,ou=users,dc=example,dc=com</auth\_dn\_suffix>
<enable\_tls>yes</enable\_tls>
<tls\_minimum\_protocol\_version>tls1.2</tls\_minimum\_protocol\_version>
<tls\_require\_cert>demand</tls\_require\_cert>
<tls\_cert\_file>/path/to/tls\_cert\_file</tls\_cert\_file>
<tls\_key\_file>/path/to/tls\_key\_file</tls\_key\_file>
<tls\_ca\_cert\_file>/path/to/tls\_ca\_cert\_file</tls\_ca\_cert\_file>
<tls\_ca\_cert\_dir>/path/to/tls\_ca\_cert\_dir</tls\_ca\_cert\_dir>
<tls\_cipher\_suite>ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:AES256-GCM-SHA384</tls\_cipher\_suite>
</my\_ldap\_server>
-->
</ldap\_servers>
<!-- Sources to read users, roles, access rights, profiles of settings, quotas. -->
<user\_directories>
<users\_xml>
<!-- Path to configuration file with predefined users. -->
<path>users.xml</path>
</users\_xml>
<local\_directory>
<!-- Path to folder where users created by SQL commands are stored. -->
<path>/var/lib/clickhouse/access/</path>
</local\_directory>
<!-- To add an LDAP server as a remote user directory of users that are not defined locally, define a single 'ldap' section
with the following parameters:
server - one of LDAP server names defined in 'ldap\_servers' config section above.
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 attempt
will fail as if the provided password was incorrect.
Example:
<ldap>
<server>my\_ldap\_server</server>
<roles>
<my\_local\_role1 />
<my\_local\_role2 />
</roles>
</ldap>
-->
</user\_directories>
<!-- Default profile of settings. -->
<default\_profile>default</default\_profile>
<!-- Comma-separated list of prefixes for user-defined settings. -->
<custom\_settings\_prefixes></custom\_settings\_prefixes>
<!-- System profile of settings. This settings are used by internal processes (Buffer storage, Distributed DDL worker and so on). -->
<!-- <system\_profile>default</system\_profile> -->
<!-- Default database. -->
<default\_database>default</default\_database>
<!-- Server time zone could be set here.
Time zone is used when converting between String and DateTime types,
when printing DateTime in text formats and parsing DateTime from text,
it is used in date and time related functions, if specific time zone was not passed as an argument.
Time zone is specified as identifier from IANA time zone database, like UTC or Africa/Abidjan.
If not specified, system time zone at server startup is used.
Please note, that server could display time zone alias instead of specified name.
Example: W-SU is an alias for Europe/Moscow and Zulu is an alias for UTC.
-->
<!-- <timezone>Europe/Moscow</timezone> -->
<!-- You can specify umask here (see "man umask"). Server will apply it on startup.
Number is always parsed as octal. Default umask is 027 (other users cannot read logs, data files, etc; group can only read).
-->
<!-- <umask>022</umask> -->
<!-- Perform mlockall after startup to lower first queries latency
and to prevent clickhouse executable from being paged out under high IO load.
Enabling this option is recommended but will lead to increased startup time for up to a few seconds.
-->
<mlock\_executable>true</mlock\_executable>
<!-- Reallocate memory for machine code ("text") using huge pages. Highly experimental. -->
<remap\_executable>false</remap\_executable>
<!-- Configuration of clusters that could be used in Distributed tables.
https://clickhouse.tech/docs/en/operations/table\_engines/distributed/
-->
<remote\_servers incl="clickhouse\_remote\_servers" >
<!-- Test only shard config for testing distributed storage -->
<cluster\_1>
<!-- Inter-server per-cluster secret for Distributed queries
default: no secret (no authentication will be performed)
If set, then Distributed queries will be validated on shards, so at least:
- such cluster should exist on the shard,
- such cluster should have the same secret.
And also (and which is more important), the initial\_user will
be used as current user for the query.
Right now the protocol is pretty simple and it only takes into account:
- cluster name
- query
Also it will be nice if the following will be implemented:
- source hostname (see interserver\_http\_host), but then it will depends from DNS,
it can use IP address instead, but then the you need to get correct on the initiator node.
- target hostname / ip address (same notes as for source hostname)
- time-based security tokens
-->
<!-- <secret></secret> -->
<shard>
<!-- Optional. Whether to write data to just one of the replicas. Default: false (write data to all replicas). -->
<!-- <internal\_replication>false</internal\_replication> -->
<!-- Optional. Shard weight when writing data. Default: 1. -->
<!-- <weight>1</weight> -->
<replica>
<host>pandora-cpu-1.novalocal</host>
<port>9000</port>
<user>default</user>
<password></password>
<!-- Optional. Priority of the replica for load\_balancing. Default: 1 (less value has more priority). -->
<!-- <priority>1</priority> -->
</replica>
</shard>
<shard>
<replica>
<host>pandora-cpu-2.novalocal</host>
<port>9000</port>
<user>default</user>
<password></password>
<!-- Optional. Priority of the replica for load\_balancing. Default: 1 (less value has more priority). -->
<!-- <priority>1</priority> -->
</replica>
</shard>
<shard>
<replica>
<host>pandora-cpu-3.novalocal</host>
<port>9000</port>
<user>default</user>
<password></password>
</replica>
</shard>
</cluster\_1>
</remote\_servers>
<!-- The list of hosts allowed to use in URL-related storage engines and table functions.
If this section is not present in configuration, all hosts are allowed.
-->
<remote\_url\_allow\_hosts>
<!-- Host should be specified exactly as in URL. The name is checked before DNS resolution.
Example: "yandex.ru", "yandex.ru." and "www.yandex.ru" are different hosts.
If port is explicitly specified in URL, the host:port is checked as a whole.
If host specified here without port, any port with this host allowed.
"yandex.ru" -> "yandex.ru:443", "yandex.ru:80" etc. is allowed, but "yandex.ru:80" -> only "yandex.ru:80" is allowed.
If the host is specified as IP address, it is checked as specified in URL. Example: "\[2a02:6b8:a::a\]".
If there are redirects and support for redirects is enabled, every redirect (the Location field) is checked.
-->
<!-- Regular expression can be specified. RE2 engine is used for regexps.
Regexps are not aligned: don't forget to add ^ and $. Also don't forget to escape dot (.) metacharacter
(forgetting to do so is a common source of error).
-->
</remote\_url\_allow\_hosts>
<!-- If element has 'incl' attribute, then for it's value will be used corresponding substitution from another file.
By default, path to file with substitutions is /etc/metrika.xml. It could be changed in config in 'include\_from' element.
Values for substitutions are specified in /yandex/name\_of\_substitution elements in that file.
-->
<!-- ZooKeeper is used to store metadata about replicas, when using Replicated tables.
Optional. If you don't use replicated tables, you could omit that.
See https://clickhouse.yandex/docs/en/table\_engines/replication/
-->
<!-- Substitutions for parameters of replicated tables.
Optional. If you don't use replicated tables, you could omit that.
See https://clickhouse.yandex/docs/en/table\_engines/replication/#creating-replicated-tables
-->
<macros incl="macros" optional="true" />
<!-- Reloading interval for embedded dictionaries, in seconds. Default: 3600. -->
<builtin\_dictionaries\_reload\_interval>3600</builtin\_dictionaries\_reload\_interval>
<!-- Maximum session timeout, in seconds. Default: 3600. -->
<max\_session\_timeout>3600</max\_session\_timeout>
<!-- Default session timeout, in seconds. Default: 60. -->
<default\_session\_timeout>60</default\_session\_timeout>
<!-- Sending data to Graphite for monitoring. Several sections can be defined. -->
<!--
interval - send every X second
root\_path - prefix for keys
hostname\_in\_path - append hostname to root\_path (default = true)
metrics - send data from table system.metrics
events - send data from table system.events
asynchronous\_metrics - send data from table system.asynchronous\_metrics
-->
<!--
<graphite>
<host>localhost</host>
<port>42000</port>
<timeout>0.1</timeout>
<interval>60</interval>
<root\_path>one\_min</root\_path>
<hostname\_in\_path>true</hostname\_in\_path>
<metrics>true</metrics>
<events>true</events>
<events\_cumulative>false</events\_cumulative>
<asynchronous\_metrics>true</asynchronous\_metrics>
</graphite>
<graphite>
<host>localhost</host>
<port>42000</port>
<timeout>0.1</timeout>
<interval>1</interval>
<root\_path>one\_sec</root\_path>
<metrics>true</metrics>
<events>true</events>
<events\_cumulative>false</events\_cumulative>
<asynchronous\_metrics>false</asynchronous\_metrics>
</graphite>
-->
<!-- Serve endpoint for Prometheus monitoring. -->
<!--
endpoint - mertics path (relative to root, statring with "/")
port - port to setup server. If not defined or 0 than http\_port used
metrics - send data from table system.metrics
events - send data from table system.events
asynchronous\_metrics - send data from table system.asynchronous\_metrics
status\_info - send data from different component from CH, ex: Dictionaries status
-->
<!--
<prometheus>
<endpoint>/metrics</endpoint>
<port>9363</port>
<metrics>true</metrics>
<events>true</events>
<asynchronous\_metrics>true</asynchronous\_metrics>
<status\_info>true</status\_info>
</prometheus>
-->
<!-- Query log. Used only for queries with setting log\_queries = 1. -->
<query\_log>
<!-- What table to insert data. If table is not exist, it will be created.
When query log structure is changed after system update,
then old table will be renamed and new table will be created automatically.
-->
<database>system</database>
<table>query\_log</table>
<!--
PARTITION BY expr https://clickhouse.yandex/docs/en/table\_engines/custom\_partitioning\_key/
Example:
event\_date
toMonday(event\_date)
toYYYYMM(event\_date)
toStartOfHour(event\_time)
-->
<partition\_by>toYYYYMM(event\_date)</partition\_by>
<!-- Instead of partition\_by, you can provide full engine expression (starting with ENGINE = ) with parameters,
Example: <engine>ENGINE = MergeTree PARTITION BY toYYYYMM(event\_date) ORDER BY (event\_date, event\_time) SETTINGS index\_granularity = 1024</engine>
-->
<!-- Interval of flushing data. -->
<flush\_interval\_milliseconds>7500</flush\_interval\_milliseconds>
</query\_log>
<!-- Trace log. Stores stack traces collected by query profilers.
See query\_profiler\_real\_time\_period\_ns and query\_profiler\_cpu\_time\_period\_ns settings. -->
<trace\_log>
<database>system</database>
<table>trace\_log</table>
<partition\_by>toYYYYMM(event\_date)</partition\_by>
<flush\_interval\_milliseconds>7500</flush\_interval\_milliseconds>
</trace\_log>
<!-- Query thread log. Has information about all threads participated in query execution.
Used only for queries with setting log\_query\_threads = 1. -->
<query\_thread\_log>
<database>system</database>
<table>query\_thread\_log</table>
<partition\_by>toYYYYMM(event\_date)</partition\_by>
<flush\_interval\_milliseconds>7500</flush\_interval\_milliseconds>
</query\_thread\_log>
<!-- Uncomment if use part log.
Part log contains information about all actions with parts in MergeTree tables (creation, deletion, merges, downloads).
<part\_log>
<database>system</database>
<table>part\_log</table>
<flush\_interval\_milliseconds>7500</flush\_interval\_milliseconds>
</part\_log>
-->
<!-- Uncomment to write text log into table.
Text log contains all information from usual server log but stores it in structured and efficient way.
The level of the messages that goes to the table can be limited (<level>), if not specified all messages will go to the table.
<text\_log>
<database>system</database>
<table>text\_log</table>
<flush\_interval\_milliseconds>7500</flush\_interval\_milliseconds>
<level></level>
</text\_log>
-->
<!-- Metric log contains rows with current values of ProfileEvents, CurrentMetrics collected with "collect\_interval\_milliseconds" interval. -->
<metric\_log>
<database>system</database>
<table>metric\_log</table>
<flush\_interval\_milliseconds>7500</flush\_interval\_milliseconds>
<collect\_interval\_milliseconds>1000</collect\_interval\_milliseconds>
</metric\_log>
<!--
Asynchronous metric log contains values of metrics from
system.asynchronous\_metrics.
-->
<asynchronous\_metric\_log>
<database>system</database>
<table>asynchronous\_metric\_log</table>
<!--
Asynchronous metrics are updated once a minute, so there is
no need to flush more often.
-->
<flush\_interval\_milliseconds>60000</flush\_interval\_milliseconds>
</asynchronous\_metric\_log>
<!--
OpenTelemetry log contains OpenTelemetry trace spans.
-->
<opentelemetry\_span\_log>
<!--
The default table creation code is insufficient, this <engine> spec
is a workaround. There is no 'event\_time' for this log, but two times,
start and finish. It is sorted by finish time, to avoid inserting
data too far away in the past (probably we can sometimes insert a span
that is seconds earlier than the last span in the table, due to a race
between several spans inserted in parallel). This gives the spans a
global order that we can use to e.g. retry insertion into some external
system.
-->
<engine>
engine MergeTree
partition by toYYYYMM(finish\_date)
order by (finish\_date, finish\_time\_us, trace\_id)
</engine>
<database>system</database>
<table>opentelemetry\_span\_log</table>
<flush\_interval\_milliseconds>7500</flush\_interval\_milliseconds>
</opentelemetry\_span\_log>
<!-- Crash log. Stores stack traces for fatal errors.
This table is normally empty. -->
<crash\_log>
<database>system</database>
<table>crash\_log</table>
<partition\_by />
<flush\_interval\_milliseconds>1000</flush\_interval\_milliseconds>
</crash\_log>
<!-- Parameters for embedded dictionaries, used in Yandex.Metrica.
See https://clickhouse.yandex/docs/en/dicts/internal\_dicts/
-->
<!-- Path to file with region hierarchy. -->
<!-- <path\_to\_regions\_hierarchy\_file>/opt/geo/regions\_hierarchy.txt</path\_to\_regions\_hierarchy\_file> -->
<!-- Path to directory with files containing names of regions -->
<!-- <path\_to\_regions\_names\_files>/opt/geo/</path\_to\_regions\_names\_files> -->
<!-- Configuration of external dictionaries. See:
https://clickhouse.yandex/docs/en/dicts/external\_dicts/
-->
<dictionaries\_config>\*\_dictionary.xml</dictionaries\_config>
<!-- Uncomment if you want data to be compressed 30-100% better.
Don't do that if you just started using ClickHouse.
-->
<compression incl="clickhouse\_compression">
<!--
<!- - Set of variants. Checked in order. Last matching case wins. If nothing matches, lz4 will be used. - ->
<case>
<!- - Conditions. All must be satisfied. Some conditions may be omitted. - ->
<min\_part\_size>10000000000</min\_part\_size> <!- - Min part size in bytes. - ->
<min\_part\_size\_ratio>0.01</min\_part\_size\_ratio> <!- - Min size of part relative to whole table size. - ->
<!- - What compression method to use. - ->
<method>zstd</method>
</case>
-->
</compression>
<!-- Allow to execute distributed DDL queries (CREATE, DROP, ALTER, RENAME) on cluster.
Works only if ZooKeeper is enabled. Comment it if such functionality isn't required. -->
<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> -->
</distributed\_ddl>
<!-- Settings to fine tune MergeTree tables. See documentation in source code, in MergeTreeSettings.h -->
<!--
<merge\_tree>
<max\_suspicious\_broken\_parts>5</max\_suspicious\_broken\_parts>
</merge\_tree>
-->
<!-- Protection from accidental DROP.
If size of a MergeTree table is greater than max\_table\_size\_to\_drop (in bytes) than table could not be dropped with any DROP query.
If you want do delete one table and don't want to change clickhouse-server config, you could create special file <clickhouse-path>/flags/force\_drop\_table and make DROP once.
By default max\_table\_size\_to\_drop is 50GB; max\_table\_size\_to\_drop=0 allows to DROP any tables.
The same for max\_partition\_size\_to\_drop.
Uncomment to disable protection.
-->
<!-- <max\_table\_size\_to\_drop>0</max\_table\_size\_to\_drop> -->
<!-- <max\_partition\_size\_to\_drop>0</max\_partition\_size\_to\_drop> -->
<!-- Example of parameters for GraphiteMergeTree table engine -->
<graphite\_rollup\_example>
<pattern>
<regexp>click\_cost</regexp>
<function>any</function>
<retention>
<age>0</age>
<precision>3600</precision>
</retention>
<retention>
<age>86400</age>
<precision>60</precision>
</retention>
</pattern>
<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>
<!-- Directory in <clickhouse-path> containing schema files for various input formats.
The directory will be created if it doesn't exist.
-->
<format\_schema\_path>/var/lib/clickhouse/format\_schemas/</format\_schema\_path>
<!-- Default query masking rules, matching lines would be replaced with something else in the logs
(both text logs and system.query\_log).
name - name for the rule (optional)
regexp - RE2 compatible regular expression (mandatory)
replace - substitution string for sensitive data (optional, by default - six asterisks)
-->
<query\_masking\_rules>
<rule>
<name>hide encrypt/decrypt arguments</name>
<regexp>((?:aes\_)?(?:encrypt|decrypt)(?:\_mysql)?)\\s\*\\(\\s\*(?:'(?:\\\\'|.)+'|.\*?)\\s\*\\)</regexp>
<!-- or more secure, but also more invasive:
(aes\_\\w+)\\s\*\\(.\*\\)
-->
<replace>\\1(???)</replace>
</rule>
</query\_masking\_rules>
<!-- Uncomment to use custom http handlers.
rules are checked from top to bottom, first match runs the handler
url - to match request URL, you can use 'regex:' prefix to use regex match(optional)
methods - to match request method, you can use commas to separate multiple method matches(optional)
headers - to match request headers, match each child element(child element name is header name), you can use 'regex:' prefix to use regex match(optional)
handler is request handler
type - supported types: static, dynamic\_query\_handler, predefined\_query\_handler
query - use with predefined\_query\_handler type, executes query when the handler is called
query\_param\_name - use with dynamic\_query\_handler type, extracts and executes the value corresponding to the <query\_param\_name> value in HTTP request params
status - use with static type, response status code
content\_type - use with static type, response content-type
response\_content - use with static type, Response content sent to client, when using the prefix 'file://' or 'config://', find the content from the file or configuration send to client.
<http\_handlers>
<rule>
<url>/</url>
<methods>POST,GET</methods>
<headers><pragma>no-cache</pragma></headers>
<handler>
<type>dynamic\_query\_handler</type>
<query\_param\_name>query</query\_param\_name>
</handler>
</rule>
<rule>
<url>/predefined\_query</url>
<methods>POST,GET</methods>
<handler>
<type>predefined\_query\_handler</type>
<query>SELECT \* FROM system.settings</query>
</handler>
</rule>
<rule>
<handler>
<type>static</type>
<status>200</status>
<content\_type>text/plain; charset=UTF-8</content\_type>
<response\_content>config://http\_server\_default\_response</response\_content>
</handler>
</rule>
</http\_handlers>
-->
<!-- Uncomment to disable ClickHouse internal DNS caching. -->
<!-- <disable\_internal\_dns\_cache>1</disable\_internal\_dns\_cache> -->
手机扫一扫
移动阅读更方便
你可能感兴趣的文章