Skip to content

Instantly share code, notes, and snippets.

@jakexks
Created September 15, 2015 17:02
Show Gist options
  • Select an option

  • Save jakexks/ae83e49e0d089dfe2348 to your computer and use it in GitHub Desktop.

Select an option

Save jakexks/ae83e49e0d089dfe2348 to your computer and use it in GitHub Desktop.
Dump etcd
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