Snippets for yer computer needs

Key-Value storage


Get stats

 curl -H "Accept: text/plain"

Riak pool maintenance

# Add the node to the cluster
riak-admin cluster join ${NODE}

# Create a plan to see how the new ring will be laid out
riak-admin cluster plan

# Commit the plan
riak-admin cluster commit

# Remove a node from the cluster
riak-admin cluster leave ${NODE}

Restarting a node

riak-admin transfers # ensure cluster is in good state
riak-admin member-status # get status of all cluster members


desc port
epmd listener TCP:4369
handoff_port listener TCP:8099
internode communication TCP:6000-7999
protocol buffers TCP:8087

Get a list of keys

Note - this is an undocumented interface in the C memcached server

# get slab info
stats items
# get dump of slab
stats cachedump SLAB LIMIT

Using ASCII protocol through telnet

telnet host 11211

command | description — | — stats | gets buncha stats set [noreply]\r | set a value get - returns: VALUE []\r\r | |

*: is the number of bytes in the data block to follow, *not* including the delimiting \r may be zero (in which case it's followed by an empty data block). | |

Using Dalli

require 'dalli'
dc ='localhost:11211')
dc.set('foo', 'bar')