Python cassandra驱动程序:无效或不受支持的协议版本:4

Python cassandra驱动程序:无效或不受支持的协议版本:4,python,amazon-web-services,cassandra,Python,Amazon Web Services,Cassandra,我得到以下错误: 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

我得到以下错误:

   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"',)})
文件“清除域cass.py”,第25行,在
session=cluster.connect('my_domain')
文件“/usr/lib/python2.6/dist packages/cassandra/cluster.py”,第839行,在connect中
self.control\u connection.connect()
文件“/usr/lib/python2.6/dist packages/cassandra/cluster.py”,第2075行,在connect中
self.\u设置\u新连接(self.\u重新连接\u内部())
文件“/usr/lib/python2.6/dist packages/cassandra/cluster.py”,第2110行,在内部
raise NoHostAvailable(“无法连接到任何服务器”,错误)
cassandra.cluster.NoHostAvailable:(“无法连接到任何服务器”,“10.1.0.89”:ConnectionException(u”未能初始化到10.1.0.89的新连接:code=0000[Server error]message=“io.netty.handler.codec.DecoderException:org.apache.cassandra.transport.ProtocolException:无效或不受支持的协议版本: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')
来自cassandra.cluster导入集群
从cassandra.query导入批处理语句
startTime=time.time()
如果len(系统argv)<2:
打印“此脚本需要目标主机IP参数。逗号-九月列表也可以”
退出()
如果len(sys.argv)<3:
print“此脚本需要目标域参数。”
退出()
hostIp=sys.argv[1]
domain=str(sys.argv[2])
群集=群集(
联系点=[hostIp],
)
session=cluster.connect('my_domain')
它在cluster.connect线路上失败


我通过以下步骤将pip安装到这个Amazon EC2实例中:

您正在使用的python驱动程序版本默认情况下尝试使用v4本机协议,但Cassandra 2.1仅支持协议版本3及更低版本。要告诉驱动程序使用v3协议,请执行以下操作:

cluster = Cluster(contact_points=[hostIp], protocol_version=3)
(顺便说一句,这方面的错误消息应该在Cassandra 2.1.6+中得到改进,这要归功于)