CSHARP-349

Dear ratam:

    I write the information about the problem with richTextFormat:

     I am developing a GUI for MongoDB with your C# Driver.

      I create a environment to simulate Replset:

 

复制代码
Shard1:
cd C:\runmongo\bin
mongod --shardsvr  --port 10001 --dbpath  C:\mongodb\shard1 --replSet set1 --rest 

Shard2:
cd C:\runmongo\bin
mongod --shardsvr  --port 10002 --dbpath  C:\mongodb\shard2 --replSet set1 --rest 

Shard3:
cd C:\runmongo\bin
mongod --shardsvr  --port 20001 --dbpath  C:\mongodb\shard3 --replSet set2 --rest 

Shard4:
cd C:\runmongo\bin
mongod --shardsvr  --port 20002 --dbpath  C:\mongodb\shard4 --replSet set2 --rest 

Config:
cd C:\runmongo\bin
mongod --configsvr --port 30001 --dbpath  C:\mongodb\config1 --rest 


Route:
cd C:\runmongo\bin
mongos --configdb localhost:30001
复制代码

     I Create 2 Sets of ReplSet.

     I think the relpsetname is a property of MongoSrv,So when a new mongosvr is register to system,
the replsetName is save in config file.
    Now I user MongoSetting to create MongoService Instance:

                    if (config.ReplSetName != string.Empty)
                    {
                        mongoSvrSetting.ReplicaSetName = config.ReplSetName;
                    }
                    MongoServer masterMongoSvr = new MongoServer(mongoSvrSetting);
                    _mongoSrvLst.Add(config.HostName, masterMongoSvr);


Then when I want to get ReplicaSetName, it is always null.
I have initReplset with replSetInitiate command.

 
By the way,ConnectionMode is setting with Direct (I have tried with ReplSet,but the replsetname is still null)

                    mongoSvrSetting.ConnectionMode = ConnectionMode.Direct;
                    mongoSvrSetting.SlaveOk = config.IsSlaveOk;

 

 

 


posted @   灰毛毛  阅读(361)  评论(0编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
点击右上角即可分享
微信分享提示