Python的卡桑德拉驱动程序:无效或不支持的协议版本:4 [英] Python cassandra driver: Invalid or unsupported protocol version: 4

查看:456
本文介绍了Python的卡桑德拉驱动程序:无效或不支持的协议版本:4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误:

   File "clear-domain-cass.py", line 25, in <module>
    session = cluster.connect('my_domain')
  File "/usr/lib/python2.6/dist-packages/cassandra/cluster.py", line 839, in connect
    self.control_connection.connect()
  File "/usr/lib/python2.6/dist-packages/cassandra/cluster.py", line 2075, in connect
    self._set_new_connection(self._reconnect_internal())
  File "/usr/lib/python2.6/dist-packages/cassandra/cluster.py", line 2110, in _reconnect_internal
    raise NoHostAvailable("Unable to connect to any servers", errors)
cassandra.cluster.NoHostAvailable: ('Unable to connect to any servers', {'10.1.0.89': ConnectionException(u'Failed to initialize new connection to 10.1.0.89: code=0000 [Server error] message="io.netty.handler.codec.DecoderException: org.apache.cassandra.transport.ProtocolException: Invalid or unsupported protocol version: 4"',)})

这是脚本的相关位:

from cassandra.cluster import Cluster
from cassandra.query import BatchStatement

startTime = time.time()

if len(sys.argv) < 2:
  print "Target host IP is required arg for this script. A comma-sep. list will work also"
  exit()

if len(sys.argv) < 3:
  print "Target domain is required arg for this script."
  exit()

hostIp = sys.argv[1]
domain = str(sys.argv[2])

cluster = Cluster(
  contact_points=[hostIp],
)
session = cluster.connect('my_domain')

它未能就cluster.connect行了。

It fails on the cluster.connect line.

我通过以下步骤设置PIP进入这个Amazon EC2实例。 COM /点子上,亚马逊EC2 /

I installed pip into this Amazon EC2 instance by following these steps: http://bcjordan.com/pip-on-amazon-ec2/

推荐答案

您使用的是尝试在默认情况下使用V4本机协议蟒蛇驱动程序的版本,但卡桑德拉2.1只支持协议版本3和更低。为了告诉司机使用v3协议,请执行以下操作:

The version of the python driver you're using attempts to use the v4 native protocol by default, but Cassandra 2.1 only supports protocol versions 3 and lower. To tell the driver to use the v3 protocol, do the following:

cluster = Cluster(contact_points=[hostIp], protocol_version=3)

(顺便说一句,应该在卡桑德拉2.1.6+感谢提高到 CASSANDRA-此错误信息9451 )。

这篇关于Python的卡桑德拉驱动程序:无效或不支持的协议版本:4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