分布式表删除分区

问题描述 投票:0回答:1

我已如下创建复制的合并树表:

CREATE TABLE probe.a on cluster dwh (
instime UInt64,
psn UInt64
) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/probe/a', '{replica}') PARTITION BY instime ORDER BY (psn);

然后我创建了一个分布式表::>

CREATE TABLE probe.a_distributed on cluster dwh (
instime UInt64,
psn UInt64
) ENGINE = Distributed(dwh,probe, a, rand());

然后我在每个服务器中添加了宏:

服务器1

<yandex>
    <macros replace="true">
        <shard>1</shard>
        <replica>server1.com</replica>
    </macros>
</yandex>

服务器2

<yandex>
    <macros replace="true">
        <shard>2</shard>
        <replica>server2.com</replica>
    </macros>
</yandex>

远程服务器:

<dwh>
            <!-- shard 01 -->
            <shard>            
                <replica>
                    <host>server1.com</host>
                    <port>9000</port>
                    <user>default</user>
                    <password>test12pwd</password>
                </replica>
            </shard>

            <!-- shard 02 -->
            <shard>            
                <replica>
                    <host>server2.com</host>
                    <port>9000</port>
                    <user>default</user>
                    <password>test12pwd</password>
                </replica>
            </shard>
 </dwh>

删除分区时有两个问题:

  1. [当我使用分布式表删除分区时

    集群dwh DROP PARTITION'2020-03-13'上的ALTER TABLE probe.a;

  2. 我收到错误:

DB :: Exception:表'a'已复制,但分片4未复制根据其群集定义。可能真实被遗忘了群集配置。 (版本19.16.14.65)(版本19.16.14.65)

  1. 分别删除分区,但分布式表仍显示一半的行,但是当我在本地检查时,没有行enter image description here

分布式表的此问题如何解决无需复制的分片数据?

我已经创建了复制的合并树表,如下所示:在群集dwh上创建表TABLE.a(instime UInt64,psn UInt64)引擎= ReplicatedMergeTree('/ clickhouse / tables / {shard} / probe / a','{replica} ')...

clickhouse
1个回答
0
投票

您使用复制表。您必须用<internal_replication>true</internal_replication>标记分片。

© www.soinside.com 2019 - 2024. All rights reserved.