配置clickhouse集群时,远程服务器元素应该位于何处

vs91vp4v  于 2021-07-15  发布在  ClickHouse
关注(0)|答案(1)|浏览(622)

我正在设置一个clickhouse集群,正如教程所说的,应该添加“远程\u服务器”,然后我转到/etc/clickhouse server/config.xml,我看到<remote\u servers incl=“clickhouse\u remote\u servers”>后跟[1]:http://i.stack.imgur.com/ahbbg.png .
我对这些文件感到困惑,/etc/metrika.xml和/yandex/name\u of\u替换。谁能举个例子,谢谢

qyuhtwio

qyuhtwio1#

它可以用两种方式来说明。
在单独的文件中(默认为/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>

直接在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 包含所有替换的启动时的文件。它只是供审阅(服务器不使用)。

相关问题