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

Example for connecting to multiple replicas on Mongo Atlas #207

Open
Spoowy opened this issue Dec 2, 2018 · 6 comments
Open

Example for connecting to multiple replicas on Mongo Atlas #207

Spoowy opened this issue Dec 2, 2018 · 6 comments

Comments

@Spoowy
Copy link

Spoowy commented Dec 2, 2018

I had great success with this package, and could connect to my Mongo Atlas Cluster.

Right now, I am connected to the primary server, via mc_worker_api. Any advice on how to connect to a Mongo Atlas replica cluster properly?

Cheers,
Erwin

@Spoowy Spoowy changed the title Example for connecting to multiple shards on Mongo Atlas Example for connecting to multiple replicas on Mongo Atlas Dec 9, 2018
@comtihon
Copy link
Owner

Have you tried with mongo_api and multiple hosts?

@grizzly-monkey
Copy link

I think this is same as #196 , this is a much needed feature.

@pedro-gutierrez
Copy link

Hi, this worked for me:

{ok, Pid} = mongoc:connect( {rs, <<"...">>, [ 
	"....mongodb.net:27017",
	"....mongodb.net:27017",
	"....mongodb.net:27017"
]}, [], [
	{database,<<"...">>},
	{login,<<"...">>},
	{password,<<"...">>},
        {ssl, true}
]).

@wandermyz
Copy link

It works for me as soon as I add {ssl, true} as @pedro-gutierrez says. It even works if I just specify { unknown, [ ... ] } instead of rs.

(Note that it never works for me when using escript. )

@liujp-arch
Copy link

when i add {ssl, true}, it always show a timeout operation.

@Spoowy
Copy link
Author

Spoowy commented May 14, 2020

(I switched to Sergej's erlmongo package and added ssl support.

https://github.com/SergejJurecko/erlmongo)

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

6 participants