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:

<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;127.0.0.1&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:

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:

<br />
~/riak-1.2.1/dev $ dev2/bin/riak-admin cluster join dev1@127.0.0.1<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@127.0.0.1',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 ๐Ÿ™‚

Posted in Uncategorized | Comments Off on Installing Riak 1.2.1 on Mac OS/X 10.7

Installing Redis 2.4.5 on Ubuntu 10.04 LTS

Redis is an open-source key value store. I visited the interactive tutorial and was intrigued by the features it offers.

Here’s how I installed a local copy for further investigation:

<br />
# download and unpack the sources (see http://redis.io/download for the latest stable version)<br />
wget http://redis.googlecode.com/files/redis-2.4.5.tar.gz<br />
tar -zxvf redis-2.4.5.tar.gz</p>
<p># build<br />
cd redis-2.4.5/<br />
make</p>
<p># test<br />
# I needed to install tcl8.5 to run the tests: sudo apt-get install tcl8.5<br />
make test</p>
<p>#install<br />
sudo make install<br />
cd utils<br />
sudo ./install_server.sh</p>
<p># run the redis cli (/usr/local/bin/redis-cli)<br />
redis-cli<br />

Posted in Uncategorized | Comments Off on Installing Redis 2.4.5 on Ubuntu 10.04 LTS

Enabling SSL for Couchdb v1.1

Having installed Couchdb v1.1 I wanted to take advantage of its native support for SSL. I found instructions at couchbase.org and on wiki.apache.org which got me through editing etc/couchdb/local.ini. Uncomment and edit lines in the [daemons] and [ssl] sections to look something like this:

<br />
[daemons]<br />
; enable SSL support by uncommenting the following line and supply the PEM's below.<br />
; the default ssl port CouchDB listens on is 6984<br />
httpsd = {couch_httpd, start_link, [https]}</p>
<p>[ssl]<br />
cert_file = /var/lib/couchdb/build-couchdb/build/etc/ssl/couch_cert.pem<br />
key_file = /var/lib/couchdb/build-couchdb/build/etc/ssl/couch_key.pem<br />

The most difficult part proved to be generating the required private key and self-signed certificate. couchbase.org has instructions, but they didn’t work for me. I followed openssl’s keys.txt to generate a non-password-protected private key, and certificates.txt to create a test certificate self-signed using the private key.

<br />
openssl genrsa -out couch_key.pem 4096<br />
openssl req -new -x509 -key couch_key.pem -out couch_cert.pem -days 1095<br />

Restart couchdb and test with curl:

<br />
sudo /etc/init.d/couchdb-1.1.0 restart<br />
curl -k https://atom:6984/<br />
# expect: {&quot;couchdb&quot;:&quot;Welcome&quot;,&quot;version&quot;:&quot;1.1.0&quot;}<br />

The troubleshooting tips on wiki.apache.org were helpful, in particular the suggestion to test using a known good private key and certificate from MochiWeb.

Posted in Uncategorized | Comments Off on Enabling SSL for Couchdb v1.1

Installing Couchdb v1.1 on Ubuntu 10.04 LTS

The repositories for Ubuntu 10.04 LTS only contain packages for Couchdb v1.0. The Couchdb Wiki has instructions for manual installation on Ubuntu, but it also provides a pointer to the build-couchdb project on GitHub.

Using build-couchdb, here’s how I built, installed and ran Couchdb on my Ubuntu 10.04 LTS system:

<br />
# remove the old Couchdb (could have just disabled...)<br />
sudo apt-get uninstall couchdb</p>
<p># get the dependencies required by build-couchdb<br />
sudo apt-get install make gcc zlib1g-dev libssl-dev libreadline5-dev rake</p>
<p># download and build as couchdb user<br />
sudo su couchdb<br />
cd ~</p>
<p># clone and prepare build-couchdb<br />
git clone git://github.com/iriscouch/build-couchdb<br />
cd build-couchdb/<br />
git submodule init<br />
git submodule update</p>
<p># build couchdb<br />
rake/etc/init.d/couchdb-0.11.0</p>
<p># switch to root to install init script<br />
exit<br />
sudo su</p>
<p># install init script<br />
cd /etc/init.d<br />
ln -s ~couchdb/build-couchdb/build/etc/init.d/couchdb couchdb-1.1.0<br />
update-rc.d couchdb-1.1.0 defaults</p>
<p># start couchdb<br />
/etc/init.d/couchdb-1.1.0 start</p>
<p># back to user mode<br />
exit</p>
<p># test<br />
curl http://127.0.0.1:5984<br />
# expected output: {&quot;couchdb&quot;:&quot;Welcome&quot;,&quot;version&quot;:&quot;1.1.0&quot;}<br />

Drop dead simple – thanks to build-couchdb ๐Ÿ™‚

Posted in Uncategorized | Comments Off on Installing Couchdb v1.1 on Ubuntu 10.04 LTS

Installing RabbitMQ on Ubuntu 10.04 LTS

Following these instructions, hereโ€™s how I installed RabbitMQ on my Ubuntu 10.04 LTS system:

<br />
# add the rabbitmq repository to /etc/apt/sources.list<br />
sudo bash -c 'echo &quot;deb http://www.rabbitmq.com/debian/ testing main&quot; &gt;&gt; /etc/apt/sources.list'</p>
<p># add rabbitmq's public key so that aptitude will trust the repository<br />
wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc<br />
sudo apt-key add rabbitmq-signing-key-public.asc</p>
<p># Update aptitude's list of available packages<br />
sudo apt-get update</p>
<p># Install rabbitmq :)<br />
sudo apt-get install rabbitmq-server</p>
<p># enable the rabbit management plugin<br />
sudo rabbitmq-plugins enable rabbitmq_management</p>
<p># restart rabbit<br />
sudo /etc/init.d/rabbitmq-server restart<br />

Posted in Uncategorized | Comments Off on Installing RabbitMQ on Ubuntu 10.04 LTS

Installing MongoDB 2.0 on Ubuntu 10.04 LTS

10Gen publishes apt-gettable packages for MongoDB that are more up-to-date than those in Debian or Ubuntu.

The details about getting and installing 10gen’s packages are here.

Following those instructions, here’s how I installed MongoDB on my Ubuntu 10.04 LTS system:

<br />
# add the mongodb repository to /etc/apt/sources.list<br />
sudo bash -c &quot;echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' &gt;&gt; /etc/apt/sources.list&quot;</p>
<p># add 10gen's GPG key so that aptitude will trust the repository<br />
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10</p>
<p># Update aptitude's list of available packages<br />
sudo apt-get update</p>
<p># Install mongodb<br />
sudo apt-get install mongodb-10gen<br />

Posted in Uncategorized | Comments Off on Installing MongoDB 2.0 on Ubuntu 10.04 LTS