Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Need to use external ip or hostname when connecting from client application #3

Open
sripri opened this issue Jan 11, 2016 · 0 comments

Comments

@sripri
Copy link

sripri commented Jan 11, 2016

I have followed your compose and scripts closely. However, when connecting from a java (spring boot app in my case) I discovered that the config setup for the repl set needs to be the hostname of the machine (or the external IP address). for example,
config= {"_id": "mongors", members:[{"_id": 0, "host": "external-hostname::27017", "priority": 2},{"_id": 1, "host": "external-hostname:27018", "priority": 0},{"_id": 2, "host": "external-hostname:27019", "priority": 0}]}

If I dont and instead give it the docker's internal ip address it does not work. I get a connection error (looks like the hearbeat checks against the address specified in the config variable.

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

No branches or pull requests

1 participant