mongodb/mongo — pull request #234 by lockmind (2012-06-07 05:38:44+00:00)
Title: mongo in cloud *add some new feature to mongodb which is used in cloud environment*

mongo in cloud *add some new feature to mongodb which is used in cloud environment*

add new db feaure and limitation now!!!
[limitation] not allow user to change db when login (except admin user)
[limitation] local user can use username 'cds' and any password to login
[limitation]we use namespace '$db.systemlimit.*',which could not be written,only can be read by user (except admin user)
[limitation]only login db user can allocte more then one db file
[limitation] new feature is tested on linux system and work on replicaset and single mongod mode.

[feature]each db ip white table
[usage]
(1) admin user login
(2) use $userdb
(3) db.systemlimit.whiteip.save({"ip":$ip,"value":$value})
[example]
(1) use admin
(2) db.auth('sa','sa')
(3) use test
(4) db.systemlimit.whiteip.save({"value":"11000000101010000000101111011000","ip":"192.168.11.216/32"});
$ip is a string which user's white ip,written in the normal fomat like (***,***,***,***/**)
$value is a string which is no more than 32 length,and only contain '0' and '1',which is another performace of ip.
[feature]each db data file num limit
[usage]
(1) admin user login
(2) use $userdb
(3) db.systemlimit.maxfilenum.save({"_id":"limit","value":$value})
[example]
(1) use admin
(2) db.auth('sa','sa')
(3) use test
(4) db.systemlimit.maxfilenum.save({"_id":"limit","value":2})
$value is a positive number,which can limit dbfile num. which is also mean limit db total size.when db need to allocte file more then $value,db will throw "quota exceed" exception
[feature]each db connection num limit
[usage]
(1) admin user login
(2) use $userdb
(3) db.systemlimit.dbmaxconn.save({ "_id" : "limit", "value" : $value })
[example]
(1) use admin
(2) db.auth('sa','sa')
(3) use test
(4) db.systemlimit.dbmaxconn.save({ "_id" : "limit", "value" : 3 })
$value is a positive number,which can limit each db's connection number. 3 means only 3 connection is allowed.more than 3 will be refused by mongo server when login.
[feature]eacho connection cpu cost limit
[usage]
(1) admin user login
(2) use $userdb
(3) db.systemlimit.maxcpucost.save({ "_id" : "limit", "time_priod" : $time , "cpu_cost" : $cost})
[example]
(1) use admin
(2) db.auth('sa','sa')
(3) use test
(4) db.systemlimit.maxcpucost.save({ "_id" : "limit", "time_priod" : 10 , "cpu_cost" : 8})

$time and $cost mean that in a $time priod,when cpu cost more than $cost , the connection will sleep for a while , this make each connection use cpu fairness,sleep time <= time_priod-cpu_cost