[英]Riak - Connection Refused while trying to connect to Riak cluster using Python client library
I am a Riak newbie. 我是Riak新手。 I installed Riak 2.1.1 from the source on my local machine while following instructions at: https://docs.basho.com/riak/latest/ops/building/installing/mac-osx/
我按照以下说明从本地计算机上的源代码安装了Riak 2.1.1: https : //docs.basho.com/riak/latest/ops/building/installing/mac-osx/
I then started three nodes and pinged all the three nodes and received 'pong' as the response. 然后,我启动了三个节点并ping通这三个节点,并收到“ pong”作为响应。
I joined then joined the three nodes to create a cluster. 我加入,然后加入三个节点来创建集群。 Checking the cluster member status:
检查集群成员状态:
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
I looked at the riak.config file in rel/riak/etc/ directory and saw that the following has been set: 我查看了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
I then installed the Riak python client using pip. 然后,我使用pip安装了Riak python客户端。 I am following the Riak python client docs at http://riak-python-client.readthedocs.org/en/2.1.0/client.html .
我在http://riak-python-client.readthedocs.org/en/2.1.0/client.html上关注Riak python客户端文档。
The following is my Python script: 以下是我的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'
However, running the python script gives the following error: 但是,运行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
All my nodes were running before I ran the python script. 在运行python脚本之前,我所有的节点都在运行。
I then tried the following command on the terminal using the http port: 然后,我在使用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
What may be the cause of this connection refused error? 此连接拒绝错误的原因可能是什么? Have been chasing this problem for hours.
已经追逐了这个问题好几个小时了。 Any help would be greatly appreciated!
任何帮助将不胜感激!
Since you are using several dev nodes the config files will be under the dev
directory, such as dev/dev1/etc/riak.conf
. 由于您正在使用多个dev节点,因此配置文件将位于
dev
目录下,例如dev/dev1/etc/riak.conf
。 You'll need to check there to see which ports are being used for the protocol buffers listener for each node.. The configuration under the rel
directory is only suitable for running a single node on the machine. 您需要检查那里以查看每个节点的协议缓冲区侦听器正在使用哪些端口
rel
目录下的配置仅适用于在计算机上运行单个节点。
Hi I faced a similar issue but couldn't find a solution which was straight forward. 嗨,我遇到了类似的问题,但找不到直接解决的方法。
When you do a riak stop
without leaving the cluster there are files which are present in the ring directory which need to be deleted since the riak start/sudo service riak start
command triggers read from the ring information. 在不离开群集的情况下进行
riak stop
时,环形目录中存在一些文件,由于riak start/sudo service riak start
命令触发从环形信息读取,因此需要删除这些文件。
The default location of the riak ring directory is /var/lib/riak/ring/
delete the files here and do a riak start
. riak ring目录的默认位置是
/var/lib/riak/ring/
在此处删除文件并执行riak start
。
Note if the node in question is a master node for the cluster you will have to - 请注意,如果所讨论的节点是集群的主节点,则必须-
riak-admin cluster leave
riak-admin cluster leave
从群集中删除节点 riak stop
riak stop
停止riak节点 riak start
riak start
riak-admin
riak-admin
重新设置集群 These would be viable in non-production situations. 这些将在非生产情况下可行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.