0

我刚刚在我的 OS X 机器上安装了 riak 并让 4 节点集群正常工作。

这是我的命令输出

$ 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@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@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@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@127.0.0.1 -setcookie riak -- console
anandhegde      7115   0.0  0.0  2434892    540 s000  R+    7:13PM   0:00.00 grep beam

在此之后,我安装了此处给出的 riak-ruby-client gem - https://github.com/basho/riak-ruby-client/

我正在尝试根据 github 页面上提供的文档运行一个简单的脚本。这是我的脚本 -

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']

当我使用$ ruby script.rb

我收到以下错误 -

/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>'
4

1 回答 1

0

在设置客户端时,您是否指定了要连接的节点的 IP 地址和端口?(如果这看起来很明显,我很抱歉,但我没有在您提供的脚本中看到那部分)

于 2012-10-21T19:00:02.580 回答