CentOS 部署 MongoDB(新)

step1、进入到/opt/下执行 下载

wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.6.5.tgz

step2、解压

tar -zxvf mongodb-linux-x86_64-rhel70-3.6.5.tgz

step3、重命名

mv mongodb-linux-x86_64-rhel70-3.6.5.tgz  mongodb3.6

step4、创建目录


 
创建data目录和logs目录

step5、进入到MongoDB安装目录的bin目录,创建mongodb.conf文件

vim /opt/mongodb3.6/bin/mongodb.conf

配置文件如下

dbpath = /opt/mongodb3.6/data #数据文件存放目录
logpath = /opt/mongodb3.6/logs/mongodb.log #日志文件存放目录
port = 27017  #端口
fork = true  #以守护程序的方式启用,即在后台运行
# nohttpinterface = true  这个配置需要去掉,不然会出现一个如下错误
# Error parsing INI config file: unrecognised option 'nohttpinterface'
auth=true
bind_ip=0.0.0.0

step6、启动——进入bin目录下

./mongod -f ./mongodb.conf

step7、查看是否启动成功

ps -ef|grep mongodb
 
启动成功

作者:小宋_ed76
链接:https://www.jianshu.com/p/0eafa1e68995
来源:简书
posted @ 2019-11-11 15:02  Redchar  阅读(346)  评论(0编辑  收藏  举报