clickhouse copier db::exception:找不到请求的群集“”

thigvfpy  于 2021-07-15  发布在  ClickHouse
关注(0)|答案(1)|浏览(842)

我正在测试clickhouse copier将数据从一个集群复制到另一个集群。
我建立了一个节点一个副本集群,名为。

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_ 还有两张table local_data 以及 dist_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 ```

<remote_servers>
<source_cluster>


127.0.0.1
9000


</source_cluster>
<target_cluster>


192.168.0.110
9000


</target_cluster>
</remote_servers>

<max_workers>1</max_workers>

<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}')
<sharding_key>rand()</sharding_key>
</table_events>

我交给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 ] {} : virtual int
DB::ClusterCopierApp::main(const std::vector<std::basic_string >&): Code: 170, e.displayText() =
DB::Exception: Requested cluster 'xxx' not found, Stack trace:

  1. clickhouse-copier(StackTrace::StackTrace()+0x16) [0x6834a66]
  2. clickhouse-copier(DB::Exception::Exception(std::string const&, int)+0x1f) [0x317311f]
  3. clickhouse-copier(DB::Context::getCluster(std::string const&) const+0x7f) [0x5e6115f]
  4. clickhouse-copier(DB::ClusterCopier::init()+0x1181) [0x3213b51]
  5. clickhouse-copier(DB::ClusterCopierApp::mainImpl()+0x5dd) [0x320383d]
  6. clickhouse-copier(DB::ClusterCopierApp::main(std::vector<std::string, std::allocatorstd::string > const&)+0x1a) [0x315619a]
  7. clickhouse-copier(Poco::Util::Application::run()+0x26) [0x6a84ec6]
  8. clickhouse-copier(Poco::Util::ServerApplication::run(int, char**)+0x136) [0x6a9f076]
  9. clickhouse-copier(mainEntryClickHouseClusterCopier(int, char**)+0x9a) [0x32001aa]
  10. clickhouse-copier(main+0x179) [0x314e609]
  11. /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f345138a3d5]
  12. clickhouse-copier() [0x316fd37]
clickhouse复印机看不到我的群集的原因可能是什么?我错过了配置过程中的哪一点?
其他信息:
我在源计算机上运行clickhouse复印机。
源计算机和目标计算机是虚拟机,在centos 7上运行
未设置目标服务器上的群集,因为不需要它,错误是源群集
防火墙已关闭。
4ioopgfo

4ioopgfo1#

它看起来像schema.xml中的错误:远程\u服务器下的source \u cluster和target \u cluster标记应命名为集群名称。
您需要用替换源\u集群,用test \u集群替换目标\u集群。
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>

相关问题