Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stylesmile opened this issue Sep 16, 2024 · 2 comments

Comments

@stylesmile
Copy link

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 }, ] }

@stylesmile
Copy link
Author

用navicat 可以正常🔗,用java spirngboot 也可以连接

@cupen
Copy link

cupen commented Nov 13, 2024

你报错信息里连接地址是 47df5866cf51:27017. 这事应该不是 qmgo 的锅.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants