简体   繁体   English

在Zookeeper集群中重新添加丢失的Clickhouse副本

[英]Re-add lost Clickhouse replica in Zookeeper cluster

We previously had three Clickhouse nodes perfectly synced within Zookeeper until one of them was lost. 我们之前在Zookeeper中完全同步了三个Clickhouse节点,直到其中一个节点丢失。

The Clickhouse node was rebuilt exactly as it was before (with Ansible) and the same create table command was run which resulted in the following error. Clickhouse节点与以前一样完全重建(使用Ansible)并运行相同的create table命令,导致以下错误。

Command: 命令:

CREATE TABLE ontime_replica ( ... )
ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/ontime_replica', '{replica}', FlightDate, (Year, FlightDate), 8192)

The error is: 错误是:

Received exception from server:
Code: 253. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Replica /clickhouse/tables/01/ontime_replica/replicas/clickhouse1 already exists..

We're currently using Zookeeper version 3.4.10 and I would like to know if there's a way to remove the existing replica within Zookeeper, or simple let Zookeeper know that this is the new version of the existing replica. 我们目前正在使用Zookeeper版本3.4.10,我想知道是否有一种方法可以删除Zookeeper中的现有副本,或者简单地让Zookeeper知道这是现有副本的新版本。

Thank you in advance! 先感谢您!

My approach to the solution was incorrect. 我对解决方案的处理方法不正确。 Originally, I thought I needed to remove the replica within Zookeeper. 最初,我以为我需要删除Zookeeper中的副本。 Instead, the following commands within the Clickhouse server solve this problem. 相反,Clickhouse服务器中的以下命令可以解决此问题。

  • Copy the SQL file from another, working node. 从另一个工作节点复制SQL文件。 The file is in /var/lib/clickhouse/metadata/default 该文件位于/var/lib/clickhouse/metadata/default

  • chown clickhouse:clickhouse <database>.sql

  • chmod 0640 <database>.sql

  • sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data

  • service clickhouse-server start

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM