0

I have a MongoDB replica set cluster with one primary node and two secondary nodes. I created a user inside admin db of my primary node using the below command

db.createUser(
{
user: “myUserAdmin”,
pwd: “abc123”,
roles: [ { role: “readWrite”, db: “admin” } ]
}
)

After this when I try to establish connection to this cluster from vault using the below URI, I am not able to establish connection

mongodb://{{username}}:{{password}}@primary_node:port,secondary_node_1:port,secondary_node_2:port/admin?tls=false&serverSelectionTimeoutMS=2000&replicaSet=rs0

I also gave my admin db user creds which is myUserAdmin, abc123 for verifying the connection. Still not able to connect.

1
  • What error were you facing when you try to connect? Did you include the hostnames of the replica set on URI/vault? mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/?replicaSet=myRepl
    – Jerry
    Oct 18 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.