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

Invalid DSN error for standard replica set connection string #887

Open
wdonne opened this issue Aug 9, 2024 · 2 comments
Open

Invalid DSN error for standard replica set connection string #887

wdonne opened this issue Aug 9, 2024 · 2 comments

Comments

@wdonne
Copy link

wdonne commented Aug 9, 2024

Describe the bug
When using a standard connection string for a MongoDB replica set like mongodb://username:password@hostname-0,hostname-1,hostname-2, the following error message appears in the logs:
"Cannot connect to MongoDB: invalid dsn: error parsing uri: scheme must be "mongodb" or "mongodb+srv""
To Reproduce
Steps to reproduce the behavior:

  1. Create a secret with such a connection string
  2. Use a secretRef to refer to it

Expected behavior
The connection to MongoDB should succeed.

Logs
"Cannot connect to MongoDB: invalid dsn: error parsing uri: scheme must be "mongodb" or "mongodb+srv""

Environment

  • OS: Amazon Linux 2
  • environment (docker, k8s, etc): EKS 1.29
  • MongoDB version: 7.0.11

Additional context
The example of a mongodb+srv URI in the documentation is wrong. Such a URI can't have multiple hosts or ports. It uses a DNS SRV record to discover all the members of a replica set. With the mongodb scheme, all the hosts of the replica set should be specified.

@BupycHuk
Copy link
Member

Hi, what version of mongodb_exporter did you use? We haven't released mongodb_exporter with these changes yet.

@BupycHuk
Copy link
Member

Hi @wdonne, we just release v0.41.0, please re-check it.

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

No branches or pull requests

2 participants