Building a Riak development environment, like anything involving Linux, is needlessly complicated for no good reason. This method to build from source worked for me from a clean install of Lubuntu 17.10.1:
First, update your package index and install the dependencies and utilities you will need:
$ sudo apt-get update $ sudo apt-get install build-essential autoconf libncurses5-dev libpam0g-dev openssl libssl-dev fop xsltproc unixodbc-dev git curl
Next, navigate to user home, download kerl and use it to build and install the Basho version of Erlang (WHY?!?!). These steps took a while to complete on my machine, bear with it:
$ cd ~ $ curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl $ chmod a+x kerl $ ./kerl build git git://github.com/basho/otp.git OTP_R16B02_basho10 R16B02-basho10 $ ./kerl install R16B02-basho10 ~/erlang/R16B02-basho10 $ . ~/erlang/R16B02-basho10/activate
With Erlang installed, clone the Riak source repository from GitHub and build:
$ git clone https://github.com/basho/riak.git $ cd riak $ make rel
Finally, create 8 separate copies of Riak to use in a cluster:
$ make devrel
Start 3 (or more) Riak instances:
$ dev/dev1/bin/riak start $ dev/dev2/bin/riak start $ dev/dev3/bin/riak start
Then join instances 2 and 3 with instance 1 to form a cluster:
$ dev/dev2/bin/riak-admin cluster join dev1@127.0.0.1 $ dev/dev3/bin/riak-admin cluster join dev1@127.0.0.1
Check and commit the cluster plan:
$ dev/dev3/bin/riak-admin cluster plan $ dev/dev3/bin/riak-admin cluster commit
Monitor the cluster status until all pending changes are complete:
$ dev/dev3/bin/riak-admin cluster status ---- Cluster Status ---- Ring ready: false +--------------------+------+-------+-----+-------+ | node |status| avail |ring |pending| +--------------------+------+-------+-----+-------+ | (C) dev1@127.0.0.1 |valid | up |100.0| 34.4 | | dev2@127.0.0.1 |valid | up | 0.0| 32.8 | | dev3@127.0.0.1 |valid | up | 0.0| 32.8 | +--------------------+------+-------+-----+-------+ $ dev/dev3/bin/riak-admin cluster status ---- Cluster Status ---- Ring ready: true +--------------------+------+-------+-----+-------+ | node |status| avail |ring |pending| +--------------------+------+-------+-----+-------+ | (C) dev1@127.0.0.1 |valid | up | 34.4| -- | | dev2@127.0.0.1 |valid | up | 32.8| -- | | dev3@127.0.0.1 |valid | up | 32.8| -- | +--------------------+------+-------+-----+-------+
Check the cluster member status:
$ dev/dev3/bin/riak-admin member-status ================================= Membership ================================== Status Ring Pending Node ------------------------------------------------------------------------------- valid 34.4% -- 'dev1@127.0.0.1' valid 32.8% -- 'dev2@127.0.0.1' valid 32.8% -- 'dev3@127.0.0.1' ------------------------------------------------------------------------------- Valid:3 / Leaving:0 / Exiting:0 / Joining:0 / Down:0
Congratulations, you have a development Riak cluster. Test the cluster by writing some data to a node:
$ curl -XPUT http://127.0.0.1:10018/riak/test/helloworld -H "Content-type: application/json" --data-binary "Hello World!"
Use a browser to read the data from each node:
http://127.0.0.1:10018/riak/test/helloworld
http://127.0.0.1:10028/riak/test/helloworld
http://127.0.0.1:10038/riak/test/helloworld