Atlas Mongo: ошибка, не связанная с адресом

#mongodb #hostname #mongodb-atlas

#mongodb #имя хоста #mongodb-atlas

Вопрос:

Мой код подключается к кластеру Mongo, но позже выдает исключение

 2021-01-09 10:27:04,358 [cluster-ClusterId{value='5ff984f53051d07265915193', description='null'}-myac-demo-shard-00-00.hn89s.mongodb.net:27017] INFO  - diagnostics.logging.SLF4JLogger (SLF4JLogger.java:71) | {} | Monitor thread successfully connected to server with description ServerDescription{address=myac-demo-shard-00-00.hn89s.mongodb.net:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=252439567, setName='atlas-97d1j6-shard-0', canonicalAddress=myac-demo-shard-00-00.hn89s.mongodb.net:27017, hosts=[myac-demo-shard-00-02.hn89s.mongodb.net:27017, myac-demo-shard-00-01.hn89s.mongodb.net:27017, myac-demo-shard-00-00.hn89s.mongodb.net:27017], passives=[], arbiters=[], primary='myac-demo-shard-00-02.hn89s.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='AP_NORTHEAST_1'}, Tag{name='workloadType', value='OPERATIONAL'}]}, electionId=null, setVersion=1, lastWriteDate=Sat Jan 09 10:27:01 UTC 2021, lastUpdateTimeNanos=1051125373154500}
2021-01-09 10:27:04,358 [cluster-ClusterId{value='5ff984f53051d07265915193', description='null'}-myac-demo-shard-00-01.hn89s.mongodb.net:27017] INFO  - diagnostics.logging.SLF4JLogger (SLF4JLogger.java:71) | {} | Monitor thread successfully connected to server with description ServerDescription{address=myac-demo-shard-00-01.hn89s.mongodb.net:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=251190466, setName='atlas-97d1j6-shard-0', canonicalAddress=myac-demo-shard-00-01.hn89s.mongodb.net:27017, hosts=[myac-demo-shard-00-02.hn89s.mongodb.net:27017, myac-demo-shard-00-01.hn89s.mongodb.net:27017, myac-demo-shard-00-00.hn89s.mongodb.net:27017], passives=[], arbiters=[], primary='myac-demo-shard-00-02.hn89s.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='AP_NORTHEAST_1'}, Tag{name='workloadType', value='OPERATIONAL'}]}, electionId=null, setVersion=1, lastWriteDate=Sat Jan 09 10:27:01 UTC 2021, lastUpdateTimeNanos=1051125372345179}
2021-01-09 10:27:04,359 [cluster-ClusterId{value='5ff984f53051d07265915193', description='null'}-myac-demo-shard-00-02.hn89s.mongodb.net:27017] INFO  - diagnostics.logging.SLF4JLogger (SLF4JLogger.java:71) | {} | Monitor thread successfully connected to server with description ServerDescription{address=myac-demo-shard-00-02.hn89s.mongodb.net:27017, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=258466617, setName='atlas-97d1j6-shard-0', canonicalAddress=myac-demo-shard-00-02.hn89s.mongodb.net:27017, hosts=[myac-demo-shard-00-02.hn89s.mongodb.net:27017, myac-demo-shard-00-01.hn89s.mongodb.net:27017, myac-demo-shard-00-00.hn89s.mongodb.net:27017], passives=[], arbiters=[], primary='myac-demo-shard-00-02.hn89s.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='AP_NORTHEAST_1'}, Tag{name='workloadType', value='OPERATIONAL'}]}, electionId=7fffffff0000000000000002, setVersion=1, lastWriteDate=Sat Jan 09 10:27:01 UTC 2021, lastUpdateTimeNanos=1051125375100888}
 

НО ПОЗЖЕ ВЫДАЕТ ОШИБКУ НИЖЕ

 diagnostics.logging.SLF4JLogger (SLF4JLogger.java:76) | {} | Exception in monitor thread while connecting to server myac-demo.hn89s.mongodb.net:27017
com.mongodb.MongoSocketException: myac-demo.hn89s.mongodb.net: No address associated with hostname
 

Комментарии:

1. Вы неправильно ввели URI или ваше разрешение DNS не работает.

2.@Oleg Он показывает подключенный при запуске моего сервера, но выдает эту ошибку в конце, Monitor thread successfully connected to server with description ServerDescription{address=myac-demo-shard-00-00.hn89s.mongodb.net:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED НО ПОЗЖЕ ВЫДАЕТ ОШИБКУ НИЖЕ diagnostics.logging.SLF4JLogger (SLF4JLogger.java:76) | {} | Exception in monitor thread while connecting to server myac-demo.hn89s.mongodb.net:27017 com.mongodb.MongoSocketException: myac-demo.hn89s.mongodb.net: No address associated with hostname

3. Вы по-прежнему либо ввели ошибку, либо у вас неисправный dns.