cliak is a minimal Command Line Interface (CLI) written in Node for performing CRUD operations on a Riak distributed database instance.
:::shell
$ npm install cliak
You will need to make the script executable in order to run it:
:::shell
$ chmod a+x node_modules/cliak/bin/cliak
:::shell
$ cliak --help
:::shell
$ cliak -h 127.0.0.1 -p 8098 -P http
cliak invoked without any option will use the following default values to connect to the riak instance:
:::javascript
{
host: '127.0.0.1',
port: 8098,
protocol: 'http'
}
You can use cliak to perform the following operations:
Find out if a given object exists in the riak instance.
:::shell
> exists avengers black_widow
Retrieve object data from the riak instance.
:::shell
> get avengers black_widow
Persist/update an object in the riak instance.
:::shell
> save avengers iron_man "{name:'tony starks', power: 'super armor'}"
Note that the object/value to persist must be between double-quotes.
Delete an object from the riak instance.
:::shell
> delete avengers iron_man
You can display the entire content of a bucket like this:
:::shell
> all avengers
However keep in mind the following from Basho:
This operation requires traversing all keys stored in the cluster and should not be used in production.
This means that cliak's performance on executing all
will be less than desirable if you have a large number of keys in the store.
:::shell
> exit