[SOLVED] Add Mongodb ReplicaSet Database

Hi, I’m trying add a new connection to a MongoDB 4, but I receive this error in log:

[4eef87ff-3ea9-40fc-b8a7-cbbff1e66332] 2019-09-18T19:42:00-05:00 DEBUG 
metabase.middleware.log POST /api/database 400 3.0 s (0 DB calls) 
{:valid false,
:dbname "Hmm, we couldn't connect to the database. Make sure your host and port 
settings are correct",
:message "Hmm, we couldn't connect to the database. Make sure your host and port 
settings are correct"}

My mongo is configured as ReplicaSet and use ports not default. In field Host I try with primary host or with all hosts of replicaset. But doesn’t work.

Did somebody already connect to ReplicaSet Cluster?

Hi @raragao
(I don’t use Mongo, just trying to help)

Which version of Metabase?

Is it a Atlas Cluster? If yes, then DNS SRV should be enabled by default and Metabase should use those:
https://metabase.com/docs/latest/administration-guide/databases/mongodb.html

Otherwise you should connect to primary host and define the connection string options like:
readPreference=nearest&replicaSet=MyCoolReplica&ssl=true

But if you’re using a self-signed certificate, then you’re probably seeing this issue:
https://github.com/metabase/metabase/issues/3877

I’m using v0.33.0.

No is Atlas. I created my own replicaset and dont enable SSL.

Thanks.

Add one host only, not all of ReplicaSet.

1 Like