配置clickhouse集群时remote-server元素应该位于哪里

loo*_*roo 3 cluster-computing clickhouse

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

uYS*_*foz 5

它可以通过两种方式指定。

  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>
    
    Run Code Online (Sandbox Code Playgroud)
  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>
    
    Run Code Online (Sandbox Code Playgroud)

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