Я пытаюсь настроить Logback MongoDB Appender для входа в Mongo Atlas.
Вот зависимости, которые я использую:
<dependency>
<groupId>ch.qos.logback.contrib</groupId>
<artifactId>logback-mongodb-classic</artifactId>
<version>0.1.5</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.9.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
А вот конфигурация приложения:
<appender name="MONGO" class="ch.qos.logback.contrib.mongodb.MongoDBLoggingEventAppender">
<!--<appender name="MONGO" class="ch.qos.logback.contrib.mongodb.MongoDBAccessEventAppender">-->
<uri>
mongodb://user:password@****-shard-00-00-7aylk.mongodb.net:27017,****-shard-00-01-7aylk.mongodb.net:27017,****-shard-00-02-7aylk.mongodb.net:27017/test.log?ssl=true&replicaSet=****-shard-0&authSource=admin
</uri>
</appender>
Ниже показано, что я получаю в консоли после запуска приложения:
2018-12-16 16:27:40.382 ❱ INFO ❱❱ main ❱❱❱ org.mongodb.driver.cluster ➤ Cluster created with settings {hosts=[****-shard-00-00-7aylk.mongodb.net:27017, ****-shard-00-01-7aylk.mongodb.net:27017, ****-shard-00-02-7aylk.mongodb.net:27017], mode=MULTIPLE, requiredClusterType=REPLICA_SET, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500, requiredReplicaSetName='****-shard-0'}
2018-12-16 16:27:40.395 ❱ INFO ❱❱ main ❱❱❱ org.mongodb.driver.cluster ➤ No server chosen by com.mongodb.client.internal.MongoClientDelegate$1@641147d0 from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=****-shard-00-01-7aylk.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, ServerDescription{address=****-shard-00-02-7aylk.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, ServerDescription{address=****-shard-00-00-7aylk.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}]}. Waiting for 30000 ms before timing out
2018-12-16 16:27:41.486 ❱ INFO ❱❱ cluster-ClusterId{va ❱❱❱ org.mongodb.driver.connection ➤ Opened connection [connectionId{localValue:3, serverValue:83789}] to ****-shard-00-00-7aylk.mongodb.net:27017
2018-12-16 16:27:41.486 ❱ INFO ❱❱ cluster-ClusterId{va ❱❱❱ org.mongodb.driver.cluster ➤ No server chosen by com.mongodb.client.internal.MongoClientDelegate$1@3221ec24 from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=****-shard-00-01-7aylk.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, ServerDescription{address=****-shard-00-02-7aylk.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, ServerDescription{address=****-shard-00-00-7aylk.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}]}. Waiting for 30000 ms before timing out
2018-12-16 16:27:41.487 ❱ INFO ❱❱ cluster-ClusterId{va ❱❱❱ org.mongodb.driver.connection ➤ Opened connection [connectionId{localValue:2, serverValue:81369}] to ****-shard-00-01-7aylk.mongodb.net:27017
2018-12-16 16:27:41.487 ❱ INFO ❱❱ cluster-ClusterId{va ❱❱❱ org.mongodb.driver.cluster ➤ No server chosen by com.mongodb.client.internal.MongoClientDelegate$1@66df1af2 from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=****-shard-00-01-7aylk.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, ServerDescription{address=****-shard-00-02-7aylk.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, ServerDescription{address=****-shard-00-00-7aylk.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}]}. Waiting for 30000 ms before timing out
2018-12-16 16:27:41.503 ❱ INFO ❱❱ cluster-ClusterId{va ❱❱❱ org.mongodb.driver.connection ➤ Opened connection [connectionId{localValue:1, serverValue:83481}] to ****-shard-00-02-7aylk.mongodb.net:27017
2018-12-16 16:27:41.504 ❱ INFO ❱❱ cluster-ClusterId{va ❱❱❱ org.mongodb.driver.cluster ➤ No server chosen by com.mongodb.client.internal.MongoClientDelegate$1@58c695d3 from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=****-shard-00-01-7aylk.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, ServerDescription{address=****-shard-00-02-7aylk.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, ServerDescription{address=****-shard-00-00-7aylk.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}]}. Waiting for 30000 ms before timing out
И после нескольких попыток приложение завершается сбоем из-за:
com.mongodb.MongoSocketOpenException: Exception opening socket
В основном, я пробовал с любыми версиями комбинаций между logback-mongodb-classic и mongo-java-driver 3.4. * (Я использую MongoDB v4)
Но результат тот же.Есть идеи?