How to make clickhouse take new users.xml file?

2020-04-20 11:35发布

问题:

Do I have to restart clickhouse to make it read any update to users.xml? Is there a way to juse "reload" clickhouse?

回答1:

These files are reloaded in runtime, no need to restart the server.

As you can notice config folder has several files, like

config-preprocessed.xml
config.xml
users-preprocessed.xml
users.xml

.*-preprocessed.xml are for parsed config so you will see when it is loaded and parsed.



回答2:

I wouldn't recommend to modify files '/etc/clickhouse-server/config.xml' or 'etc/clickhouse-server/user.xml' because it will be rewritten after upgrading ClickHouse and you will lose custom settings.

The subfolder '/etc/clickhouse-server/config.d/' and '/etc/clickhouse-server/users.d/' serve to store overrides for 'config.xml' and 'user.xml' relatively.

Example overrides for 'config.xml':

  1. config.d/config.xml
<?xml version="1.0"?>
<yandex>
    <listen_host replace="replace">::</listen_host>

    <dictionaries_config replace="replace">dictionaries/*.xml</dictionaries_config>

    <openSSL>
        <client>
            <verificationMode replace="replace">none</verificationMode>
        </client>
    </openSSL>
</yandex>
  1. config.d/cluster.xml
<?xml version="1.0"?>    
<yandex>
    <remote_servers>
        <your_cluster>
        <!--  topology definition  -->
        </your_cluster>
    </remote_servers>
    <zookeeper>
      <!--  ..  -->
    </zookeeper>
</yandex>
  1. config.d/kafka.xml
<?xml version="1.0"?>
<yandex>
    <!-- The default configuration for Kafka Engine Table (https://clickhouse.yandex/docs/en/operations/table_engines/kafka/#configuration). -->
    <kafka>
        <bootstrap_servers>11.22.33.44:6667,11.22.33.55:6667,11.22.33.66:6667</bootstrap_servers>
        <auto_offset_reset>latest</auto_offset_reset>
    </kafka>

    <!-- The Topics configurations. -->
    <kafka_topic_name>
        <group_id>clickhouse-group_id</group_id>
    </kafka_topic_name>
</yandex>

Example overrides for 'users.xml':

  1. users.d/user.xml
<?xml version="1.0"?>
<yandex>
    <users>
        <default>
            <password replace="replace">hello_clickhouse</password>
        </default>

        <readonly>
            <password replace="replace">hello</password>
        </readonly>
    </users>
</yandex>

Another example of config overrides.

See for details ClickHouse Configuration files.



标签: clickhouse