clickhouse执行分布式DDL报错:Table `xxx` isn't replicated, but shard #2 is replicated according to its cluster definition

原创 2020-11-17 18:06 阅读(1480)次

clickhouse执行分布式DDL报错:Table `xxx` isn't replicated, but shard #2 is replicated according to its cluster definition

执行的语句是:

alter table engs_comp_clg_result_local on cluster shipin_cluster drop partition 20191101

我是想把我集群shipin_cluster中两个节点的本地表中一个分区删除掉,但是一执行报如上错误,说是我的本地表不是复制表,但是分片2却根据定义在复制。

我的集群配置如下:

<yandex>
    <!-- 集群配置 -->
    <clickhouse_remote_servers>
        <!-- 集群名称 2分片一副本,名称可自定义 -->
        <mycluster>
            <!-- 数据分片1  -->
            <shard>
		<internal_replication>true</internal_replication>
                <replica>
                    <host>192.168.15.137</host>
                    <port>9000</port>
		    <user>default</user>
                    <password>123456</password>
                </replica>
            </shard>
            <!-- 数据分片2  -->
            <shard>
		<internal_replication>true</internal_replication>
                <replica>
                    <host>192.168.15.139</host>
                    <port>9000</port>
		    <user>default</user>
                    <password>123456</password>					
                </replica>
            </shard>
        </mycluster>
    </clickhouse_remote_servers>
	<!--压缩算法 -->
    <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>

我并没有配置复制节点,只有2个分片节点,所以上面报的错,应该是我配置错了,后来发现:

<internal_replication>true</internal_replication>

这个配置是副本复制配置,于是我删除,再执行分布式DDL语句成功了!两个分片的表分区都成功删除了。


如果开发过程中有什么问题,或者想了解一些clickhouse的原理的同学,推荐朱凯老师这本书

链接地址点:ClickHouse原理解析与应用实践