• This repository has been archived on 23/Oct/2020
  • Stars
    star
    260
  • Rank 151,835 (Top 4 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cloud Native Infrastructure BackUp & RecoveRY

burry

Go Report Card

This is burry, the BackUp & RecoveRY tool for cloud native infrastructure services. Use burry to back up and restore critical infrastructure base services such as ZooKeeper and etcd. More…

burry overview

burry currently supports the following infra services and storage targets:

ZooKeeper etcd Consul
Amazon S3 B/R B/R B/R
Azure Storage []/[] []/[] []/[]
Google Storage B/R B/R B/R
Local B/R B/R B/R
Minio* B/R B/R B/R
TTY** B/- B/- B/-
 B  ... backups supported
 R  ... restores supported
 -  ... not applicable
 [] ... not yet implemented
 *) Minio can be either on-premises or in the cloud, but always self-hosted. See also https://www.minio.io
**) TTY effectively means it's not stored at all but rather dumped on the screen; useful for debugging, though.

Note:

  • burry is WIP, please use with care
  • if you want to learn more about the design (goals/assumptions), check out the background notes
  • if you want to hack (rather than simply use) burry, check out the development and testing notes

Contents:

Install

Currently, only 'build from source' install is available (note: replace GOOS=linux with your platform):

$ go get github.com/mhausenblas/burry.sh
$ GOOS=linux go build
$ mv burry.sh burry
$ godoc -http=":6060" &
$ open http://localhost:6060/pkg/github.com/mhausenblas/burry.sh/

See also GoDocs.

Use

The general usage is:

$ burry --help
Usage: burry [args]

Arguments:
  -b, --burryfest
        Create a burry manifest file .burryfest in the current directory.
        The manifest file captures the current command line parameters for re-use in subsequent operations.
  -c, --credentials string
        The credentials to use in format STORAGE_TARGET_ENDPOINT,KEY1=VAL1,...KEYn=VALn.
        Example: s3.amazonaws.com,ACCESS_KEY_ID=...,SECRET_ACCESS_KEY=...,BUCKET=...,PREFIX=...,SSL=...
  -e, --endpoint string
        The infra service HTTP API endpoint to use.
        Example: localhost:8181 for Exhibitor
  -f, --forget boolean 
        Forget existing data
  -i, --isvc string
        The type of infra service to back up or restore.
        Supported values are [etcd zk consul] (default "zk")
  -o, --operation string
        The operation to carry out.
        Supported values are [backup restore] (default "backup")
  -s, --snapshot string
        The ID of the snapshot.
        Example: 1483193387
  -t, --target string
        The storage target to use.
        Supported values are [local minio s3 tty local] (default "tty")
      --timeout=1: The infra service timeout, by default 1 second
  -v, --version
        Display version information and exit.

Note: If you want to re-use your command line parameters, use the --burryfest or -b argument: this creates a manifest file .burryfest in the current directory, capturing all your settings. If a manifest .burryfest exists in the current directory subsequent invocations use this and hence you can simply execute burry, without any parameters. Remove the .burryfest file in the current directory to reset stored command line parameters.

An example of a burry manifest file looks like:

{
    "svc": "etcd",
    "svc-endpoint": "etcd.mesos:1026",
    "target": "local",
    "credentials": {
        "target-endpoint": "",
        "params": []
    }
}

Note that for every storage target other than tty a metadata file .burrymeta in the (timestamped) archive file will be created, something like:

{
  "snapshot-date": "2016-12-31T14:52:42Z",
  "svc": "zk",
  "svc-endpoint": "leader.mesos:2181",
  "target": "s3",
  "target-endpoint": "s3.amazonaws.com"
}

Backups

In general, since --operation backup is the default, the only required parameter for a backup operation is the --endpoint. That is, you'll have to provide the HTTP API of the ZooKeeper or etcd you want to back up:

$ burry --endpoint IP:PORT (--isvc etcd|zk) (--target tty|local|s3) (--credentials STORAGE_TARGET_ENDPOINT,KEY1=VAL1,...,KEYn=VALn)

Some concrete examples follow now.

Screen dump of local ZooKeeper content

To dump the content of a locally running ZK onto the screen, do the following:

