关于Mongodb的“无法从传输连接中读取数据”

1.初步判定是c#官方驱动没能及时释放连接:http://stackoverflow.com/questions/7446528/mongodb-c-sharp-driver-doesnt-release-connections-then-errors

How many connections does each mongos need?
In a sharded configuration will have 1 incoming connection from the client but may need 1 outgoing connection to each shard (possibly mongos times the number of nodes if the shard is backed by a replicaset).
This means that the possible number of open connections that a server requires could be  (1 + (N*M) * C)where N = number of mongos shards, M = number of replicaset nodes, and C = number of client connections.

Why does  mongos never seem to give up connections? 
mongos uses a set of connection pools to communicate to each shard (or shard replicaset node). These pools of connections do not currently
constrict when the number of clients decreases. This will lead to a possibly large number of connections being kept if you have even used the mongos
instance before, even if it is currently not being used. 

How can I see the connections used by mongos 
Run this command on each instance: mongos
db._adminCommand("connPoolStats" ); 

https://jira.mongodb.org/browse/CSHARP-331

2.设置了sockettimeout=300000没能生效:http://www.mongodb.org/display/DOCS/Connections,单位应该是ms,不行的话换sockettimeoutms试试~~

应该就是这个原因了,是sockettimeout的单位是tick,不是毫秒。

 

 

 

3.刚开始全部启动测试时,很有可能崩掉一大片

 

4.    社区给我的答案,没试过

 http://www.mongodb.org/display/DOCS/Troubleshooting#Troubleshooting-Socketerrorsinshardedclustersandreplicasets

 

5.2012-04-11补充,对mongo重新做了些测试,发现有两种情况会导致,一个连接超时,默认是30s,另外一个是连接的关闭,不要轻易调用connect.close

posted @ 2012-02-02 13:21 qoy 阅读(...) 评论(...) 编辑 收藏