~/mongodb-linux-i686-static-1.6.5/bin/mongo 127.0.0.1:6689 ### 在Slaver上創(chuàng)建帳號(hào)
> use local
switched to db local
> db.addUser('hrj','xxx')
{
"_id" : ObjectId("4d6f6527013fcbcc74575c20"),
"user" : "hrj",
"readOnly" : false,
"pwd" : "b27edaa5a8858aa3d46b60698fce1359"
}
~/mongodb-linux-i686-static-1.6.5/bin/mongo 127.0.0.1:6688 ### 在Master上創(chuàng)建帳號(hào)
MongoDB shell version: 1.6.5
connecting to: 127.0.0.1:6688/test
>use local
switched to db local
> db.addUser('hrj','xxx')
{
"_id" : ObjectId("4d6f6527013fcbcc74575c20"),
"user" : "hrj",
"readOnly" : false,
"pwd" : "b27edaa5a8858aa3d46b60698fce1359"
}
>use test ###添加帳號(hào)認(rèn)證
switched to db local
> db.auth('hrj','xxx')