Timeout while running "replSetInitiate" command from csharp application

0

I am spinning up a single node replica set from a csharp application. However the driver throws timeout exception when trying to "replSetInitiate" the replica set. Any thoughts as to what is wrong would be greatly appreciated. Thank you!

//Spinning up a single node replica test

mongodb-win32-x86_64-2008plus-ssl-4.0.2\bin\mongod --sslMode disabled --dbpath "C:\Users\foobar\AppData\Local\Temp\sj5ufivo.hgy" --port 27017  --bind_ip 127.0.0.1 --replSet singleNodeReplSet

//Code to initiate replica set

MongoClient client = new MongoClient("mongodb://127.0.0.1:{0}/?replicaSet=singleNodeReplSet".Formatted(port));
var admin = client.GetDatabase("admin");
var commandDocument = new BsonDocument("replSetInitiate", new BsonDocument());
var replSet = admin.RunCommand<BsonDocument>(commandDocument);

//Exception

System.TimeoutException
  HResult=0x80131505
  Message=A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Connected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "127.0.0.1:27017" }", EndPoint: "127.0.0.1:27017", State: "Connected", Type: "ReplicaSetGhost", WireVersionRange: "[0, 7]" }] }.
  Source=MongoDB.Driver.Core
  StackTrace:
   at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)
   at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)
   at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelection(CancellationToken cancellationToken)
   at MongoDB.Driver.MongoClient.AreSessionsSupported(CancellationToken cancellationToken)
   at MongoDB.Driver.OperationExecutor.StartImplicitSession(CancellationToken cancellationToken)
   at MongoDB.Driver.MongoDatabaseImpl.UsingImplicitSession[TResult](Func`2 func, CancellationToken cancellationToken)
mongodb
mongodb-.net-driver
mongodb-replica-set
asked on Stack Overflow Sep 21, 2018 by GBackMania

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0