ClickHouse / ClickHouse

ClickHouse® is a real-time analytics DBMS
https://clickhouse.com
Apache License 2.0
37.25k stars 6.86k forks source link

created databases with replicated engine is not present in one only shard.(REPLICA_ALREADY_EXISTS) #55102

Closed Ragavendra-Vigneshwaran-R closed 1 year ago

Ragavendra-Vigneshwaran-R commented 1 year ago

I have 3 shards and 2 replica clickhouse cluster in my eks cluster. In that, I created databases with replicated engine using below command. In 'chi-clickhouse-clickhouse-cluster-shard0-0-0' shard, the replicated databases is not exist and only default databases exists. In all other shard and other replica, the databases is present. When I create a databases again in 'chi-clickhouse-clickhouse-cluster-shard0-0-0' shard with replicated engine, it throws replica already exists exception (below exception)

Command : CREATE DATABASE appdata ENGINE = Replicated('/clickhouse/replicated/databases/appdata', '{shard}', '{replica}')

I executed the command in all shards and replicas of clickhouse server

Exception Received exception from server (version 23.7.5): Code: 253. DB::Exception: Received from localhost:9000. DB::Exception: Replica chi-clickhouse-clickhouse-cluster-shard0-0 of shard shard0 of replicated database at /clickhouse/replicated/databases/appdata already exists. Replica host ID: 'chi%2Dclickhouse%2Dclickhouse%2Dcluster%2Dshard0%2D0%2D0%2Echi%2Dclickhouse%2Dclickhouse%2Dcluster%2Dshard0%2D0%2Eclickhouse%2Esvc%2Ecluster%2Elocal:9000:ea2643aa-c469-4182-9261-71cc8fcdd701', current host ID: 'chi%2Dclickhouse%2Dclickhouse%2Dcluster%2Dshard0%2D0%2D0%2Echi%2Dclickhouse%2Dclickhouse%2Dcluster%2Dshard0%2D0%2Eclickhouse%2Esvc%2Ecluster%2Elocal:9000:3ae13bb7-affb-4baf-ab34-8d3c08fa325b'. (REPLICA_ALREADY_EXISTS)

Expected behavior The replicated engine should be present in all shards and all replica.

Ragavendra-Vigneshwaran-R commented 1 year ago

This is because of some zookeeper exception in my case. So closing it now.