Skip to content

安装副本集单节点,非本地用了ssh隧道,用qmgo连接报错 #322

Open
@stylesmile

Description

@stylesmile

Describe the bug

安装副本集单节点,非本地用了ssh隧道,用qmgo连接报错

复现步骤
安装docker
sudo docker run -d -p 27017:27017 --name mongo70 mongo:7 mongod --dbpath /data/db --replSet appSet
管理员身份进入容器
sudo docker exec -it mongo70 mongosh admin
初始化副本集
rs.initiate()

连接代码
client, err := qmgo.NewClient(ctx, &qmgo.Config{Uri: "mongodb://127.0.0.1:27017"}, opts...)

报错信息
server selection error: context deadline exceeded, current topology: { Type: ReplicaSetNoPrimary, Servers: [{ Addr: 47df5866cf51:27017, Type: Unknown, Last error: dial tcp: lookup 47df5866cf51: no such host }, ] }
new client fail server selection error: context deadline exceeded, current topology: { Type: ReplicaSetNoPrimary, Servers: [{ Addr: 47df5866cf51:27017, Type: Unknown, Last error: dial tcp: lookup 47df5866cf51: no such host }, ] }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions