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:

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:

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

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

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

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:

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

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

<br />
16:12:56.257 [error] Supervisor riak_api_sup had child riak_api_pb_listener started with riak_api_pb_listener:start_link(&quot;;, 8081) at undefined exit with reason bad return value: {error,eaddrinuse} in context start_error<br />

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:

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

<br />
~/riak-1.2.1/dev $ dev2/bin/riak-admin cluster join dev1@<br />
Node is not running!<br />
~/riak-1.2.1/dev $ dev2/bin/riak-admin cluster join plan<br />
Node is not running!<br />
~/riak-1.2.1/dev $ dev2/bin/riak chkconfig<br />
config is OK<br />
~/riak-1.2.1/dev $ dev2/bin/riak ping</p>
<p>=ERROR REPORT==== 18-Feb-2013::10:28:01 ===<br />
Error when reading /Users/drevel/.erlang.cookie: eaccesescript: exception error: no match of right hand side value<br />
                 {error,<br />
                     {shutdown,<br />
                         {child,undefined,net_sup_dynamic,<br />
                             {erl_distribution,start_link,<br />
                                 [['dev2_maint_39472@',longnames]]},<br />
                             permanent,1000,supervisor,<br />
                             [erl_distribution]}}}<br />

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.