# launching ZK:
$ docker ps
CONTAINER ID        IMAGE                                  COMMAND                  CREATED             STATUS              PORTS                                                                                            NAMES
9ae41a9a02f8        mbabineau/zookeeper-exhibitor:latest   "bash -ex /opt/exhibi"   2 days ago          Up 2 days           0.0.0.0:2181->2181/tcp, 0.0.0.0:2888->2888/tcp, 0.0.0.0:3888->3888/tcp, 0.0.0.0:8181->8181/tcp   amazing_kilby

# dump to screen:
$ DEBUG=true ./burry --endpoint localhost:2181
INFO[0000] Using burryfest /home/core/.burryfest  func=init
INFO[0000] My config: {InfraService:zk Endpoint:localhost:2181 StorageTarget:tty Creds:{StorageTargetEndpoint: Params:[]}}  func=init
INFO[0000] /zookeeper/quota:                             func=reapsimple
INFO[0000] Operation successfully completed.             func=main

See the development and testing notes for the test setup.

Back up etcd to local storage

To back up the content of an etcd running in a (DC/OS) cluster to local storage, do:

# create the backup:
$ ./burry --endpoint etcd.mesos:1026 --isvc etcd --target local
INFO[0000] My config: {InfraService:etcd Endpoint:etcd.mesos:1026 StorageTarget:local Creds:{StorageTargetEndpoint: Params:[]}}  func=init
INFO[0000] Operation successfully completed. The snapshot ID is: 1483194168  func=main

# check for the archive:
$ ls -al 1483194168.zip
-rw-r--r--@ 1 mhausenblas  staff  750 31 Dec 14:22 1483194168.zip

# explore the archive:
$ unzip 1483194168.zip && cat 1483194168/.burrymeta | jq .
{
  "snapshot-date": "2016-12-31T14:22:48Z",
  "svc": "etcd",
  "svc-endpoint": "etcd.mesos:1026",
  "target": "local",
  "target-endpoint": "/tmp"
}

See the development and testing notes for the test setup.

Back up DC/OS system ZooKeeper to Amazon S3

To back up the content of the DC/OS system ZooKeeper (supervised by Exhibitor), do the following:

# let's first do a dry run:
$ ./burry --endpoint leader.mesos:2181
INFO[0000] My config: {InfraService:zk Endpoint:leader.mesos:2181 StorageTarget:tty Creds:{StorageTargetEndpoint: Params:[]}}  func=init
INFO[0006] Operation successfully completed.             func=main

# back up into Amazon S3:
$ ./burry --endpoint leader.mesos:2181 --target s3 --credentials s3.amazonaws.com,ACCESS_KEY_ID=***,SECRET_ACCESS_KEY=***
INFO[0000] My config: {InfraService:zk Endpoint:leader.mesos:2181 StorageTarget:s3 Creds:{InfraServiceEndpoint:s3.amazonaws.com Params:[{Key:ACCESS_KEY_ID Value:***} {Key:SECRET_ACCESS_KEY Value:***}]}}}  func=init
INFO[0008] Successfully stored zk-backup-1483166506/latest.zip (45464 Bytes) in S3 compatible remote storage s3.amazonaws.com  func=remoteS3
INFO[0008] Operation successfully completed. The snapshot ID is: 1483166506  func=main

See the development and testing notes for the test setup. Note: in order to back up to Google Storage rather than to Amazon S3, use --credentials storage.googleapis.com,ACCESS_KEY_ID=***,SECRET_ACCESS_KEY=*** in above command. Make sure that you have Google Storage as your default project and Interoperability enabled; see also settings in console.cloud.google.com/storage/settings.

Back up etcd to Minio

To back up the content of an etcd running in a (DC/OS) cluster to Minio, do:

$ ./burry --endpoint etcd.mesos:1026 --isvc etcd --credentials play.minio.io:9000,ACCESS_KEY_ID=Q3AM3UQ867SPQQA43P2F,SECRET_ACCESS_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG --target s3
INFO[0000] My config: {InfraService:etcd Endpoint:etcd.mesos:1026 StorageTarget:s3 Credentials:}  func=init
INFO[0001] Successfully stored etcd-backup-1483173687/latest.zip (674 Bytes) in S3 compatible remote storage play.minio.io:9000  func=remoteS3
INFO[0001] Operation successfully completed. The snapshot ID is: 1483173687  func=main

See the development and testing notes for the test setup. Note: the credentials used above are from the public Minio playground.

Restores

For restores you MUST set --operation restore (or: -o restore) as well as provide a snapshot ID with --snapshot/-s. Note also that you CAN NOT restore from screen, that is, --target/-t tty is an invalid choice:

