首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >gocql:无法创建会话:控制:无法连接到初始主机:登录失败

gocql:无法创建会话:控制:无法连接到初始主机:登录失败
EN

Stack Overflow用户
提问于 2020-09-09 06:09:43
回答 1查看 338关注 0票数 0
代码语言:javascript
复制
cluster := gocql.NewCluster("1.2.3.4") //replace PublicIP with the IP addresses used by your cluster.
    cluster.Keyspace = "testkeyspace"
    cluster.Port = 9042

    cluster.DisableInitialHostLookup = true
    cluster.Authenticator = gocql.PasswordAuthenticator{Username: "test", Password: "testpwd"}
    cluster.ProtoVersion = 4 //replace the username and password fields with their real settings.
    cluster.Consistency = gocql.Quorum
    cluster.CQLVersion = "3.4.5"
    cluster.IgnorePeerAddr = true
    cluster.DefaultIdempotence = true
    cluster.Timeout = time.Second * 30
    cluster.ConnectTimeout = time.Second * 30
    session, err := cluster.CreateSession()
    //  session, err := ccfg.CreateSession()
    if err != nil {
        fmt.Println("error in session", err)
        return
    }
    defer session.Close()

我正在尝试连接并遇到问题。我可以在本地连接cqlsh,gocql驱动程序失败,并显示以下错误消息:我已将go1.14和cassandra version设置为cqlsh 5.0.1 | Cassandra 4.0.0.608 | CQL spec 3.4.5 | Native protocol v66

谢谢Chakri

EN

回答 1

Stack Overflow用户

发布于 2020-09-09 17:28:00

您发布的错误指示用户名或密码(或两者)不正确。您需要验证您是否在应用程序中输入了正确的凭据。干杯!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63802180

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档