有奖捉虫:行业应用 & 管理与支持文档专题 HOT

功能介绍

为方便不同用户角色的使用习惯,ClickHouse 集群的配置管理功能提供了 KV 模式和基于 XML 模式修改集群关键配置参数,并将修改后的配置文件内容以集群维度推送到集群节点中。本文将为您介绍如何通过控制台对配置参数进行操作。

功能说明

2021年8月前创建的存量集群通过 KV 模式的参数管理配置,2021年8月后新集群将默认使用 XML 配置管理功能。存量集群如需使用XML 配置管理,可通过 售后支持 联系技术支持开通使用。
注意
目前集群参数配置呈现可 KV 模式和 XML 模式二选一。新建集群默认支持 KV 模式,可切换启用 XML 模式参数配置,而已启用 XML 模式参数配置不支持切回 KV 模式参数配置。
如果集群在之前通过工单的方式由技术支持维护或调整过集群配置,建议在使用以下功能时,先与技术支持确认当前的配置文件的内容。

操作步骤

1. 登录 云数据仓库 ClickHouse 控制台,在集群列表中选择对应的集群,单击集群名称/ID进入集群详情页,在集群详情页单击参数配置
2. 存量集群参数配置页面以 KV 模式配置参数,支持的参数来自 config.xml 文件。按需调整参数后,单击应用到集群,修改后的参数即可生效。

3. 新建集群或存量集群使用 XML 模式配置管理后,在参数配置页面会显示 XML 模式的参数配置。目前 XML 模式参数支持包括 config.xml、metrika.xml、users.xml 三个配置文件的当前内容的查看和编辑。下图显示了配置文件的当前内容。

可直接对配置文件的内容进行编辑,修改后可单击应用到集群。


可以通过对比详情查看修改情况。

确定修改无误后,可单击保存并下发将新配置提交到集群节点上。

4. 配置下发提交成功后,集群状态会进入“状态变更中”,并且修改的配置文件会提示“配置发生变化,请重启”。请根据具体配置修改的内容判断是否需要重启。如需重启,则单击右上角的重启服务,进行集群节点重启。

5. 提交配置修改后,可以在修改历史中查看配置文件的修改历史,以及每次修改的对比详情。

注意事项

不建议用户在配置文件增加 Clickhouse 内核本身不支持的配置项,防止启动失败或其他问题。Clickhouse 支持的配置信息详情请参考 Clickhouse 官方文档
目前该 XML 配置管理对 metrika.xml 支持的信息是有限的,目前只支持以下配置项和对应内容的修改。
<yandex>
<clickhouse_remote_servers>
<default_cluster>
<shard>
<internal_replication></internal_replication>
<replica>
<host></host>
<second_host></second_host>
<port></port>
<user></user>
<password></password>
</replica>
</shard>
</default_cluster>
<new_cluster_1>
<shard>
<internal_replication></internal_replication>
<replica>
<host></host>
<second_host></second_host>
<port></port>
<user></user>
<password></password>
</replica>
</shard>
</new_cluster_1>
</clickhouse_remote_servers>
<zookeeper-servers>
<node>
<host></host>
<port></port>
</node>
</zookeeper-servers>
</yandex>
其中,new_cluster_1 表示支持新的 cluster 的名称,second_host 为 ClickHouse 对内核一个改进功能参数,目前只在 Clickhouse 内核版本20.8.7.15中支持。
不支持 port 的修改,不支持 host 的 IP 设置为其他 IP 或其他集群的 IP。默认生成的 metrika.xml 中的 host 的 IP 与基本信息 > 网络信息中看到的 IP 是同一节点的两个 IP,前者用于后台管理,后者用于用户访问,metrika.xml 中的 IP 要使用非用户 VPC 的 IP 进行配置。
建议 metrika.xml 只用于维护以上与 cluster 和 zookeeper 相关的信息,如果在 metrika.xml 中增加了其他不支持的配置项,虽然提交修改成功,但是有不生效或丢失的风险。metrika.xml 后续会逐渐完善对更多配置项的支持后,会同步文档说明。
另外在 config.xml 中,与 ClickHouse 管控相关的一些信息,例如端口号、日志路径等不建议修改,可能会导致 ClickHouse 运行与管理的异常。建议只对 ClickHouse 运行配置进行调整,例如性能、压缩算法、MergeTree 等内容进行调整,不建议修改的配置项包括:
<yandex>
<logger>
<level>trace</level>
<log>/data/clickhouse/clickhouse-server/logs/clickhouse-server.log</log>
<errorlog>/data/clickhouse/clickhouse-server/logs/clickhouse-server.err.log</errorlog>
<size>1000M</size>
<count>10</count>
</logger>
<http_port>8123</http_port>
<tcp_port>9000</tcp_port>
<mysql_port>9004</mysql_port>
<interserver_http_port>9009</interserver_http_port>
<path>/data/clickhouse/clickhouse-server/</path>
<tmp_path>/data/clickhouse/clickhouse-server/tmp/</tmp_path>
<user_files_path>/data/clickhouse/clickhouse-server/user_files/</user_files_path>
<users_config>users.xml</users_config>
<timezone>Asia/Shanghai</timezone>
<mlock_executable>true</mlock_executable>
<remote_servers incl="clickhouse_remote_servers" />
<zookeeper incl="zookeeper-servers" optional="true" />
<macros incl="macros" optional="true" />
<prometheus>
<endpoint>/metrics</endpoint>
<port>9363</port>
<metrics>true</metrics>
<events>true</events>
<asynchronous_metrics>true</asynchronous_metrics>
</prometheus>
<query_log>
<database>system</database>
<table>query_log</table>
<partition_by>toYYYYMM(event_date)</partition_by>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
</query_log>
<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>
<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>
<compression incl="clickhouse_compression">
</compression>
<distributed_ddl>
<path>/clickhouse/task_queue/ddl</path>
</distributed_ddl>
<listen_host>0.0.0.0</listen_host>
<zookeeper incl="zookeeper-servers" optional="true" />
<macros incl="macros" optional="true" />
<include_from>/etc/clickhouse-server/metrika.xml</include_from>
</yandex>