cluckhouse 版本22.2.2.1.
按照网上的教程配置/etc/clickhouse/config.xml后查询system.clusters就是没有对应的信息。
检查config.xml里面是不是有多个remove_servers标签!!!
一直没有看到原来的config.xml文件中间还有一个<remove_servers>标签...ffffk
注: 文件保存后后ClickHouse会自动加载配置文件,不需要重启
下面是3分片1副本配置,单机zookeeper
<clickhouse>
...
<include_from>/etc/clickhouse-server/metrika.xml</include_from>
<remote_servers incl="clickhouse_remote_servers" />
<zookeeper incl="zookeeper-servers" optional="true" />
<macros incl="macros" optional="true" />
<compression incl="clickhouse_compression" optional="true" />
</clickhouse>
然后配置/etc/clickhouse/metrika.xml
<yandex>
<clickhouse_remote_servers>
<demo_3shards_1replicas>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>node1</host>
<port>9000</port>
</replica>
</shard>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>node2</host>
<port>9000</port>
</replica>
</shard>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>node3</host>
<port>9000</port>
</replica>
</shard>
</demo_3shards_1replicas>
</clickhouse_remote_servers>
<zookeeper-servers>
<node index="1">
<host>node1</host>
<port>2181</port>
</node>
</zookeeper-servers>
<macros>
<replica>node2</replica>
</macros>
<networks>
<ip>::/0</ip>
</networks>
<clickhouse_compression>
<case>
<min_part_size>10000000000</min_part_size>
<min_part_size_ratio>0.01</min_part_size_ratio>
<method>lz4</method>
</case>
</clickhouse_compression>
</yandex>
或者把配置文件放在/etc/clickhouse/conf.d/下也可以,会和config.xml里面配置合并
<yandex>
<remote_servers>
<demo_3shards_1replicas>
...
</demo_3shards_1replicas>
</remote_servers>
</yandex>