How Do I Delete the Backup Table of the ZooKeeper Node in the ClickHouse Cluster?
Symptom
When you connect a ClickHouse cluster and create a table, the ZooKeeper node does not get fully removed after you delete the table.
Possible Causes
The command for creating a table contains ON CLUSTER default_cluster. Therefore, a local table is created on each node.
Solutions
Delete the tables and stored data on other nodes.
- Create a database.
create database demo ON CLUSTER default_cluster;
- Create tables in the database.
use demo;
Create the test table.
CREATE TABLE demo.test ON CLUSTER default_cluster(`EventDate` DateTime, `id` UInt64)ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/default/test', '{replica}') PARTITION BY toYYYYMM(EventDate) ORDER BY id;
- Delete the table.
drop table test SYNC;
- The following error message is displayed if a table with the same name as the deleted one is created:
┌─host──────────┬─port─┬─status─┬─error──────────────────────────────────────────────────────────────────────────────────────────────┬─num_hosts_remaining─┬─num_hosts_active─┐ │ 192.168.2.185 │ 9000 │ 57 │ Code: 57. DB::Exception: Table demo.test already exists. (TABLE_ALREADY_EXISTS) (version 22.3.2.1) │ 1 │ 1 │ └───────────────┴──────┴────────┴────────────────────────────────────────────────────────────────────────────────────────────────────┴─────────────────────┴──────────────────┘ ┌─host─────────┬─port─┬─status─┬─error─┬─num_hosts_remaining─┬─num_hosts_active─┐ │ 192.168.2.16 │ 9000 │ 0 │ │ 0 │ 0 │ └──────────────┴──────┴────────┴───────┴─────────────────────┴──────────────────┘
- Method 1: Run the following command to delete the tables and related data on each node:
drop table test ON CLUSTER default_cluster SYNC;
No error occurs if a table with the same name as the deleted one is created.
- Method 2: Delete the table on other nodes.
drop table test SYNC;
Data Read/Write FAQs
- Is Raw Data Stored in CloudTable HBase?
- Why Can't I Write Data to HBase?
- What Is the Maximum Size of Data Written to the HBase Cluster?
- How Do I Check the Daily Incremental Data in HBase Tables?
- What Should I Do If an Error Is Reported When I Access the CloudTable HBase Cluster?
- How Do I Delete the Backup Table of the ZooKeeper Node in the ClickHouse Cluster?
- What Should I Do If a Database Missing Error Occurs When a Table Is Created in the ClickHouse Cluster?
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbotmore