riak / python:无法运行store()命令

时间:2013-12-29 03:41:39

标签: python riak

尝试按照教程here

在完成基本的CRUD之后,教程has you edit the app.config file使用Leveli后端2i,在我的例子中意味着更新/usr/local/Cellar/riak/1.4.2/etc/app.config的第83行

            {storage_backend, riak_kv_bitcask_backend},

            {storage_backend, riak_kv_eleveldb_backend},

然后重新启动riak。

到目前为止,我一直在端口8098上运行riak,而他们的教程here引用了端口10017:

# Starting Client
client = riak.RiakClient(pb_port=10017, protocol='pbc')

# Creating Buckets
customer_bucket = client.bucket('Customers')
order_bucket = client.bucket('Orders')
order_summary_bucket = client.bucket('OrderSummaries')


# Storing Data
cr = customer_bucket.new(str(customer['customer_id']),
                         data=customer)
cr.store()

如果我尝试按编写的方式运行代码,我会得到:

 File "r.py", line 104, in <module>
    cr.store()
  File ".../riak/riak-python-client-master/riak/riak_object.py", line 281, in store
    timeout=timeout)
  File ".../riak/client/transport.py", line 127, in wrapper
    return self._with_retries(pool, thunk)
  File ".../riak/client/transport.py", line 82, in _with_retries
    raise e.args[0]
socket.error: [Errno 61] Connection refused
显然,Riak客户端没有在端口10017上运行。

但是,当我将其更改为端口8098时

client = riak.RiakClient(pb_port=8098, protocol='pbc')

应用程序只是冻结cr.store()行。是否有一些东西,eleveldb后端期望在默认端口以外的端口上运行?

1 个答案:

答案 0 :(得分:1)

没关系,8098是http端口,当我把它改成端口8087,默认端口,它工作正常