0

I am setting up Posthog which includes Clickhouse and connects to Zookeeper. It was set up and working, but the Zookeeper cluster was destroyed by accident.

Now a new one is set up, but Clickhouse logs that it has issues with the metadata and can't use the new zookeeper, tables are being put in READ_ONLY mode. Because of this no new PostHog events are being saved.

How can I make Clickhouse generate new metadata on this new Zookeeper cluster?

robliv
  • 1,351
  • 3
  • 15
  • 30

1 Answers1

1
system restore replica 'your_table';

https://clickhouse.com/docs/en/sql-reference/statements/system/#restore-replica

Denny Crane
  • 11,574
  • 2
  • 19
  • 30
  • Hi Denny, thank you very much, I managed to solve part of the issue and error messages about read-only tables are gone. An additional problem is that there are references to the old Kafka cluster in some tables as I can see `clickhouse-server.err.log` file mentions it can't resolve the old cluster hostname. Is it possible to replace all occurrences with a script using CH client? – robliv Oct 10 '22 at 21:05
  • Just to clarify I noticed there are docs about search and replace, but how could I find all the occurrences of old hostname in all the tables? Error message is like this: ` StorageKafka (kafka_person_distinct_id): [rdk:ERROR] [thrd:app]: ClickHouse-chi-posthog-posthog-0-0-0.chi-posthog-posthog-0-0.posthog.svc.cluster.local-posthog-kafka_person_distinct_id#consume: b-1.oldhostname.kafka.eu-west-1.amazonaws.com:9092/bootstrap: Failed to resolve 'b-1.oldhostname.kafka.eu-west-1.amazonaws.com:9092': Name or service not known (after 3ms in state CONNECT, 28 identical error(s) suppressed)` – robliv Oct 10 '22 at 21:13
  • 1
    No it's not possible to change Kafka table definition. You have to use drop/create. – Denny Crane Oct 11 '22 at 00:26