Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

etcd v2 API demo

For simplicity, we use as etcd server, please make sure etcd is running and listening at the right ip and port.


Before start, please install etcd client library:

go get

Then, just run:

go run main.go



  • set a simple key
  • get value of a simple key
  • delete a simple key
  • list a directory values
  • set ttl to key
  • atomic change: CAS(compare and set)
  • watch changes

Not included(but easy to implement):

  • create a directory
  • delete a directory
  • update ttl of a key/dir
  • compare and delete