我无法从我的 EC2 实例连接到 Amazon 托管 Cassandra (Keyspaces)。EC2 实例位于具有密钥空间的 VPC 终端节点的 VPC 的私有子网中。
EC2 出站规则:
All TCP 0.0.0.0/0
VPC Endpoint 入站规则:
Custom TCP TCP 9142 0.0.0.0/0
VPC Endpoint 出站规则:
Custom TCP TCP 9142 0.0.0.0/0
这些规则实际上可能过于宽松。
C# 驱动程序错误:
Cassandra.NoHostAvailableException:
All hosts tried for query failed (tried 10.16.192.201:9142:
TimeoutException 'The timeout period elapsed prior to completion of SSL authentication operation.'; 10.16.224.203:9142:
TimeoutException 'The timeout period elapsed prior to completion of SSL authentication operation.')
我可以通过 SSH 连接到 EC2。
DNS似乎正确:
$ nslookup cassandra.eu-west-2.amazonaws.com
Server: 10.16.0.2
Address: 10.16.0.2#53
Non-authoritative answer:
Name: cassandra.eu-west-2.amazonaws.com
Address: 10.16.192.201
Name: cassandra.eu-west-2.amazonaws.com
Address: 10.16.224.203
我无法卷曲端点(超时):
$ curl cassandra.eu-west-2.amazonaws.com:9142
和远程登录:
$ sudo yum -y install telnet
$ telnet cassandra.eu-west-2.amazonaws.com
Trying 10.16.192.201...
^C
# Gave up after 60s
VPC 终端节点的安全组允许往来9142
于任何地方的流量。EC2 实例的安全组允许出口到任何地方。
如何连接到 Cassandra?
更新
我现在可以将 VPC 终端节点添加到公共子网:
$ telnet cassandra.eu-west-2.amazonaws.com 9142
Trying 10.16.224.203...
Connected to cassandra.eu-west-2.amazonaws.com.
Escape character is '^]'.
更新
如果禁用证书吊销检查,我可以连接。
sslOptions.SetCertificateRevocationCheck false
这让我认为问题在于从 EC2 到 CRL 所在位置的连接。但是,我不想将我的 EC2 移动到公共 VPC,那么这里有什么好的策略呢?