Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one properly edit the clickhouse-server config.xml file?

Tags:

clickhouse

The ClickHouse quick start guide says that when modifying config.xml: "It's not really handy to directly edit config.xml file considering package updates. Recommended way is to override the config elements in files of config.d directory."

I am new to ClickHouse (as well as daemon configuration). What does that statement mean? Where is the config.d directory? What files should go into that directory and what should the contents be?

like image 332
Peter Avatar asked Oct 30 '16 18:10

Peter


1 Answers

It means that it's recommended to create a separate configuration file in the config.d directiory (that is located in the same path as the current configuration file; so /etc/clickhouse-server/config.d/ by default).

"considering package updates" means that if you update your clickhouse-server package, it may rewrite the /etc/clickhouse-server/config.xml, so you shouldn't put any changes in there - it'll be rewritten and lost.

It says so in the documentation:

The main server config file is 'config.xml'. It resides in the /etc/clickhouse-server/ directory. Certain settings can be overridden in the *.xml and *.conf files from the 'conf.d' and 'config.d' directories next to the config.

So, you should create a /etc/clickhouse-server/config.d/ directory; then, create a configuration file there (like config.xml, my_config.conf or whatever else). There you should do all your custom settings, the ones that differ from the original /etc/clickhouse-server/config.xml file.

For instance, you could change the HTTP port from 8123 to 8663:

# cat /etc/clickhouse-server/config.d/test.xml
<?xml version="1.0"?>
<yandex>
    <http_port>8663</http_port>
</yandex>

Please make sure to restart the daemon (if you're using Ubuntu, it's sudo service clickhouse-server restart) for the configuration changes to apply.

like image 107
Igor Hatarist Avatar answered Oct 01 '22 21:10

Igor Hatarist