Python cassandra 驱动程序 - SSL:WRONG_VERSION_NUMBER

Python cassandra driver - SSL: WRONG_VERSION_NUMBER

我正在尝试使用 datastax cassandra 驱动程序连接到启用了 SSL 的 cassandra 节点,如下所示:

from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider 

import ssl
ip = <ip>
ap = PlainTextAuthProvider(username=<username>, password=<password>) 

ssl_options = {
  'ca_certs': <path to PEM file>,
  'ssl_version': ssl.PROTOCOL_TLSv1
  }
cluster = Cluster([ip], auth_provider=ap, ssl_options=ssl_options)
session = cluster.connect() 

我可以使用 pycassa 成功连接到节点,但为此我试图切换到使用 datastax driver

以上代码抛出以下异常:

NoHostAvailable: ('Unable to connect to any servers', {<ip>: error(1, u"Tried connecting to [(<ip>, <port>)]. Last error: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:590)")})

我知道服务器接受 PROTOCOL_TLSv1,因为它是 pycassa 中的默认协议。我不明白我在这里做错了什么...

当尝试在未协商 SSL 的套接字上连接 SSL 时,通常会发生此错误。

确认在服务器中启用了 SSL,并为您要连接的端口启用了 SSL。我认为这在服务器系统日志中应该很明显。