2

我正在设置一个 clickhouse 集群,因为教程说应该添加“remote_servers”,然后我转向 /etc/clickhouse-server/config.xml,我看到 <remote_servers incl="clickhouse_remote_servers"> 后跟 [1 ]:http: //i.stack.imgur.com/AHBBg.png
我对这些文件感到困惑,/etc/metrika.xml 和 /yandex/name_of_substitution。谁能举个例子,谢谢

4

1 回答 1

4

可以通过两种方式指定。

  1. 在单独的文件中(默认为 /etc/metrika.xml)。创建此文件,使其可访问以供读取(chown 644 就足够了)。并在里面这样写:

    <yandex>
        <clickhouse_remote_servers>       <!-- name of substitution-->
            <logs_all>                    <!-- name of cluster (arbitary) to be specified in parameter of Distributed table -->
                <shard>
                    <replica>
                        <host>example01-01-1t.yandex.ru</host>
                        <port>9000</port>
                    </replica>
                    <replica>
                        <host>example01-01-2t.yandex.ru</host>
                        <port>9000</port>
                    </replica>
                </shard>
                <shard>
                    <replica>
                        <host>example02-01-1t.yandex.ru</host>
                        <port>9000</port>
                    </replica>
                    <replica>
                        <host>example02-01-2t.yandex.ru</host>
                        <port>9000</port>
                    </replica>
                </shard>
            </logs_all>
        </clickhouse_remote_servers>
    </yandex>
    
  2. 直接在 config.xml 文件中:

    <!-- Configuration of clusters that could be used in Distributed tables.
             https://clickhouse.yandex/reference_en.html#Distributed
      -->
    <remote_servers>
        <logs_all>                    <!-- name of cluster (arbitary) to be specified in parameter of Distributed table -->
            <shard>
                <replica>
                    <host>example01-01-1t.yandex.ru</host>
                    <port>9000</port>
                </replica>
                <replica>
                    <host>example01-01-2t.yandex.ru</host>
                    <port>9000</port>
                </replica>
            </shard>
            <shard>
                <replica>
                    <host>example02-01-1t.yandex.ru</host>
                    <port>9000</port>
                </replica>
                <replica>
                    <host>example02-01-2t.yandex.ru</host>
                    <port>9000</port>
                </replica>
            </shard>
        </logs_all>
    </remote_servers>
    

为方便起见,服务器将/etc/clickhouse-server/preprocessed/config.xml在启动时创建包含所有替换的文件。它仅用于审查(服务器不使用)。

于 2016-08-24T18:51:28.350 回答