MongoDB 3.4.10 学习笔记

启动单机版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

====================================华丽的分割线========================================

未完待续......

你可能感兴趣的:(MongoDB 3.4.10 学习笔记)