centos7 下安装mongodb指南;
1.下载:https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.4.1.tgz;
2.解压缩;
3.文件存储在mongodb文件夹下面,再新建:
3.1 mongodb\data\db;
3.2 mongodb\logs
4.ps aux |grep mongodb
2017-02-14T15:59:04.556+0800 I CONTROL [initandlisten]
> show dbs;
admin 0.000GB
local 0.000GB
> use ****
switched to db ****
> db.movies.insert({'abc':"abc"});
WriteResult({ "nInserted" : 1 })
> db.createUser({user:'****',pwd:'****',roles:[{role:'dbOwner',db:'*****'}]})
Successfully added user: {
"user" : "****",
"roles" : [
{
"role" : "dbOwner",
"db" : "****"
}
]
}
>
> show dbs;
admin 0.000GB
local 0.000GB
> use ****
switched to db ****
> db.movies.insert({'abc':"abc"});
WriteResult({ "nInserted" : 1 })
> db.createUser({user:'****',pwd:'****',roles:[{role:'dbOwner',db:'*****'}]})
Successfully added user: {
"user" : "****",
"roles" : [
{
"role" : "dbOwner",
"db" : "****"
}
]
}
>
posted on 2017-02-23 16:37 maomingchao 阅读(123) 评论(0) 编辑 收藏 举报