Using Riak 2.x on Mac OS X with 7DBin7Weeks

I've been trying to work through Seven Databases in Seven Weeks, and have run into problems a couple of times installing Riak and given up. I finally got through it. One issue is that the book uses Riak 1.x, whereas Riak 2.x is the current version. Also, the default ports and commands have changed a bit, so the commands in the book don't work.

The key part to getting Riak running is to install the correct version of both Erlang and Riak, both from source.

Installing Riak requires the custom Erlang from Basho. Don't install Erlang using OS X's brew (you can only get version 17) or from the standard Erlang bistro (you get R16A). You must install R16B02 from Basho per the instructions at here. I added '–prefix=/usr/local/otp_R16B02' to the 'configure' command, and then after installing added it to my path with 'export PATH=$PATH:/usr/local/otp_R16B02/bin' in .bash_profile.

If you try to use Erlang R17 installed by brew, you get a version mismatch error when trying to build Riak (17 instead of R16B). Manually changing this will not work either, because Riak actually uses some custom flags not available in the standard Erlang tooling.

If you try to use the standard Erlang R16A package, you will get an error on the console like:

xxx:riak-2.0.4 phil.varner$ dev/dev1/bin/riak start
!!!!
!!!! WARNING: ulimit -n is 32768; 65536 is the recommended minimum.
!!!!
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.

and then from riak console

LT-A10-122189:riak-2.0.4 phil.varner$ dev/dev1/bin/riak console
config is OK
-config /Users/phil.varner/Downloads/riak-2.0.4/dev/dev1/data/generated.configs/app.2015.02.20.23.56.47.config -args_file /Users/phil.varner/Downloads/riak-2.0.4/dev/dev1/data/generated.configs/vm.2015.02.20.23.56.47.args -vm_args /Users/phil.varner/Downloads/riak-2.0.4/dev/dev1/data/generated.configs/vm.2015.02.20.23.56.47.args
!!!!
!!!! WARNING: ulimit -n is 32768; 65536 is the recommended minimum.
!!!!
Exec:  /Users/phil.varner/Downloads/riak-2.0.4/dev/dev1/bin/../erts-5.10/bin/erlexec -boot /Users/phil.varner/Downloads/riak-2.0.4/dev/dev1/bin/../releases/2.0.4/riak               -config /Users/phil.varner/Downloads/riak-2.0.4/dev/dev1/data/generated.configs/app.2015.02.20.23.56.47.config -args_file /Users/phil.varner/Downloads/riak-2.0.4/dev/dev1/data/generated.configs/vm.2015.02.20.23.56.47.args -vm_args /Users/phil.varner/Downloads/riak-2.0.4/dev/dev1/data/generated.configs/vm.2015.02.20.23.56.47.args              -pa /Users/phil.varner/Downloads/riak-2.0.4/dev/dev1/bin/../lib/basho-patches -- console
Root: /Users/phil.varner/Downloads/riak-2.0.4/dev/dev1/bin/..
bad scheduling option -sfwi
Usage: beam.smp [flags]...

The error "bad scheduling option -sfwi" is because it's trying to use the custom flags in Basho's Erlang, which obviously don't exist in the standard Erlang tools.

After installing the Basho Erlang, install Riak from here and follow the instructions

You'll probably need to change your ulimit settings also, for which there are excellent instructions here

There are quite a few changes in Riak 2.x from Riak 1.x used in the book. The Basho Riak Five-Minute Install has good examples of the new syntax.

The riak-admin command has changed since 7DBin7Weeks p2.0 was published, so the 'join' command is now like 'dev/dev2/bin/riak-admin cluster join dev1@127.0.0.1', and it only stages joins, without actually affecting them. You can see the staged changes with 'dev/dev1/bin/riak-admin cluster plan' and affect them with 'dev/dev2/bin/riak-admin cluster commit'.

The default port for the HTTP interface is now 10018 instead of 8091, so all of the URLs are now like 'http://localhost:10018/stats'.

I also ran into an issue where curl couldn't connect to the Riak port 10018 using "localhost", but directly as 127.0.0.1 worked fine.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">