What Should I Do If a Database Missing Error Occurs When a Table Is Created in the ClickHouse Cluster?
Symptom
When a table is created, the system displays a message indicating that the database does not exist on another node.
Possible Causes
A database is created only on one node when the cluster is created.
Solutions
Create a database on another code or use another command to create one on each node.
Method 1:
- Creates a database.
create database demo;
Use the demo database.
use demo;
- Create the test table. The result shown in Figure 1 is displayed. The demo database does not exist on other nodes.
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;
- Create a database demo on another node and create a table. If the information shown in the following figure is displayed, no error occurs.
Figure 2 Successful execution
Method 2:
- Delete the existing database and use the following command to create a database on each node.
create database demo ON CLUSTER default_cluster;
- Create a table and error message shown in Figure 1 is not displayed.
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.
Chatbot