gpt4 book ai didi

Python cassandra 驱动程序 : Invalid or unsupported protocol version: 4

转载 作者:太空狗 更新时间:2023-10-29 22:10:59 24 4
gpt4 key购买 nike

我收到以下错误:

   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 线上失败。

我按照以下步骤将 pip 安装到这个 Amazon EC2 实例中:http://bcjordan.com/pip-on-amazon-ec2/

最佳答案

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

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

(顺便说一句,由于 CASSANDRA-9451,Cassandra 2.1.6+ 应该改进此错误消息)。

关于Python cassandra 驱动程序 : Invalid or unsupported protocol version: 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31444098/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com