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

how to connect by Mongodb Compass? #1

Open
li-zheng-hao opened this issue Jun 26, 2022 · 4 comments
Open

how to connect by Mongodb Compass? #1

li-zheng-hao opened this issue Jun 26, 2022 · 4 comments

Comments

@li-zheng-hao
Copy link

i use the deploy yaml file to deploy mongo , here is my machines status created by vmware:

hostname ip
master1 192.168.137.10
master2
master3
slave1 192.168.137.11
slave2 192.168.137.12
slave3 192.168.137.13

i deploy mongo master node on slave1, and 2 slave node on slave2 and slave3,the running status are as follows:
image

how can i connect mongo in my host computer ? i tried these connect string but not works:

mongodb://192.168.137.10:27017  // error msg: getaddrinfo ENOTFOUND mongo1

mongodb://192.168.137.11:27017 // same error

Any reply is greatly appreciated

@li-zheng-hao
Copy link
Author

li-zheng-hao commented Jun 26, 2022

i can ping each other machine between my host computer and virtual machine , and i can visit nginx in my host computer by visit http://192.168.137.10:8080

@AndrewBedscastle
Copy link

Did you find a solution?

@li-zheng-hao
Copy link
Author

Did you find a solution?

It's been so long that I've forgotten if I solved this problem at the time ...

@AndrewBedscastle
Copy link

AndrewBedscastle commented Nov 25, 2022

I did not find a solution so I assigned 'A records' to the host machines, exposed the ports and created the replica set with A records (and public ports) instead mongo1,2,3

This is definitely not the best approach but it's working.
If you only use it inside docker using the mongo network it should work without. But to access it externally it's necessary.

Don't forget to add authentication, though, otherwise it's publicly available...

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