Mongo连接池操纵MongoOptions
来源:互联网 发布:河南知春商贸有限公司 编辑:程序博客网 时间:2024/06/08 15:06
MongoOptions
java驱动中,可以在获取mongo实例时,指定一些参数,如下:
ServerAddress serverAddress=new ServerAddress("127.0.0.1",27017);
MongoOptions mongoOptions=new MongoOptions();
Mongo mongo=new Mongo(serverAddress,mongoOptions);
参数列表如下:
#控制系统在发生连接错误时是否重试 ,默以为false --boolean
mongo.options.autoConnectRetry=false
#每个主机答应的连接数(每个主机的连接池大小),当连接池被用光时,会被阻塞住 ,默以为10 --int
mongo.options.connectionsPerHost=10
#multiplier for connectionsPerHost for # of threads that can block if connectionsPerHost is 10, and threadsAllowedToBlockForConnectionMultiplier is 5, then 50 threads can block more than that and an exception will be throw --int
mongo.options.threadsAllowedToBlockForConnectionMultiplier=5
#被阻塞线程从连接池获取连接的最长等待时间(ms) --int
mongo.options.maxWaitTime
#在建立(打开)套接字连接时的超时时间(ms),默以为0(无穷) --int
mongo.options.connectTimeout=0
#套接字超时时间;该值会被传递给Socket.setSoTimeout(int)。默以为0(无穷) --int
mongo.options.socketTimeout=0
#This controls whether or not to have socket keep alive turned on (SO_KEEPALIVE). defaults to false --boolean
mongo.options.socketKeepAlive=false
#Override the DBCallback factory. Default is for the standard Mongo Java driver configuration --DBCallbackFactory
mongo.options.dbCallbackFactory
#//指明是否答应驱动从次要节点或者奴隶节点读取数据,默以为false --boolean
mongo.options.slaveOk=false
#假如为true,驱动每次update后会发出一个getLastError命令来保证成功,默以为false --boolean
mongo.options.safe=false
#If set, the w value of WriteConcern for the connection is set to this. Defaults to 0; implies safe = true --int
mongo.options.w=0
#If set, the wtimeout value of WriteConcern for the connection is set to this. Defaults to 0; implies safe = true --int
mongo.options.wtimeout=0
#Sets the fsync value of WriteConcern for the connection. Defaults to false; implies safe = true --boolean
mongo.options.fsync=false
java驱动中,可以在获取mongo实例时,指定一些参数,如下:
ServerAddress serverAddress=new ServerAddress("127.0.0.1",27017);
MongoOptions mongoOptions=new MongoOptions();
Mongo mongo=new Mongo(serverAddress,mongoOptions);
参数列表如下:
#控制系统在发生连接错误时是否重试 ,默以为false --boolean
mongo.options.autoConnectRetry=false
#每个主机答应的连接数(每个主机的连接池大小),当连接池被用光时,会被阻塞住 ,默以为10 --int
mongo.options.connectionsPerHost=10
#multiplier for connectionsPerHost for # of threads that can block if connectionsPerHost is 10, and threadsAllowedToBlockForConnectionMultiplier is 5, then 50 threads can block more than that and an exception will be throw --int
mongo.options.threadsAllowedToBlockForConnectionMultiplier=5
#被阻塞线程从连接池获取连接的最长等待时间(ms) --int
mongo.options.maxWaitTime
#在建立(打开)套接字连接时的超时时间(ms),默以为0(无穷) --int
mongo.options.connectTimeout=0
#套接字超时时间;该值会被传递给Socket.setSoTimeout(int)。默以为0(无穷) --int
mongo.options.socketTimeout=0
#This controls whether or not to have socket keep alive turned on (SO_KEEPALIVE). defaults to false --boolean
mongo.options.socketKeepAlive=false
#Override the DBCallback factory. Default is for the standard Mongo Java driver configuration --DBCallbackFactory
mongo.options.dbCallbackFactory
#//指明是否答应驱动从次要节点或者奴隶节点读取数据,默以为false --boolean
mongo.options.slaveOk=false
#假如为true,驱动每次update后会发出一个getLastError命令来保证成功,默以为false --boolean
mongo.options.safe=false
#If set, the w value of WriteConcern for the connection is set to this. Defaults to 0; implies safe = true --int
mongo.options.w=0
#If set, the wtimeout value of WriteConcern for the connection is set to this. Defaults to 0; implies safe = true --int
mongo.options.wtimeout=0
#Sets the fsync value of WriteConcern for the connection. Defaults to false; implies safe = true --boolean
mongo.options.fsync=false
0 0
- Mongo连接池操纵MongoOptions
- Mongo连接池操纵MongoOptions
- MongoOptions
- mongo连接池参数
- mongo-java-driver连接池
- mongo 学习二 mongodb shell操纵mongodb
- c++连接mongo数据库。
- mongo 连接出错
- PHP连接mongo
- mongo连接不上
- nodejs连接mongo数据库
- mongo驱动连接
- Spark连接mongo
- mongo入门--java连接mongo数据库
- mongo-java-driver连接mongo集群
- javascript连接并操纵oracle
- Hibernate API操纵连接数据库
- Mongo 脚本连接Replica-set
- 好久没来了
- java.lang.Runtime类
- 关于 Xcode 中 NSAssert() 的用法 ,以及 assert() 与 NDEBUG
- char型注意的问题
- 逆向2048(win8)隐私策略
- Mongo连接池操纵MongoOptions
- QlikView Study Note
- 代码之路开启!干杯^_^
- C++Primer 第五版 3.类设计者的工具
- 关于controller的一些用法
- java多线程之路之线程属性—Core Java学习
- 全过程演示MyEclipse8.5中用JDBC连接Sql Server 2008(二)
- ProgressDialog(四)——改变系统自带ProgressDialog的文字大小
- STL容器和算法的函数表