记一次clickhouse手动更改分片数异常

背景:clickhouse中之前是1分片1副本,随着数据量增多,想将分片数增多,于是驻场人员手动添加了分片数的节点信息

c 复制代码
<clickhouse>
    <!-- 集群配置 -->
    <clickhouse_remote_servers>
        <feihuang_ck_cluster>
         <shard>
            <internal_replication>true</internal_replication>
            <replica>
                <host>feihuang3</host>
                <port>9000</port>
                <user>default</user>
                <password>xxxxxxxx</password>
            </replica>
            <replica>
                <host>feihuang5</host>
                <port>9000</port>
                <user>default</user>
                <password>xxxxxxxx</password>
            </replica>
        </shard>
        <shard>
            <internal_replication>true</internal_replication>
            <replica>
                <host>feihuang12</host>
                <port>9000</port>
                <user>default</user>
                <password>xxxxxxxx</password>
            </replica>
            <replica>
                <host>feihuang13</host>
                <port>9000</port>
                <user>default</user>
                <password>xxxxxxxx</password>
            </replica>
        </shard>
       </feihuang_ck_cluster>
    </clickhouse_remote_servers>

    <!-- 本节点服务器的副本名称 -->
    <macros>
        <cluster>feihuang_ck_cluster</cluster>
        <shard>2</shard>
        <replica>feihuang13</replica>
    </macros>

    <!-- ZK配置信息 -->
    <zookeeper-servers>
        <node index="1">
            <host>feihuang6</host>
            <port>2181</port>
        </node>
        <node index="2">
            <host>feihuang7</host>
            <port>2181</port>
        </node>
         <node index="3">
            <host>feihuang8</host>
            <port>2181</port>
        </node>
    </zookeeper-servers>

    <!-- 数据压缩算法 -->
    <clickhouse_compression>
        <case>
            <min_part_size>10000000000</min_part_size>
            <min_part_size_ratio>0.01</min_part_size_ratio>
            <method>zstd</method>
        </case>
    </clickhouse_compression>
</clickhouse>
```xml
 
复制代码
但是发现每次写入一条数据,结果表中却又两条一样的数据。

解决思路:排查配置文件,查看所有节点中的
<macros>
        <cluster>feihuang_ck_cluster</cluster>
        <shard>2</shard>
        <replica>feihuang13</replica>
    </macros>
    中的 <shard>2</shard>是不是都为2,结果发现全部都是2,这样对ck来说,配置了两个分片的节点信息,但是这都属于一个分片,导致数据写入两份,最后,将接地那shard分成两组,2个节点改为1,另外两个节点改为2,重启好了
相关推荐
问道飞鱼2 天前
【大数据知识】今天聊聊Clickhouse部署方案
大数据·clickhouse·部署
Fireworkitte4 天前
ClickHouse详解
clickhouse
知其_所以然6 天前
使用docker安装clickhouse集群
clickhouse·docker·容器
wuli玉shell6 天前
Doris和Clickhouse对比
clickhouse·doris
SelectDB技术团队9 天前
可观测性方案怎么选?SelectDB vs Elasticsearch vs ClickHouse
大数据·数据仓库·clickhouse·elasticsearch·信息可视化·doris·半结构化
goTsHgo9 天前
ClickHouse多表join的性能优化:原理与源码详解
clickhouse·性能优化
妖果yaoyao11 天前
docker 部署clickhouse
clickhouse·docker·容器
鱼鱼不愚与12 天前
处理 Clickhouse 内存溢出
数据库·分布式·clickhouse
Wonderful_一直有你12 天前
clickhouse - 重新建表覆盖旧表-解决分区时间错误问题-197001
clickhouse
千月落14 天前
ClickHouse副本集群
服务器·数据库·clickhouse