My etcd(3.2.9) cluster have v2 and v3 data and will backup v2 and v3 data separately.
Firstly, recovery v3 data:
ETCDCTL_API=3 etcdctl snapshot restore backup-v3.db
and it will generate default.etcd in the directory.
Secondly, recovery v2 data:
etcd -data-dir backup-v2 -force-new-cluster
it seems that I need to choose my backup dir (although I already have data dir generated by v3 recovery).
I am confused that if I have data dir from two different recovery process, how can I merge them into one data dir ?
I know the v2 backup will backup the v3 data, but maybe it will be risky to lost data (see #7002) and my etcdctl don't support --with-v3 option.
Related questions and documents:
Joining the question. I have also seen the --with-v3 option that etcdctl backup would apparently offer, but it does not appear to be available in etcdctl 3.1.18.
I cannot seem to find any documentation that describes the procedure on how to restore a cluster containing both v2 and v3 data.
I have try this way and it works:
Backup process
backup etcd v2 data using v2 command and you will get snap and wal data;
backup etcd v3 data using v3 command and you will get snapshot;
Recovery process
recovery v3 data at firstï¼›
once the etcd cluster is up and v3 data is completed, dump v2 data from backup and write it back to the new cluster;
Maybe it is tricky and not recommended, but for our tech debt(someone mix store v2 and v3 data in production environment), we have handle this situation.
@ZiggyMaes maybe my experience will help you :)
Thank you for your response @GhostComputing , we appreciate it.
Could you clarify what you mean by 'dump v2 data from backup and write it back to the cluster'. How does one do this?
It's very tricky (maybe) ... I just read the etcd v2 data from backup and write them back to v3 cluster (already recover from v3 data), that means, you have to recovery v3 data at first, them recovery v2 data using read-and-write way. @ZiggyMaes
Ah I see, fair enough! Cheers!
I just recovered ETCD v2 from backups. Restore seems succesfull.
But when I run member list/cluster health it shows only 1 ETCD host and when you run again it shows 2nd ETCD host and 3rd ETCD host name . Also same I see when I do member list.
It shows 1 server at a time , and all members are shown as leader. how I can fix it ?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.