Etcdbk is a tool for backing up the values in a live etcd cluster.
Etcdbk generates a tarball (tar.gz) with paths matching the keys in your etcd cluster. Etcdbk uses the etcd API instead of direct access to the etcd data directory, thus allowing backups to be generated on machines remote to the target cluster, or from within application containers.
Caveat: Because etcdbk only adds keys to resulting artifact, etcd paths that have no keys will be lost.
$ go get github.com/christian-blades-cb/etcdbk
Alternatively, a docker image is available at christianbladescb/etcdbk, or can be built via the build.sh script in the root of this repository.
Usage:
etcdbk [OPTIONS]
Application Options:
-e, --etcd-hosts= etcd machines (http://127.0.0.1:2379) [$ETCD_HOSTS]
-o, --outfile= Where to write the resulting tarball. '-' for STDOUT
[$OUTFILE]
-n, --cluster-name= Cluster name to use in naming the file in the S3 Bucket
(etcd-cluster) [$CLUSTER_NAME]
--aws-access= Access key of an IAM user with write access to the given
bucket [$AWS_ACCESS_KEY_ID]
--aws-secret= Secret key of an IAM user with write access to the given
bucket [$AWS_SECRET_ACCESS_KEY]
--s3-endpoint= AWS S3 endpoint. See http://goo.gl/OG2Nkv
(https://s3.amazonaws.com) [$AWS_S3_ENDPOINT]
--aws-bucket= Bucket in which to place the archive. [$AWS_S3_BUCKET]
--debug verbose logging
Help Options:
-h, --help Show this help message
To backup the keys from a cluster with a node running on localhost:
$ etcdbk -o ./my-etcd-backup.tar.gz
The archive at ./my-etcd-backup.tar.gz will contain a file system corresponding to the keys available in the etcd cluster.
Assuming you have previously created an S3 bucket and an IAM user with write access to that bucket:
$ etcdbk --cluster-name=my-etcd-cluster --aws-access=ACCESSKEY --aws-secret=SECRETKEYSAREALWAYSLONGER --s3-endpoint=https://s3.amazonaws.com --aws-bucket=etcdbackups
An archive will be saved into the specified bucket. The archive name will be in the format #{cluster name}-#{time in RFC3339}.tar.gz.
Content type
Image
Digest
sha256:c9820a0aa…
Size
2.2 MB
Last updated
almost 10 years ago
docker pull christianbladescb/etcdbk