MongoDB 单机搭建

2017-11-06 - 2,577 Views - 0 Goods - Nothing

Note:本教程基于Centos 7

MongoDB Download

解压MongoDB程序

新建数据和日志文件夹

设置环境变量


vi ~/.bash_profile


source ~/.bash_profile

编辑MongoDB启动脚本

mongod.service


[Unit]
Description=mongodb
[Unit]
Description=mongodb
[Unit]
Description=mongodb

[Service]
Type=forking
PIDFile=/home/Xesygao/software/MongoDB/data/db/mongod.lock
ExecStart=/home/Xesygao/software/MongoDB/mongodb/bin/mongod --dbpath /home/Xesygao/software/MongoDB/data/db --logpath /home/Xesygao/software/MongoDB/logs/mongodb.logs --logappend --fork
ExecReload=/bin/kill -s HUP MAINPID
ExecStop=/bin/kill -s QUITMAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

启动MongoDB


systemctl start mongod

验证是否启动成功


mongo

转载请注明原文链接:首页 -> 学习记录 -> MongoDB 单机搭建

FuZhou . FuJian

"Never start something you're not willing to finish"