-
Notifications
You must be signed in to change notification settings - Fork 35
Home
Ranjib Dey edited this page Jan 14, 2014
·
6 revisions
etcd-ruby is a ruby client for etcd.
etcd is partition tolerant, highly available key value store. Few key features of etcd:
- provides
test and set
like operations, which can be used to build distributed locks - client can watch, and receive notifications for changes in certain keys
- exposes a file system like api
For installing and running etcd use the core etcd [documentation] (https://github.com/coreos/etcd)
- instantiate an etcd client object
client = Etcd.client
this will create an etcd client using localhost and port 4001, for specifying them explicitly
client = Etcd.client(host: '127.0.0.1', port: 4001)
- create a key named
the_doors
with valuehyacinth house
client.create('/the_doors', value: 'hyacinth house')
note usage of /
as prefix, etcd uses /
to represent nesting, like file system
- retrieve the value of a key named
/the_doors
client.get('/the_doors').value
Etcd::Client#get
method returns a node
object. which holds value and other metadata
- update the value of an existing key
client.update('/the_doors', value: 'people are strange')
- deleting a key
client.delete('/the_doors')
Awesome, now that you know basic usage of etcd
you can go through the main etcd
docs for details and use the additional wiki pages to explore how etcd-ruby
exposes them as api.
Please feel free to drop any feedback you have.
- ranjib at linux dot com