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

etcdctl complete delete wipe #10101

Closed
vorburger opened this issue Sep 18, 2018 · 4 comments
Closed

etcdctl complete delete wipe #10101

vorburger opened this issue Sep 18, 2018 · 4 comments

Comments

@vorburger
Copy link
Member

For local testing, I find myself wanting to just completely "wipe" any data etcd from the CLI with etcdctl :

https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-reset/ proposes this, but NOK:

$ etcdctl del "" --prefix
No help topic for 'del'

$ etcdctl rm -r ""
$ Error:  107: Root is read only (/) [3]

Currently I do it like this, but this of course feels more like a workaround:

$ sudo systemctl stop etcd
$ sudo rm -rf /var/lib/etcd/default.etcd
$ sudo systemctl start etcd

PS: Old and close #2385 had something similar, it seems.

@hexfusion
Copy link
Contributor

@vorburger does ETCDCTL_API=3 etcdctl del "" --from-key=true do the trick?

@vorburger
Copy link
Member Author

@hexfusion oh. Yeah - that seems to work great; thanks!

vorburger added a commit to vorburger/opendaylight-etcd that referenced this issue Sep 18, 2018
@iofirag
Copy link

iofirag commented Jul 6, 2021

ETCDCTL_API=3 etcdctl del "*" --from-key=tru

@bootjp
Copy link

bootjp commented Feb 8, 2024

Thank you for this issue.
An example implementation in jetcd (Java etcd client) is below for reference.

var kvClient = client.getKVClient();

var end = OptionsUtil.prefixEndOf(ByteSequence.from(new byte[]{}));
DeleteResponse deleteResponse = kvClient.delete(
    ByteSequence.from(ByteString.copyFromUtf8("*")),
    DeleteOption.builder().isPrefix(true)
        .withRange(end)
        .build()
).get();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants