我可以使用 ap-south-1 连接到 aws 密钥空间,但是当我将其更改为 us-east-2 时,它显示 “NoHostAvailable('无法连接到任何服务器', {'3.12.23.133:9142': OperationTimedOut( '错误=无,last_host =无')})“
我正在使用 python 进行连接
if __name__ == '__main__':
sUsername = '******-at-43*****6380240297'
sPassword = '********'
sUrl = 'cassandra.us-east-2.amazonaws.com'
sSSLCertPath = 'C:\\Users\\KArora\\Downloads\\sf-class2-root.crt'
sPort = 9142
session = getDBClient(sUrl, sUsername, sPassword, sPort, sSSLCertPath)
def getDBClient(sURL, sUserName, sPassword, sPort, sSSLCertPath):
error = ""
try:
ssl_context = SSLContext(PROTOCOL_TLSv1_2)
ssl_context.load_verify_locations(sSSLCertPath)
ssl_context.verify_mode = CERT_REQUIRED
auth_provider = PlainTextAuthProvider(username=sUserName, password=sPassword)
sConn = []
sConn.append(sURL)
cluster = Cluster(sConn, ssl_context=ssl_context, auth_provider=auth_provider, port=sPort)
session = cluster.connect()
#error += "Success"
return session
except Exception as e:
#error += "Failure"
return str(e)