美文网首页
Cent OS 安装与使用 mongodb

Cent OS 安装与使用 mongodb

作者: 静候那一米阳光 | 来源:发表于2017-06-23 18:13 被阅读0次

官方教程

yum安装

创建配置文件

vi /etc/yum.repos.d/mongodb-org-3.4.repo

写入

[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc

安装

sudo yum install -y mongodb-org

启动

service mongod start

停止

service mongod stop

重启

service mongod restart

开机自启动

chkconfig mongod on

进入mongo命令行

mongo
//执行操作。。。
> show dbs
admin  0.000GB
local  0.000GB
> use zdy
switched to db zdy
> db.col.insert({"name":"zdy"})
WriteResult({ "nInserted" : 1 })
> db.col.find()
{ "_id" : ObjectId("594a434f3994f298e2f1234c"), "name" : "zdy" }

相关文章

网友评论

      本文标题: Cent OS 安装与使用 mongodb

      本文链接:https://www.haomeiwen.com/subject/uboccxtx.html