Category: Etcd

  • etcdctl

    检测 etcd 状态

    etcdctl --endpoints http://127.0.0.1:4001 cluster-health
    
    etcdctl member list
    996585598035175a, started, etcd-0, http://etcd-0.etcd:2380, http://etcd-0.etcd:2379
    9a7f19668a394adb, started, etcd-1, http://etcd-1.etcd:2380, http://etcd-1.etcd:2379
    92dc397d93504108, started, etcd-2, http://etcd-2.etcd:2380, http://etcd-2.etcd:2379
    
    # etcdctl --endpoints=[etcd-0.etcd:2379,etcd-1.etcd:2379,etcd-2.etcd:2379] endpoint health
    etcd-0.etcd:2379 is healthy: successfully committed proposal: took = 4.658206ms
    etcd-2.etcd:2379 is healthy: successfully committed proposal: took = 5.670776ms
    etcd-1.etcd:2379 is healthy: successfully committed proposal: took = 5.608339ms
    

    查看所有 a 开头的 key

    etcdctl-3.2.26 get a --prefix --keys-only
    

    查看所有 key

    ETCDCTL_API=3 etcdctl get "" --prefix --keys-only
    

    备份

    etcdctl --endpoints=[etcd-0.etcd:2379,etcd-1.etcd:2379,etcd-2.etcd:2379]  snapshot save snapshot.db