$ burry --operation restore --target local|s3 --snapshot sID (--isvc etcd|zk) (--credentials STORAGE_TARGET_ENDPOINT,KEY1=VAL1,...,KEYn=VALn)

Restore etcd from local storage

In the following, we first create a local backup of an etcd cluster, then simulate failure by deleting a key and then restore it:

# let's first back up etcd:
$ ./burry -e etcd.mesos:1026 -i etcd -t local -b
INFO[0000] Selected operation: BACKUP                    func=init
INFO[0000] My config: {InfraService:etcd Endpoint:10.0.1.139:1026 StorageTarget:local Creds:{StorageTargetEndpoint: Params:[]}}  func=init
INFO[0000] Operation successfully completed. The snapshot ID is: 1483383204  func=main

# now, let's destroy a key:
$ curl etcd.mesos:1026/v2/keys/foo -XDELETE
{"action":"delete","node":{"key":"/foo","modifiedIndex":16,"createdIndex":15},"prevNode":{"key":"/foo","value":"bar","modifiedIndex":15,"createdIndex":15}}

# restore it from the local backup:
$ ./burry -o restore -e etcd.mesos:1026 -i etcd -t local -s 1483383204
INFO[0000] Using burryfest /tmp/.burryfest  func=init
INFO[0000] Selected operation: RESTORE                   func=init
INFO[0000] My config: {InfraService:etcd Endpoint:10.0.1.139:1026 StorageTarget:local Creds:{StorageTargetEndpoint: Params:[]}}  func=init
INFO[0000] Restored /foo                                 func=visitETCDReverse
INFO[0000] Operation successfully completed. Restored 1 items from snapshot 1483383204  func=main

# ... and we're back to normal:
$ curl 10.0.1.139:1026/v2/keys/foo
{"action":"get","node":{"key":"/foo","value":"bar","modifiedIndex":17,"createdIndex":17}}

See the development and testing notes for the test setup.

Restore Consul from Minio

In the following, we first create a backup of an Consul K/V store in Minio, then simulate failure by deleting a key and then restore it:

# let's first back up the Consul K/V store to Minio:
$ ./burry -e jump:8500 -i consul -t s3 -c play.minio.io:9000,ACCESS_KEY_ID=Q3AM3UQ867SPQQA43P2F,SECRET_ACCESS_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG
INFO[0000] Selected operation: BACKUP                    func=main
INFO[0000] My config: {InfraService:consul Endpoint:jump:8500 StorageTarget:s3 Creds:{StorageTargetEndpoint:play.minio.io:9000 Params:[{Key:ACCESS_KEY_ID Value:Q3AM3UQ867SPQQA43P2F} {Key:SECRET_ACCESS_KEY Value:zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG}]}}  func=main
INFO[0000] Operation successfully completed. The snapshot ID is: 1483448835  func=main

# now, let's destroy a key
$ curl jump:8500/v1/kv/foo -XDELETE

# restore it from the local backup:
$ ./burry-o restore -e jump:8500 -i consul -t s3 -s 1483448835 -c play.minio.io:9000,ACCESS_KEY_ID=Q3AM3UQ867SPQQA43P2F,SECRET_ACCESS_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG
INFO[0000] Selected operation: RESTORE                   func=main
INFO[0000] My config: {InfraService:consul Endpoint:jump:8500 StorageTarget:s3 Creds:{StorageTargetEndpoint:play.minio.io:9000 Params:[{Key:ACCESS_KEY_ID Value:Q3AM3UQ867SPQQA43P2F} {Key:SECRET_ACCESS_KEY Value:zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG}]}}  func=main
INFO[0000] Restored foo                                  func=visitCONSULReverse
INFO[0000] Restored hi                                   func=visitCONSULReverse
INFO[0000] Operation successfully completed. Restored 2 items from snapshot 1483448835  func=main

# ... and we're back to normal:
$ curl jump:8500/v1/kv/foo?raw
bar

See the development and testing notes for the test setup. Note: the credentials used above are from the public Minio playground.

Release history

  • v0.4.0: support for backing up to and restoring from Google Storage
  • v0.3.0: support for backing up and restoring Consul from local storage and S3/Minio
  • v0.2.0: support for restoring ZK and etcd from local storage and S3/Minio
  • v0.1.0: support for backing up ZK and etcd to screen, local storage and S3/Minio

More Repositories

1

cinf

Command line tool to view namespaces and cgroups, useful for low-level container prodding
Go
455
star
2

