简体   繁体   English

Riak-尝试使用Python客户端库连接到Riak群集时拒绝连接

[英]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 - 请注意,如果所讨论的节点是集群的主节点,则必须-

  1. Do all of the above for the master node ( stop clean ring ) and - 对主节点执行上述所有操作(停止清洁环),然后-
  2. Remove the nodes from the cluster using the riak-admin cluster leave 使用riak-admin cluster leave从群集中删除节点
  3. Stop the riak nodes using riak stop 使用riak stop停止riak节点
  4. delete the ring directory as mentioned above 如上所述删除环目录
  5. do a riak start 开个riak start
  6. follow rules to set up the cluster again using riak-admin 遵循规则使用riak-admin重新设置集群

These would be viable in non-production situations. 这些将在非生产情况下可行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用erlang将参数发送到地图以减少python-riak客户端在riak中的查询 - How to send Parameters to a map reduce query in riak by python-riak client using erlang 如何通过riak-python-client获得Riak 2.0安全性? - How to get Riak 2.0 security working with riak-python-client? 为什么我在尝试将我的 python 客户端连接到服务器时不断收到 [Erno 111] 连接被拒绝? - Why do i keep getting [Erno 111] connection refused while trying to connect my python client to server? Riak python,如何正确连接到服务器池? - Riak python, how to properly connect to a server pool? 带有协议缓冲区的Riak Python客户端的超时问题 - Timeout problems with the Riak Python Client with protocol buffers 使用javascript和python在单个节点上进行Riak MapReduce - Riak MapReduce in single node using javascript and python 尝试连接到 mysql 服务器时连接被拒绝 - Connection refused while trying to connect to mysql server 在Riak Python客户端中读取/存储多个对象的有效方法? - Efficient way to read/store multiple objects in Riak Python Client? Python Server / Java客户端“连接被拒绝:连接” - Python Server / Java Client “Connection refused: connect” RIAK-数据类型-python中的地图用法 - RIAK - datatypes - map usage in python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM