restore

package
v0.3.22-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package restore contains restore operations against etcd.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Restore

func Restore(endpoint, backupid, target, remote, bucket string) (int, time.Duration, error)

Restore takes a backup ID and unpacks it into the target directory. It then walk the target directory in the local filesystem and populates an etcd server at endpoint with the content of the sub-directories. On success it returns the number of keys restored as well as the time it took to restore them.

Example

Shows how to restore a Kubernetes cluster by specifying the underlying etcd. It assumes that the etcd process is servering on 127.0.0.1:2379. Takes the backup from Minio play, a public S3-compatible storage sandbox.

// define the URL etcd is available at:
etcdurl := "http://127.0.0.1:2379"

// using Minio play, a public S3-compatible sandbox
// for the remote storage available at https://play.minio.io:9000
// and the following credentials which need to be exposed
// as environment variables to the ReShifter process:
_ = os.Setenv("ACCESS_KEY_ID", "Q3AM3UQ867SPQQA43P2F")
_ = os.Setenv("SECRET_ACCESS_KEY", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG")

// carry out the restore into etcd underlying the Kubernetes cluster
// and handle errors as they occur:
keysrestored, restoretime, err := Restore(etcdurl, "1498847078", "/tmp", "play.minio.io:9000", "2017-07-some-bucket")
if err != nil {
	log.Fatal(err)
	return
}
fmt.Printf("The restore completed successfully. Restored %d keys in %d seconds.\n", keysrestored, restoretime)
Output:

The restore completed successfully. Restored 1042 keys.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL