我正在尝试使用 Cassandraemon 连接到 C# .NET 中的 Cassandra 实例。我找不到任何允许您指定凭据的示例。我的 Cassandra 实例在 AWS 的服务器上运行,我需要传递用户名/密码才能连接。我有以下代码:
var builder = new CassandraConnectionConfigBuilder
{
Hosts = new[] { "cassandra.myinstance.com" },
ConsistencyLevel = ConsistencyLevel.QUORUM,
Timeout = TimeSpan.FromSeconds(100),
Keyspace = "mykeyspace"
};
var config = new CassandraConnectionConfig(builder);
using (var context = new CassandraContext(config))
{
Dictionary<string, string> credentials = new Dictionary<string, string>();
credentials.Add("username", "password");
context.Login(credentials);
}
当我运行它时,我得到一个Apache.Cassandra.AuthenticationException
错误context.Login(credentials)
。我弄错了凭据字典吗?密钥不是用户名,密码不是值吗?