Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I recovery etcd v2 and v3 data separately ? #9471

Closed
zyy17 opened this issue Mar 21, 2018 · 7 comments
Closed

How do I recovery etcd v2 and v3 data separately ? #9471

zyy17 opened this issue Mar 21, 2018 · 7 comments

Comments

@zyy17
Copy link
Contributor

zyy17 commented Mar 21, 2018

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:

@ZiggyMaes
Copy link

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.

@zyy17
Copy link
Contributor Author

zyy17 commented Sep 2, 2018

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 :)

@ZiggyMaes
Copy link

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?

@zyy17
Copy link
Contributor Author

zyy17 commented Sep 10, 2018

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

@ZiggyMaes
Copy link

Ah I see, fair enough! Cheers!

@git1988
Copy link

git1988 commented May 21, 2019

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 ?

@stale
Copy link

stale bot commented Apr 7, 2020

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.

@stale stale bot added the stale label Apr 7, 2020
@stale stale bot closed this as completed Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants