-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
v3.3.0-rc.0 restore from same snapshot, cannot add a new member #9109
Comments
how to do normal restore etcd cluster? |
@lyddragon Can't reproduce. What was the error message from
|
node4 start success, but restart fail
|
use backup snapshot build cluster, but new member data sync have problem.1、get keys:
2、backup on node1,and scp s.db to node2、node3
3、on node1、node2、node3
4、on node1、node2、node3,restore and start etcd service
5、add member node4
6、start node4
7、on node4, get keys, no keys
8、on node1, and add keys
$ ETCDCTL_API=3 /usr/local/etcd/etcdctl put k5 5 9、on node4, get keys,no k1-k4
|
@lyddragon What is your node4 config after running |
name: "node4" |
Did you delete data dir before start? Did you restore snapshot on node4? |
node4 is new member. |
Did you delete data dir before starting the node4? |
yes,first delete data dir. |
I had tried more time. |
This is exactly what you are doing? Try this yourself. If not, there's something wrong. ##################################
ETCD_VER=v3.3.0-rc.0
# choose either URL
GOOGLE_URL=https://storage.googleapis.com/etcd
GITHUB_URL=https://github.com/coreos/etcd/releases/download
DOWNLOAD_URL=${GOOGLE_URL}
rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
rm -rf /tmp/etcd-download-test && mkdir -p /tmp/etcd-download-test
curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1
rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
/tmp/etcd-download-test/etcd --version
/tmp/etcd-download-test/etcd
##################################
##################################
rm -rf /tmp/etcd-data-1.new
/tmp/etcd-download-test/etcd \
--name s1 \
--data-dir /tmp/etcd-data-1.new \
--listen-client-urls http://localhost:12379 \
--advertise-client-urls http://localhost:12379 \
--listen-peer-urls http://localhost:12380 \
--initial-advertise-peer-urls http://localhost:12380 \
--initial-cluster s1=http://localhost:12380,s2=http://localhost:22380,s3=http://localhost:32380 \
--initial-cluster-token tkn \
--initial-cluster-state new
rm -rf /tmp/etcd-data-2.new
/tmp/etcd-download-test/etcd \
--name s2 \
--data-dir /tmp/etcd-data-2.new \
--listen-client-urls http://localhost:22379 \
--advertise-client-urls http://localhost:22379 \
--listen-peer-urls http://localhost:22380 \
--initial-advertise-peer-urls http://localhost:22380 \
--initial-cluster s1=http://localhost:12380,s2=http://localhost:22380,s3=http://localhost:32380 \
--initial-cluster-token tkn \
--initial-cluster-state new
rm -rf /tmp/etcd-data-3.new
/tmp/etcd-download-test/etcd \
--name s3 \
--data-dir /tmp/etcd-data-3.new \
--listen-client-urls http://localhost:32379 \
--advertise-client-urls http://localhost:32379 \
--listen-peer-urls http://localhost:32380 \
--initial-advertise-peer-urls http://localhost:32380 \
--initial-cluster s1=http://localhost:12380,s2=http://localhost:22380,s3=http://localhost:32380 \
--initial-cluster-token tkn \
--initial-cluster-state new
##################################
##################################
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:12379,http://localhost:22379,http://localhost:32379 \
put foo1 bar1
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:12379,http://localhost:22379,http://localhost:32379 \
put foo2 bar2
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:12379,http://localhost:22379,http://localhost:32379 \
put foo3 bar3
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:12379,http://localhost:22379,http://localhost:32379 \
get "" --from-key
##################################
##################################
rm -f /tmp/a.db
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:12379 \
snapshot save /tmp/a.db
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
snapshot status /tmp/a.db --write-out=table
##################################
##################################
rm -rf /tmp/etcd-data-1.new
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
snapshot restore /tmp/a.db \
--data-dir /tmp/etcd-data-1.new \
--name s1 \
--initial-advertise-peer-urls http://localhost:12380 \
--initial-cluster s1=http://localhost:12380,s2=http://localhost:22380,s3=http://localhost:32380 \
--initial-cluster-token tkn
rm -rf /tmp/etcd-data-2.new
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
snapshot restore /tmp/a.db \
--data-dir /tmp/etcd-data-2.new \
--name s2 \
--initial-advertise-peer-urls http://localhost:22380 \
--initial-cluster s1=http://localhost:12380,s2=http://localhost:22380,s3=http://localhost:32380 \
--initial-cluster-token tkn
rm -rf /tmp/etcd-data-3.new
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
snapshot restore /tmp/a.db \
--data-dir /tmp/etcd-data-3.new \
--name s3 \
--initial-advertise-peer-urls http://localhost:32380 \
--initial-cluster s1=http://localhost:12380,s2=http://localhost:22380,s3=http://localhost:32380 \
--initial-cluster-token tkn
##################################
##################################
/tmp/etcd-download-test/etcd \
--name s1 \
--data-dir /tmp/etcd-data-1.new \
--listen-client-urls http://localhost:12379 \
--advertise-client-urls http://localhost:12379 \
--listen-peer-urls http://localhost:12380 \
--initial-advertise-peer-urls http://localhost:12380 \
--initial-cluster s1=http://localhost:12380,s2=http://localhost:22380,s3=http://localhost:32380 \
--initial-cluster-token tkn \
--initial-cluster-state existing
/tmp/etcd-download-test/etcd \
--name s2 \
--data-dir /tmp/etcd-data-2.new \
--listen-client-urls http://localhost:22379 \
--advertise-client-urls http://localhost:22379 \
--listen-peer-urls http://localhost:22380 \
--initial-advertise-peer-urls http://localhost:22380 \
--initial-cluster s1=http://localhost:12380,s2=http://localhost:22380,s3=http://localhost:32380 \
--initial-cluster-token tkn \
--initial-cluster-state existing
/tmp/etcd-download-test/etcd \
--name s3 \
--data-dir /tmp/etcd-data-3.new \
--listen-client-urls http://localhost:32379 \
--advertise-client-urls http://localhost:32379 \
--listen-peer-urls http://localhost:32380 \
--initial-advertise-peer-urls http://localhost:32380 \
--initial-cluster s1=http://localhost:12380,s2=http://localhost:22380,s3=http://localhost:32380 \
--initial-cluster-token tkn \
--initial-cluster-state existing
##################################
##################################
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:12379,http://localhost:22379,http://localhost:32379 \
endpoint health
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:12379,http://localhost:22379,http://localhost:32379 \
member list --write-out=table
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:12379,http://localhost:22379,http://localhost:32379 \
endpoint status --write-out=table
##################################
##################################
# member add
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:12379,http://localhost:22379,http://localhost:32379 \
member add s4 --peer-urls=http://localhost:42380
rm -rf /tmp/etcd-data-4.new
/tmp/etcd-download-test/etcd \
--name s4 \
--data-dir /tmp/etcd-data-4.new \
--listen-client-urls http://localhost:42379 \
--advertise-client-urls http://localhost:42379 \
--listen-peer-urls http://localhost:42380 \
--initial-advertise-peer-urls http://localhost:42380 \
--initial-cluster s1=http://localhost:12380,s2=http://localhost:22380,s3=http://localhost:32380,s4=http://localhost:42380 \
--initial-cluster-token tkn \
--initial-cluster-state existing
##################################
##################################
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:42379 \
put foo4 bar4
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:12379 \
get "" --from-key
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:22379 \
get "" --from-key
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:32379 \
get "" --from-key
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:42379 \
get "" --from-key
##################################
##################################
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:12379,http://localhost:22379,http://localhost:32379,http://localhost:42379 \
endpoint health
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:12379,http://localhost:22379,http://localhost:32379,http://localhost:42379 \
member list --write-out=table
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl \
--endpoints=http://localhost:12379,http://localhost:22379,http://localhost:32379,http://localhost:42379 \
endpoint status --write-out=table
################################## |
my cluster have 3 member, and do snapshot from 3 member cluster!!! |
what do you mean? |
Follow my steps. |
the very beginning,my cluster have 3 member,your cluster only one member. |
set up 3-node cluster (A, B, C) 1 2 3 4 5 6 7 8 9 |
Updated #9109 (comment). Still works. If not, I should be missing something, still. Regarding snapshot at the beginning, ass long as the snapshot from A is recent (contains all keys), it won't make any difference. Please provide locally reproducible script as above, or try the script above yourself. |
associated with it: wal-dirmy configuration:
but 'etcdctl snapshot restore ' no option: --wal-dir test configuration file: e.conf
test script
|
Now I see what went wrong. You are configuring separate WAL directory |
--wal-dir Allow point to different directory. |
Problem is
So, I assume your systemd config points to wrong wal dir. |
'etcdctl snapshot restore' need to add option: --wal-dir, or add option: --config-file (may be necessary) . |
@lyddragon Can you open a new issue explaining your use case? Thanks! |
To make it easier to maintain |
@lyddragon I submitted a PR to add |
If add --config-file may be more convenient. |
From #9094 (comment)
We don't have any test coverage around this...
Likely related to #9096.
/cc @lyddragon
The text was updated successfully, but these errors were encountered: