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


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

    <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
     
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    但是发现每次写入一条数据,结果表中却又两条一样的数据。
    
    解决思路:排查配置文件,查看所有节点中的
    
            feihuang_ck_cluster
            2
            feihuang13
        
        中的 2是不是都为2,结果发现全部都是2,这样对ck来说,配置了两个分片的节点信息,但是这都属于一个分片,导致数据写入两份,最后,将接地那shard分成两组,2个节点改为1,另外两个节点改为2,重启好了
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
  • 相关阅读:
    【JDBC篇】 preparedStatement和Statement区别
    DJ8-2 主存储器的组织
    Naive UI 中使用message组件,在.vue文件之外使用
    Spark常用算子
    PHP 行事准则:PHP 配置文件
    libusb 源码移植到工程项目中,使用CMake编译
    多域名路由访问站点子目录
    redisson springboot配置
    企业应用级自动化运维的建设思路
    Kafka开启SASL认证 【windowe详细版】
  • 原文地址:https://blog.csdn.net/weixin_51473488/article/details/133064177