Created
September 15, 2015 17:02
-
-
Save jakexks/ae83e49e0d089dfe2348 to your computer and use it in GitHub Desktop.
Dump etcd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "github.com/coreos/etcd/client" | |
| "github.com/kr/pretty" | |
| "golang.org/x/net/context" | |
| ) | |
| func main() { | |
| println("Connecting to etcd") | |
| cfg := client.Config{ | |
| Endpoints: []string{"http://etcd.ext.production.k8.aax.livew.io:4001"}, | |
| } | |
| c, err := client.New(cfg) | |
| if err != nil { | |
| panic(err) | |
| } | |
| kapi := client.NewKeysAPI(c) | |
| resp, err := kapi.Get(context.Background(), "/client", &client.GetOptions{ | |
| Recursive: true, | |
| Sort: false, | |
| Quorum: false, | |
| }) | |
| if err != nil { | |
| println(err.Error()) | |
| } else { | |
| fmt.Printf("%# v\n", pretty.Formatter(resp)) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment