Installing Riak 1.2.1 on Mac OS/X 10.7

Update: For Riak 1.3 this may be a better solution than what I describe below: https://github.com/simonvc/riak-dev-cluster

I’ve been hearing a lot about Riak recently. When the Portland Basho team scheduled some co-working office hours I took the opportunity to get Riak installed and to talk to some experts.

Riak’s web site and documentation are well organized and very helpful.

I already had the proper version of Erlang (R15B01) installed, so I skipped straight to installing from a binary tarball which looked like the easiest and least intrusive option.

But when I tried to run Riak after unpacking the tarball I got an error:

~/riak-1.2.1 $ bin/riak start
Error reading /Users/drevel/Code/riak-1.2.1/tarball/riak-1.2.1/etc/app.config

After some googling and poking around I decided to try installing from source instead. That went better:

~/riak-1.2.1/rel/riak $ bin/riak start
~/riak-1.2.1/rel/riak $ bin/riak ping
pong
~/riak-1.2.1/rel/riak $ bin/riak stop
ok

But, what’s the point of running a single Riak node? Not much, fortunately the source build provides a devrel target to help set up a cluster on localhost.

Following the instructions got me to this:

~/riak-1.2.1/dev $ dev1/bin/riak start
Riak failed to start within 15 seconds,
see the output of 'riak console' for more information.
If you want to wait longer, set the environment variable
WAIT_FOR_ERLANG to the number of seconds to wait.

Hmm… Trying again using console instead of start I got a lot of output, but the important piece was:

16:12:56.257 [error] Supervisor riak_api_sup had child riak_api_pb_listener started with riak_api_pb_listener:start_link("127.0.0.1", 8081) at undefined exit with reason bad return value: {error,eaddrinuse} in context start_error

Turns out McAfee antivirus is using port 8081 on my laptop.

So, I wrote a script to change the ports used by the dev release:

change_riak_ports.sh

After changing the port numbers I was able to start the four riak instances, but I couldn’t join them as a cluster:

~/riak-1.2.1/dev $ dev2/bin/riak-admin cluster join dev1@127.0.0.1
Node is not running!
~/riak-1.2.1/dev $ dev2/bin/riak-admin cluster join plan
Node is not running!
~/riak-1.2.1/dev $ dev2/bin/riak chkconfig
config is OK
~/riak-1.2.1/dev $ dev2/bin/riak ping

=ERROR REPORT==== 18-Feb-2013::10:28:01 ===
Error when reading /Users/drevel/.erlang.cookie: eaccesescript: exception error: no match of right hand side value 
                 {error,
                     {shutdown,
                         {child,undefined,net_sup_dynamic,
                             {erl_distribution,start_link,
                                 [['dev2_maint_39472@127.0.0.1',longnames]]},
                             permanent,1000,supervisor,
                             [erl_distribution]}}}

Aha! I needed to delete ~/erlang.cookie and restart my instances.

Now I have my local riak cluster up and running on my laptop 🙂

Comments are closed.