gocql.createSession:此操作不支持一致性级别 ANY
gocql.createSession: Consistency level ANY is not supported for this operation
尝试从 cql 创建会话时出现以下错误,
Error:
Consistency level ANY is not supported for this operation. Supported consistency levels are: ONE, LOCAL_QUORUM, LOCAL_ONE
我用过 Amazon Managed Apache Cassandra Service
以下是创建session的代码
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 但它仍然给出上述错误。如果有人知道如何解决请帮助我们
包升级适合我!
尝试从 cql 创建会话时出现以下错误,
Error:
Consistency level ANY is not supported for this operation. Supported consistency levels are: ONE, LOCAL_QUORUM, LOCAL_ONE
我用过 Amazon Managed Apache Cassandra Service
以下是创建session的代码
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 但它仍然给出上述错误。如果有人知道如何解决请帮助我们
包升级适合我!