Riak ruby client runtime error

Sean Cribbs sean at basho.com
Fri Jun 22 10:03:47 EDT 2012


Hi Anand,

You need to give the Riak::Client which port(s) to connect to. If you're
doing the devrel 4-node setup, it would look like this:

client = Riak::Client.new(:nodes => [{:http_port => 8091},{:http_port
=>8092},{:http_port=>8093},{:http_port =>8094}])

Obviously you would need to add the :pb_port to those if you want to use
the Protocol Buffers transport.

On Fri, Jun 22, 2012 at 9:49 AM, Anand Hegde <anandghegde at gmail.com> wrote:

> Hello , I just installed riak on my OS X machine and got the 4 node
> cluster working.
>
> Here is my output for the command
>
> $ ps aux | grep beam
>
> anandhegde      1075   0.1  0.9  2519676  37548 s002  Ss+  10:49AM
> 1:34.84 /Users/anandhegde/dev/dev2/libexec/erts-5.8.5/bin/beam.smp -K true
> -A 64 -W w -- -root /Users/anandhegde/dev/dev2/libexec -progname riak --
> -home /Users/anandhegde -- -boot
> /Users/anandhegde/dev/dev2/libexec/releases/1.1.2/riak -embedded -config
> /Users/anandhegde/dev/dev2/libexec/etc/app.config -pa ./lib/basho-patches
> -name dev2 at 127.0.0.1 -setcookie riak -- console
> anandhegde       938   0.1  0.9  2519524  38152 s001  Ss+  10:49AM
> 1:36.31 /Users/anandhegde/dev/dev1/libexec/erts-5.8.5/bin/beam.smp -K true
> -A 64 -W w -- -root /Users/anandhegde/dev/dev1/libexec -progname riak --
> -home /Users/anandhegde -- -boot
> /Users/anandhegde/dev/dev1/libexec/releases/1.1.2/riak -embedded -config
> /Users/anandhegde/dev/dev1/libexec/etc/app.config -pa ./lib/basho-patches
> -name dev1 at 127.0.0.1 -setcookie riak -- console
> anandhegde      1295   0.0  0.9  2519188  37416 s004  Ss+  10:49AM
> 1:40.47 /Users/anandhegde/dev/dev4/libexec/erts-5.8.5/bin/beam.smp -K true
> -A 64 -W w -- -root /Users/anandhegde/dev/dev4/libexec -progname riak --
> -home /Users/anandhegde -- -boot
> /Users/anandhegde/dev/dev4/libexec/releases/1.1.2/riak -embedded -config
> /Users/anandhegde/dev/dev4/libexec/etc/app.config -pa ./lib/basho-patches
> -name dev4 at 127.0.0.1 -setcookie riak -- console
> anandhegde      1185   0.0  0.9  2519576  36764 s003  Ss+  10:49AM
> 1:39.91 /Users/anandhegde/dev/dev3/libexec/erts-5.8.5/bin/beam.smp -K true
> -A 64 -W w -- -root /Users/anandhegde/dev/dev3/libexec -progname riak --
> -home /Users/anandhegde -- -boot
> /Users/anandhegde/dev/dev3/libexec/releases/1.1.2/riak -embedded -config
> /Users/anandhegde/dev/dev3/libexec/etc/app.config -pa ./lib/basho-patches
> -name dev3 at 127.0.0.1 -setcookie riak -- console
> anandhegde      7115   0.0  0.0  2434892    540 s000  R+    7:13PM
> 0:00.00 grep beam
>
>
> After this I installed the riak-ruby-client gem as given here -
> https://github.com/basho/riak-ruby-client/
>
> I am trying to run a simple script based on the documentation provided at
> the github page. This is my script -
>
> require 'riak'
>
> client = Riak::Client.new
>
> bucket=client.bucket("doc")
> object = bucket.get_or_new("index.html")
> object.data="<html><body>some body content here</body></html>"
> object.content_type="text/html"
> object.store
>
> puts client['doc']['index.html']
>
>
> and when I run this using $ ruby script.rb
>
> I get the following error -
>
> /Users/anandhegde/.rvm/gems/ruby-1.9.3-p0/gems/riak-client-1.0.3/lib/riak/client.rb:450:in
> `rescue in recover_from': Connection refused - connect(2) (RuntimeError)
>  from
> /Users/anandhegde/.rvm/gems/ruby-1.9.3-p0/gems/riak-client-1.0.3/lib/riak/client.rb:422:in
> `recover_from'
> from
> /Users/anandhegde/.rvm/gems/ruby-1.9.3-p0/gems/riak-client-1.0.3/lib/riak/client.rb:284:in
> `http'
>  from
> /Users/anandhegde/.rvm/gems/ruby-1.9.3-p0/gems/riak-client-1.0.3/lib/riak/client.rb:129:in
> `backend'
> from
> /Users/anandhegde/.rvm/gems/ruby-1.9.3-p0/gems/riak-client-1.0.3/lib/riak/client.rb:277:in
> `get_object'
>  from
> /Users/anandhegde/.rvm/gems/ruby-1.9.3-p0/gems/riak-client-1.0.3/lib/riak/bucket.rb:88:in
> `get'
> from
> /Users/anandhegde/.rvm/gems/ruby-1.9.3-p0/gems/riak-client-1.0.3/lib/riak/bucket.rb:106:in
> `get_or_new'
>  from riak_client.rb:6:in `<main>'
>
>
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>


-- 
Sean Cribbs <sean at basho.com>
Software Engineer
Basho Technologies, Inc.
http://basho.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20120622/f138b663/attachment.html>


More information about the riak-users mailing list