Skip to content

Instantly share code, notes, and snippets.

@mingder78
Created July 19, 2014 04:03
Show Gist options
  • Save mingder78/7404ab2b06635fe11ffd to your computer and use it in GitHub Desktop.
Save mingder78/7404ab2b06635fe11ffd to your computer and use it in GitHub Desktop.
etcd a lightweight
# start the deamon
sh-3.2$ ./bin/etcd
[etcd] Jul 19 12:01:21.172 WARNING | Using the directory ming-desktop.etcd as the etcd curation directory because a directory was not specified.
[etcd] Jul 19 12:01:21.548 INFO | Peer URLs in log: / ming-desktop (http://127.0.0.1:7001)
[etcd] Jul 19 12:01:21.550 INFO | etcd server [name ming-desktop, listen on :4001, advertised url http://127.0.0.1:4001]
[etcd] Jul 19 12:01:21.550 INFO | peer server [name ming-desktop, listen on :7001, advertised url http://127.0.0.1:7001]
[etcd] Jul 19 12:01:21.550 INFO | ming-desktop starting in peer mode
[etcd] Jul 19 12:01:21.550 INFO | ming-desktop: state changed from 'initialized' to 'follower'.
[etcd] Jul 19 12:01:21.932 INFO | ming-desktop: state changed from 'follower' to 'candidate'.
[etcd] Jul 19 12:01:21.932 INFO | ming-desktop: state changed from 'candidate' to 'leader'.
[etcd] Jul 19 12:01:21.932 INFO | ming-desktop: leader changed from '' to 'ming-desktop'.
[etcd] Jul 19 12:01:24.555 INFO | ming-desktop: snapshot of 133981 events at index 133981 completed
# test with it
10012 curl -L http://127.0.0.1:4001/v2/keys/mykey -XPUT -d value="this is awesome"
10013 curl -L http://127.0.0.1:4001/v2/keys/mykey
10014 curl -L http://127.0.0.1:4001/v2/keys/myke2
10015 curl -L http://127.0.0.1:4001/v2/keys/message -XPUT -d value="Hello world"
10016 curl -L http://127.0.0.1:4001/v2/keys/message
10017 curl -L http://127.0.0.1:4001/v2/keys/message -XPUT -d value="Hello etcd"
10018 curl -L http://127.0.0.1:4001/v2/keys/message -XDELETE
10019 curl -L http://127.0.0.1:4001/v2/keys/foo -XPUT -d value=bar -d ttl=5
10020 curl -L http://127.0.0.1:4001/v2/keys/foo -XPUT -d value=bar -d ttl= -d prevExist=true
10023 curl -L http://127.0.0.1:4001/v2/keys/foo\?wait\=true
10024 curl -L http://127.0.0.1:4001/v2/keys/foo -XPUT -d value=bar
10025 curl -L 'http://127.0.0.1:4001/v2/keys/foo?wait=true&waitIndex=7'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment