Clickhouse复印机DB :: Exception:未找到请求的群集'xxx'

时间:2019-06-12 21:14:10

标签: apache-zookeeper clickhouse

我正在测试 Clickhouse复印机,用于将数据从一个群集复制到另一个群集。

我建立了一个名为 xxx 的单节点一副本集群。

SELECT *
FROM system.clusters

┌─cluster─┬─shard_num─┬─shard_weight─┬─replica_num─┬─host_name─
│ xxx     │         1 │            1 │           1 │ 127.0.0.1 
└─────────┴───────────┴──────────────┴─────────────┴───────────
┬─host_address─┬─port─┬─is_local─┬─user────┬─default_database─┐
│ 127.0.0.1    │ 9000 │        1 │ default │                  │
┴──────────────┴──────┴──────────┴─────────┴──────────────────┘

我还在该集群cluster_xxx和两个表local_datadist_data上创建了数据库。

CREATE TABLE cluster_xxx.local_data on cluster xxx (
`countryName` String, 
`countryCode` String, 
`indicatorName` String,
`indicatorCode` String
) ENGINE = MergeTree() 
ORDER BY countryName 
SETTINGS index_granularity = 8192

CREATE TABLE cluster_xxx.dist_data on cluster xxx
 (`countryName` String,
 `countryCode` String,
`indicatorName` String,
 `indicatorCode` String
) ENGINE = Distributed(xxx, cluster_xxx, local_data)

然后,我为 Clickhouse-复印机准备了两个配置文件 zookeeper.zml

<yandex>
        <logger>
                <level>trace</level>
                <size>100M</size>
                <count>3</count>
        </logger>
        <zookeeper>
                <node>
                        <host>localhost</host>
                        <port>2181</port>
                </node>
        </zookeeper>
</yandex>

schema.xml

<yandex>
<remote_servers>
    <source_cluster>
        <shard>
            <replica>
                <host>127.0.0.1</host>
                <port>9000</port>
            </replica>
        </shard>
    </source_cluster>
    <target_cluster>
        <shard>
            <replica>
                <host>192.168.0.110</host>
                <port>9000</port>
            </replica>
        </shard>
    </target_cluster>
</remote_servers>

<max_workers>1</max_workers>
<tables>
    <table_events>
        <cluster_pull>xxx</cluster_pull>
        <database_pull>cluster_xxx</database_pull>
        <table_pull>dist_data</table_pull>

        <cluster_push>test_cluster</cluster_push>
        <database_push>cluster_test</database_push>
        <table_push>dist_data</table_push>

    <engine>ENGINE=MergeTree('/clickhouse/tables/test_cluster/cluster_test/dist_data', 
'{replica}')</engine>
        <sharding_key>rand()</sharding_key>
    </table_events>
</tables>
</yandex>
我放在 Zookeeper zookeeper-client create /clickhouse/description "$(cat schema.xml)"

上的

当我运行clickhouse-copier --config-file=zookeeper.zml --task-path=/clickhouse时会引发

2019.06.12 23:06:06.668703 [ 1 ] {} <Error> : virtual int 
DB::ClusterCopierApp::main(const std::vector<std::basic_string<char> >&): Code: 170, e.displayText() =
 DB::Exception: Requested cluster 'xxx' not found, Stack trace:

0. clickhouse-copier(StackTrace::StackTrace()+0x16) [0x6834a66]
1. clickhouse-copier(DB::Exception::Exception(std::string const&, int)+0x1f) [0x317311f]
2. clickhouse-copier(DB::Context::getCluster(std::string const&) const+0x7f) [0x5e6115f]
3. clickhouse-copier(DB::ClusterCopier::init()+0x1181) [0x3213b51]
4. clickhouse-copier(DB::ClusterCopierApp::mainImpl()+0x5dd) [0x320383d]
5. clickhouse-copier(DB::ClusterCopierApp::main(std::vector<std::string, std::allocator<std::string> > const&)+0x1a) [0x315619a]
6. clickhouse-copier(Poco::Util::Application::run()+0x26) [0x6a84ec6]
7. clickhouse-copier(Poco::Util::ServerApplication::run(int, char**)+0x136) [0x6a9f076]
8. clickhouse-copier(mainEntryClickHouseClusterCopier(int, char**)+0x9a) [0x32001aa]
9. clickhouse-copier(main+0x179) [0x314e609]
10. /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f345138a3d5]
11. clickhouse-copier() [0x316fd37]

Clickhouse复印机看不到我的集群的原因可能是什么?我会错过配置过程中的哪一点?

其他信息:

  • 我在源计算机上运行 Clickhouse复印机
  • 源计算机和目标计算机是vms,可在Centos 7上运行
  • 目标服务器上的集群未设置,因为没有必要,该错误与源集群有关
  • 防火墙已关闭。

1 个答案:

答案 0 :(得分:1)

似乎是 schema.xml 中的错误:应该在 remote_servers 下命名 source_cluster target_cluster 标签作为群集的名称。

您需要将 source_cluster 替换为 xxx ,并将 target_cluster 替换为 test_cluster

schema.xml:

<yandex>
<remote_servers>
    <xxx> <!--  ← ← ← -->
        <shard>
            <replica>
                <host>127.0.0.1</host>
                <port>9000</port>
            </replica>
        </shard>
    </xxx>
    <test_cluster> <!--  ← ← ← -->
        <shard>
            <replica>
                <host>192.168.0.110</host>
                <port>9000</port>
            </replica>
        </shard>
    </test_cluster>
</remote_servers>

<max_workers>1</max_workers>
<tables>
    <table_events>
        <cluster_pull>xxx</cluster_pull>
        <database_pull>cluster_xxx</database_pull>
        <table_pull>dist_data</table_pull>

        <cluster_push>test_cluster</cluster_push>
        <database_push>cluster_test</database_push>
        <table_push>dist_data</table_push>

        <engine>ENGINE=MergeTree('/clickhouse/tables/test_cluster/cluster_test/dist_data', '{replica}')</engine>
        <sharding_key>rand()</sharding_key>
    </table_events>
</tables>
</yandex>