我是Riak新手。我按照以下说明在本地计算机上从源代码安装了 Riak 2.1.1:https ://docs.basho.com/riak/latest/ops/building/installing/mac-osx/
然后我启动了三个节点并ping通了所有三个节点并收到了“pong”作为响应。
我加入然后加入三个节点以创建一个集群。检查集群成员状态:
dev1/bin/riak-admin member-status
================================= Membership ==================================
Status Ring Pending Node
-------------------------------------------------------------------------------
valid 34.4% -- 'dev1@127.0.0.1'
valid 32.8% -- 'dev2@127.0.0.1'
valid 32.8% -- 'dev3@127.0.0.1'
-------------------------------------------------------------------------------
Valid:3 / Leaving:0 / Exiting:0 / Joining:0 / Down:0
我查看了 rel/riak/etc/ 目录下的 riak.config 文件,发现已经设置了以下内容:
## listener.http.<name> is an IP address and TCP port that the Riak
## HTTP interface will bind.
##
## Default: 127.0.0.1:8098
##
## Acceptable values:
## - an IP/port pair, e.g. 127.0.0.1:10011
listener.http.internal = 127.0.0.1:8098
## listener.protobuf.<name> is an IP address and TCP port that the Riak
## Protocol Buffers interface will bind.
##
## Default: 127.0.0.1:8087
##
## Acceptable values:
## - an IP/port pair, e.g. 127.0.0.1:10011
listener.protobuf.internal = 127.0.0.1:8087
然后我使用 pip 安装了 Riak python 客户端。我正在关注http://riak-python-client.readthedocs.org/en/2.1.0/client.html上的 Riak python 客户端文档。
以下是我的 Python 脚本:
import riak
client = riak.RiakClient(pb_port=8087,protocol='pbc')
print 'finished'
user_bucket = client.bucket('user')
val1 = 1
key1 = user_bucket.new('one', data=val1)
key1.store()
print 'finished2'
但是,运行 python 脚本会出现以下错误:
/Library/Python/2.7/site-packages/riak/security.py:35: UserWarning: Found OpenSSL 0.9.8zd 8 Jan 2015 version, but expected at least OpenSSL 1.0.1g. Security may not support TLS 1.2.
warnings.warn(msg, UserWarning)
finished
Traceback (most recent call last):
File "/Users/me/Documents/project/RiakDataLoader/src/DataLoader.py", line 11, in <module>
**key1.store()**
File "/Library/Python/2.7/site-packages/riak/riak_object.py", line 286, in store
timeout=timeout)
File "/Library/Python/2.7/site-packages/riak/client/transport.py", line 196, in wrapper
return self._with_retries(pool, thunk)
File "/Library/Python/2.7/site-packages/riak/client/transport.py", line 151, in _with_retries
raise e.args[0]
socket.error: [Errno 61] Connection refused
在我运行 python 脚本之前,我的所有节点都在运行。
然后,我使用 http 端口在终端上尝试了以下命令:
$ curl -XPUT http://127.0.0.1:8098/buckets/welcome/keys/german -H 'Content-Type: text/plain' -d 'herzlich willkommen'
curl: (7) Failed to connect to 127.0.0.1 port 8098: Connection refused
此连接被拒绝错误的原因可能是什么?一直在追逐这个问题几个小时。任何帮助将不胜感激!