gocql.createsession:此操作不支持任何一致性级别

9rnv2umw  于 2021-06-09  发布在  Cassandra
关注(0)|答案(1)|浏览(424)

尝试从cql创建会话时出现以下错误,

Error: 
Consistency level ANY is not supported for this operation. Supported consistency levels are: ONE, LOCAL_QUORUM, LOCAL_ONE

我使用了amazon管理的apachecassandra服务
下面是创建会话的代码

clusterConfig := gocql.NewCluster("<HOST:PORT>")
clusterConfig.Authenticator = gocql.PasswordAuthenticator{Username: "Username", Password: "Password"}
clusterConfig.SslOpts = &gocql.SslOptions{
CaPath: "./AmazonRootCA1.pem",
}
clusterConfig.Consistency = gocql.LocalQuorum
clusterConfig.ConnectTimeout = time.Second * 10
clusterConfig.ProtoVersion = 3
clusterConfig.DisableInitialHostLookup = true
clusterConfig.Keyspace = "TestDB"
clusterConfig.NumConns = 3
session, err := clusterConfig.CreateSession()
if err != nil {
fmt.Println("err>", err)
}
return session

我正在将一致性级别设置为localquorum,但仍然会出现上述错误。如果有人知道如何解决,请帮助我们

相关问题