dnpipes

Distributed Named Pipes
Go
452
star
3

lambda-architecture.net

A repository of information, examples and good practices around the Lambda Architecture
CSS
369
star
4

kboom

The Kubernetes scale & soak load tester
Go
301
star
5

reshifter

Kubernetes cluster state management
CSS
295
star
6

mkdocs-deploy-gh-pages

GitHub Action to deploy an MkDocs site to GitHub Pages
Shell
233
star
7

rbac.dev

A collection of good practices and tools for Kubernetes RBAC
223
star
8

schema-org-rdf

Schema.org in RDF
HTML
185
star
9

k8s-sec

Kubernetes Security: from Image Hygiene to Network Policies
145
star
10

cidrchk

CLI tool for CIDR range operations (check, generate)
Go
133
star
11

kubed-sh

A cloud native Kubernetes cluster shell for the casual user
Go
97
star
12

krs

A command line tool for capturing and serializing Kubernetes resource statistics in OpenMetrics format
Go
95
star
13

kube-rpi

Kubernetes on Raspberry Pi 4 with 64-bit OS
82
star
14

the-container-security-book

The Container Security Book—a free book for practitioners
82
star
15

modern-linux.info

Learning Modern Linux book website
Shell
80
star
16

cn-ref

A collection of tools and references around container networking
78
star
17

rbIAM

A unified IAM+Kubernetes RBAC access control exploration tool
Go
75
star
18

5stardata.info

Information around TimBL's 5 star Open Data plan
HTML
70
star
19

eksphemeral

A simple Amazon EKS manager for ephemeral clusters
Go
66
star
20

stateful-kubernetes

All Thingz Stateful Apps & Tooling in Kubernetes
HTML
66
star
21

kn

A collection of shell functions for Kubernetes native dabbling
Shell
50
star
22

right-size-guide

A CLI tool providing memory & CPU recommendations for containerized apps
Go
48
star
23

l2i

The Lambda Layer Inspector (L2I)
Go
43
star
24

rbacadabra

A collection of RBAC recipes and tips & tricks
42
star
25

zdd-lab

DC/OS Zero Downtime Deployments Lab
Shell
39
star
26

simpleservice

A simple service for testing container orchestration setups
Python
35
star
27

yages

Yet another gRPC echo server (YAGES)
Go
34
star
28

troubleshooting-k8s-apps

Troubleshooting Kubernetes Applications
HTML
33
star
29

kubectl-in-action

Tips and Tricks around using kubectl to manage your Kubernetes cluster
29
star
30

usn-app

UberSocialNet—applying the Lambda Architecture
Python
29
star
31

o11y-in-action.cloud

Cloud Observability in Action
Go
26
star
32

web.instata

Turn your POTD into Web data
Python
26
star
33

canihaznonprivilegedcontainers.info

Advocacy site for the uptake of using non-privileged containers
24
star
34

omnidator

Translates Schema.org annotated data formats (microdata, CSV, etc.) into other data formats (JSON, RDF, etc.)
Python
24
star
35

mehdb

Educational Kubernetes-native NoSQL datastore using StatefulSet and persistent volumes
Go
23
star
36

k8s-autoscale

Kubernetes Autoscaling Experiments
JavaScript
23
star
37

turtled

A simple online RDF Turtle editor
JavaScript
22
star
38

nase

A PoC for native Kubernetes secrets support via AWS Secrets Manager
Go
21
star
39

hadoop-data-ingestion

Renders options for ingesting data into Hadoop
21
star
40

operator-101

A step-by-step walkthrough of bootstrapping a Kubernetes operator
19
star
41

mkdocs-template

A template for MkDocs publishing via GitHub Action
19
star
42

mrlin

mrlin is 'MapReduce processing of Linked Data' … because it's magic
Python
17
star
43

gitops101

GitOps 101
16
star
44

m-shop

Marathon/Docker deployment of a Web application incl. analytics using the ELK stack
JavaScript
15
star
45

ld-in-couch

Enables you to store, process and query Linked Data in Apache CouchDB.
Python
15
star
46

s3-echoer

Reads input from stdin and uploads it to an existing S3 bucket
Go
14
star
47

kruiser

A proxy that transparently exposes gRPC Kubernetes services cluster-externally
Go
14
star
48

imgn

From monolith to containerized microservices to serverless
Go
14
star
49

otel-adoption-survey-2022

OpenTelemetry Adoption Survey 2022
14
star
50

