[英]Python cassandra driver - SSL: WRONG_VERSION_NUMBER
I'm trying to connect to a cassandra node that has SSL enabled, using the datastax cassandra driver, like this: 我正在尝试使用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()
I can successfully connect to the node using pycassa
, but I was trying to switch to using datastax driver
for this. 我可以使用pycassa
成功连接到该节点,但是pycassa
我试图切换为使用datastax driver
。
The above code throws the following exception: 上面的代码引发以下异常:
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)")})
I know the server accepts PROTOCOL_TLSv1, since it's the default protocol in pycassa. 我知道服务器接受PROTOCOL_TLSv1,因为它是pycassa中的默认协议。 I don't understand what I'm doing wrong here ... 我不明白我在做什么错...
This error commonly occurs when trying to connect with SSL on a socket that is not negotiating SSL. 尝试在未协商SSL的套接字上与SSL连接时,通常会发生此错误。
Confirm that SSL is enabled in the server, and for the port to which you are connecting. 确认已在服务器中以及要连接的端口上启用SSL。 I think this should be evident in the server system log. 我认为这在服务器系统日志中应该很明显。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.