启动单机版Mongo
创建Mongo路径
mkdir -p /usr/local/mongo/data/db
mkdir -p /usr/local/mongo/data/logs
一、设置dba
1. /usr/local/mongo/mongodb/bin/mongod --dbpath=/usr/local/mongo/data/db/ --logpath=/usr/local/mongo/data/logs/mongo.log --logappend --port=27000 --fork
2. /usr/local/mongo/mongodb/bin/mongo 192.XXX.X.X:27000
3. 在Mongo Shell 中 切换 use admin 配置dba帐号 db.createUser({user:"admin",pwd:"admin",roles:[{role:"userAdminAnyDatabase",db:"admin"}]})
4. killall mongod
5. 重新启动服务
/usr/local/mongo/mongodb/bin/mongod --dbpath=/usr/local/mongo/data/db/ --logpath=/usr/local/mongo/data/logs/mongo.log --logappend --port=27000 --fork --auth
6. /usr/local/mongo/mongodb/bin/mongo 192.XXX.X.X:27000 -u "admin" -p "admin" --authenticationDatabase admin
====================================华丽的分割线========================================
未完待续......
网友评论