-
Hi, Does the restore have to occur on each clickhouse node, or do the original table schemas need to be replaced or what? I haven't been able to find any answers for this particular situation. I'm also not sharding yet, so it's a pretty straightforward config. Also, not sure if it matters or not, but the clickhouse cluster and clickhouse-back are running in containers. thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments
-
could you provide more context how did you execute clikchouse-backup? |
Beta Was this translation helpful? Give feedback.
-
Firs of all, just wanted to say thanks... I see your name all over the place helping out with detailed information, it's much appreciated! I managed to get this completed by first recreating all the tables schema, then doing the restore. I guess I had assumed that since the backup "appeared" to have the tables as replicatedmergetree that it would all get recreated. Is it correct then, to first recreate all the table schemas, then do the restore, or is there a better way of doing this? |
Beta Was this translation helpful? Give feedback.
-
Sorry, I still not understand what exactly do you try to achieve? restore command by default re-create exists table with schema which contains in every backup |
Beta Was this translation helpful? Give feedback.
-
sorry, my restore sequence is: "clickhouse-backup restore fileNameOfBackup", running on one of the clickhouse nodes, nothing very exotic. This was a new installation of a 3 node clickhouse cluster that I was restoring to, so no databases, no tables. When I first tried, it only restored to the node that clickhouse-backup was running on. The other two nodes did not replicate. If I first create the databases and tables, and then do a restore, the data replicates across all the nodes. |
Beta Was this translation helpful? Give feedback.
-
what means did you use maybe you need read |
Beta Was this translation helpful? Give feedback.
-
Yes, the fileNameOfBackup is as you describe, just the backup name. In my case it is like this: 2025-01-13T23:50:27. I did notice there there are options to the restore; --schema & --data, which say only schema and only data respectively. So I assumed not using those options I would get both schema and data when I restored. Which I did, but it didn't replicate across all nodes. I'm still puzzled at how to do this when starting with a new installation of clickouse and trying to bring in existing data to that new installation. |
Beta Was this translation helpful? Give feedback.
-
going though the clickhouse-backup website, I found this note: It sounds like perhaps the process should be (and in my case this is a newly created clickhouse cluster):
Clickhouse should then provide the replication across all nodes. Does this sound correct? Based on what else the website states, the backup needs to be running in the same namespace as the clickhouse-server node. I'm running all this in containers, so that means the clickhouse-backup would have to run on that same node in order to get to the clickhouse-server's data, is that correct? |
Beta Was this translation helpful? Give feedback.
-
Doesn't matter will you restore on new setup or exists setup
if your restore failed
this is expected behavior, and properly command sequence to avoid it described on link which I shared above another way is using following config options clickhouse:
restore_schema_on_cluster: "{cluster}" In this case, the schema will restore on all nodes in the cluster (will add ON CLUSTER clause to each DROP and CREATE queries) In any case, if you have multiple shards and separate backup for each shard, follow the command sequence which shared above |
Beta Was this translation helpful? Give feedback.
-
are you sure you read https://github.com/Altinity/clickhouse-backup/blob/master/Examples.md#how-to-back-up--restore-a-sharded-cluster? restore schema first
yes, it requires |
Beta Was this translation helpful? Give feedback.
-
If table not exist on the node, how will we replicate data? And not "to all nodes", but only to nodes where table exists and have the same replication path in Zookeeper This is the root reason why use |
Beta Was this translation helpful? Give feedback.
-
Yes, the same node and requires same volumes with |
Beta Was this translation helpful? Give feedback.
-
Okay, I think I have it now, thanks! |
Beta Was this translation helpful? Give feedback.
Doesn't matter will you restore on new setup or exists setup
restore
command will do following SQL sequence:if your restore failed
provide full restore command and full restore logs
this is expected behavior, and properly command sequence to avoid it described on link which I shared above
another way is using following config options