登录
首页 >  Golang >  Go问答

gocql.createSession:不支持使用一致性级别 ANY 进行操作

来源:stackoverflow

时间:2024-03-03 21:24:27 312浏览 收藏

小伙伴们对Golang编程感兴趣吗?是否正在学习相关知识点?如果是,那么本文《gocql.createSession:不支持使用一致性级别 ANY 进行操作》,就很适合你,本篇文章讲解的知识点主要包括。在之后的文章中也会多多分享相关知识点,希望对大家的知识积累有所帮助!

问题内容

尝试从 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

以下是创建会话的代码

clusterConfig := gocql.NewCluster("")
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,但仍然出现上述错误。如果有人知道如何解决请帮助我们


解决方案


软件包升级对我有用!

好了,本文到此结束,带大家了解了《gocql.createSession:不支持使用一致性级别 ANY 进行操作》,希望本文对你有所帮助!关注golang学习网公众号,给大家分享更多Golang知识!

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>