| 配置位置 | config.xml 或 config.d/ 下的片段文件,通常放 remote_servers 与 macros |
|---|---|
| 结构 | remote_servers → cluster 名 → shard → replica 列表 |
| internal_replication | true 表示写一张副本表即可,由副本机制同步;配合 ReplicatedMergeTree 使用 |
示例
示例
<remote_servers>
<prod>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>ch-1</host>
<port>9000</port>
</replica>
<replica>
<host>ch-2</host>
<port>9000</port>
</replica>
</shard>
</prod>
</remote_servers>配置校验用 SELECT * FROM system.clusters 查看展开后的分片与副本拓扑。