我在amazon keyspace中创建了一个keyspace(表),并试图将记录从中获取到运行在ubuntu中的.net核心应用程序中,aws文档中提到的密码和awsendpoint,使用cassandra.net核心客户机驱动程序以编程方式访问amazon密钥空间
但是,当我运行代码并尝试连接amazon keyspace时,它会引发一个异常“所有尝试查询的主机都失败(尝试3.6.70.143:9142:authenticationexception‘验证失败,请参阅内部异常’)”。
但是当从windows环境执行时,同样的代码会正确执行并返回所需的结果。
X509Certificate2Collection certCollection = new X509Certificate2Collection();
X509Certificate2 amazoncert = new X509Certificate2(@"./Security/AmazonRootCA1.pem","");
var userName = "username";
var pwd = "password";
certCollection.Add(amazoncert);
var awsEndpoint = "cassandra.ap-south-1.amazonaws.com" ;
try
{
var cluster = Cluster.Builder()
.AddContactPoints(awsEndpoint)
.WithPort(9142)
.WithAuthProvider(new PlainTextAuthProvider(userName, pwd))
.WithSSL(new SSLOptions().SetCertificateCollection(certCollection))
.Build();
var session = cluster.Connect();
var rs = session.Execute("select * from tutorialkeyspace.tutorialtable;");
1条答案
按热度按时间aoyhnmkz1#
尝试将证书添加到linux信任库。