|
@@ -1,5 +1,6 @@
|
|
|
package com.tzld.piaoquan.recommend.server.config;
|
|
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.mongodb.MongoClientSettings;
|
|
|
import com.mongodb.MongoCredential;
|
|
|
import com.mongodb.ServerAddress;
|
|
@@ -32,8 +33,9 @@ public class MongoTemplateConfig {
|
|
|
MongoClientSettings.Builder builder = MongoClientSettings.builder();
|
|
|
|
|
|
builder.applyToClusterSettings(settings -> {
|
|
|
- settings.hosts(singletonList(
|
|
|
- new ServerAddress(properties.getHost(), properties.getPort())));
|
|
|
+ settings.hosts(Lists.newArrayList(
|
|
|
+ new ServerAddress(properties.getClusterHost(), properties.getClusterPort()),
|
|
|
+ new ServerAddress(properties.getSecondaryHost(), properties.getSecondaryPort())));
|
|
|
});
|
|
|
|
|
|
|