-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Allow multiple hosts to be set in MongoProperties #32113
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
Comments
It looks like Perhaps we could add something like: spring:
data:
mongodb:
host: 0.0.0.1
port: 27017
additional-hosts:
- host: 0.0.0.2
port: 27017
- host: 0.0.0.3
port: 27017
username: username
password: '{cipher}encrypted_password'
database: testdb
authentication-database: admin Either that or consider changing the existing properties to: spring:
data:
mongodb:
hosts:
- host: 0.0.0.1
- port: 27017
- host: 0.0.0.2
port: 12345
- host: 0.0.0.3
port: 27017
username: username
password: '{cipher}encrypted_password'
database: testdb
authentication-database: admin That unfortunately makes the 90% use-case of a single host a little harder to configure. It will also cause upgrade pain. Rather confusingly, the spring:
data:
mongodb:
host: 0.0.0.1
port: 27017
additional-hosts: [0.0.0.2:12345, 0.0.0.3]
username: username
password: '{cipher}encrypted_password'
database: testdb
authentication-database: admin |
@philwebb , much better!! |
Currently MongoProperties allow only single host to be set in the MongoProperties. With this commit a set of 'additional hosts' can be set along with the base host/port. This closes spring-projects#32113
Closing in favor of PR #32125. Thanks @thegeekyasian |
When using ReplicaSet, access to the Mongo cluster by multiple hosts.
i'd like to write below property.
BUT it is not valid
because AutoConfigure does not support list of host.
it support only single instance.
https://github.com/spring-projects/spring-boot/blob/c41609d01d813a765cf04ef06ae267[…]igure/mongo/MongoPropertiesClientSettingsBuilderCustomizer.java
i know below property.
it is workaround.
We need more various setting.
The text was updated successfully, but these errors were encountered: