Reputation: 11
I have a mongodb replica set hosted in a VM wjth Windows Server 2012 R2 on the Azure platform, my problem is that when I'm trying to insert data from an external client using the C# driver or even consulting them from a GUI client (mongoVUE, robomongo ...) I often get the following exception which permanently locks the program (even trying a Server.reconnect() does not resolve).
No such host is known
Type: System.Net.Sockets.SocketException
Stack: at System.Net.Dns.GetAddrInfo(String name)
at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
at MongoDB.Driver.MongoServerAddress.ToIPEndPoint(AddressFamily addressFamily)
at MongoDB.Driver.MongoServerInstance.GetIPEndPoint()
I've tried setting:
MongoDefaults.SocketTimeout = TimeSpan.FromMinutes(5);
MongoDefaults.ConnectTimeout = TimeSpan.FromMinutes(5);
MongoDefaults.MaxConnectionIdleTime = TimeSpan.FromMinutes(5);
putting an hardcoded public IP address of the server in the connection string and testing it from different locations but it seems that something on the server blocking connections.
Has anyone any idea how I can fix it?
Upvotes: 0
Views: 1939
Reputation: 11
I solved!The problem was that I started mongodb with a single replica set that's not configured correctly, removing the option --replset when starting mongod all works correctly.
Upvotes: 1