arn.services

Utility service for Amazon Resource Names (ARNs)
Go
13
star
51

tride

turning tabular data into entities
Python
13
star
52

apache-drill-frontend

A front-end for Apache Drill
JavaScript
13
star
53

aws-tmux

AWS status for tmux
Shell
13
star
54

apache-drill-sandbox

A collection of experiments and recipes around Apache Drill
12
star
55

fosdem2018-godevroom-networkingdeepdive

FOSDEM 2018 Go devroom, Networking deepdive—From net.Dial to gRPC
Go
12
star
56

http-range-14-burner

A collection of http-range-14 facts to produce an infographic about resources spent over the past 10y
11
star
57

go4systasks

Using the Go programming language for system tasks
Go
11
star
58

aws-container-security-survey-2020

AWS container security survey 2020
11
star
59

awsometag

A tool to tag AWS resources in a unified manner
Go
11
star
60

aws-container-security-survey-2019

Questions and results of the AWS container security survey 2019
11
star
61

boring-is-cool

Advocacy site for boring technology
HTML
10
star
62

mc

A Simple Mesos-DNS Client
Python
10
star
63

temporal-opa

Temporal reasoning with OPA
Open Policy Agent
10
star
64

using-client-go

A versioned collection of snippets showing how to use client-go
Go
10
star
65

Racoon

Rapid-appraisal crawler for original open data nuggets
Python
9
star
66

apache-big-data-cheat-sheet

A cheat sheet for Big Data technologies at and from The Apache Software Foundation
9
star
67

kubecuddler

A simple Go package wrapping kubectl invocations
Go
8
star
68

madr

Linked Open Data Mobile AugmenteD Reality
Python
8
star
69

go4ops

Go for ops
Go
8
star
70

marvin

A demonstrator for a nanoservices-based application on DC/OS
JavaScript
8
star
71

addrable

Addressable tabular data on the Web
JavaScript
7
star
72

dromedar

Apache Drill On Apache Mesos
Python
7
star
73

ref.otel.help

Collection of OpenTelemetry good practices, tutorials, docs
Python
7
star
74

odc2011

Local Planning Explorer Ireland
PHP
7
star
75

school-explorer

Presents information about schools to help parents to decide where to send their kids to
PHP
7
star
76

RDF2x

A collection of converters from RDF to data formats
6
star
77

openshift-cheat-sheet

Cheat sheet for OpenShift
6
star
78

dependentjobs

DependentJobs for Kubernetes
Go
6
star
79

influxdb-dweet.io

Experiment to ingest data from dweet.io into InfluxDB
Python
6
star
80

fallacies-of-distributed-gomputing

The Fallacies Of Distributed Gomputing—talk at GopherCon 2017
Go
6
star
81

container-networking

Container Networking
5
star
82

ld-profiler

Dirt-simple Linked Data access profiler
Python
5
star
83

sparqlbin.com

A generic SPARQL processor and sharing tool.
Python
5
star
84

letsgo

Let's Go! is a hands-on introduction into the Go programming language
Go
5
star
85

clump

A cluster dump tool
Go
5
star
86

bigdatainthecloud.info

The Q&A site for devops, developers and analysts that deal with Big Data processing in cloud computing environments.
5
star
87

shodan

An event-sourcing-based RDF datastore and processor
Python
4
star
88

aws-cli-fu

Collection of my favorite AWS CLI calls
4
star
89

2018-state-of-faas-on-kube

KubeCon Europe 2018—Lightning Talk: The State Of FaaS on Kubernetes
4
star
90

qrcan

Query Resolver & Comprehensive Archive Network
JavaScript
4
star
91

kaput

Kubernetes Attack and Policy Underminer Tool
Go
4
star
92

hdt-online

A simple HDT converter online service
JavaScript
4
star
93

cloudnaive.online

All things infosec concerning *nix, containers, Kubernetes, and serverless computing
4
star
94

funcnstein

a multi-platform tool for managing functions
3
star
95

sdx

Seamless Developer Experience
Go
3
star
96

util-containers

A collection of utility container images
3
star
97

github-api-fetcher

Fetches data from the public GitHub API and ingests it into various sinks
Go
3
star
98

containerz.info

Advocacy website around Linux containers
HTML
3
star
99

noteless

A e2e demo of serverless technologies
Go
3
star
100

rdfxml.info

An advocacy site to inform people about the drawbacks of RDF/XML
3
star