amazon-web-servicesgocassandragocqlamazon-keyspaces

gocql.createSession: Consistency level ANY is not supported for this operation


Getting following error while trying to create session from cql,

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

I've used Amazon Managed Apache Cassandra Service

Following is the code for creating 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

I am setting consistency level to LocalQuorum but still its giving above mentioned error. If anybody knows how to resolve please help us out


Solution

  • Package upgrade works for me !