Mongodb~Linux环境下的部署~服务的部署与自动化
生活随笔
收集整理的這篇文章主要介紹了
Mongodb~Linux环境下的部署~服务的部署与自动化
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
<mongodb在linux上的部署>
事實(shí)上redis安裝程序挺好,直接幫我們生成了服務(wù),直接可以使用systemctl去啟動(dòng)它,而mongodb在這方面沒(méi)有那么智能,需要我們?nèi)ゾ帉懽约旱姆?wù)腳本了,然后把它加到開機(jī)自啟動(dòng)里面就可以了,主要的過(guò)程分為以下幾個(gè)步驟:
mongodb我安裝在了/root/tools目錄下
一 配置文件,ANSI,記事本編寫,UTF8可能有問(wèn)題
dbpath=/root/tools/mongodb-linux-x86_64-amazon-3.4.2/db logpath=/root/tools/mongodb-linux-x86_64-amazon-3.4.2/log/mongo.log logappend=true port=27017 fork=true nohttpinterface=true auth=false二 服務(wù)文件,文件位于:/usr/lib/systemd/system
[Unit] Description=mongodb After=network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/root/tools/mongodb-linux-x86_64-amazon-3.4.2/bin/mongod --config /root/tools/mongodb-linux-x86_64-amazon-3.4.2/bin/mongodb.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/root/tools/mongodb-linux-x86_64-amazon-3.4.2/bin/mongod --shutdown --config /root/tools/mongodb-linux-x86_64-amazon-3.4.2/bin/mongodb.conf PrivateTmp=true [Install] WantedBy=multi-user.target三 服務(wù)命令
#文件權(quán)限 chmod 754 mongodb.service #啟動(dòng)服務(wù) systemctl start mongodb.service #關(guān)閉服務(wù) systemctl stop mongodb.service #開機(jī)啟動(dòng) systemctl enable mongodb.service這你幾步之后,我們的mongodb服務(wù)就做好了!
感謝各位閱讀!
轉(zhuǎn)載于:https://www.cnblogs.com/lori/p/7145114.html
總結(jié)
以上是生活随笔為你收集整理的Mongodb~Linux环境下的部署~服务的部署与自动化的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 从0到1再到100
- 下一篇: 智能的定义是什么?如何正确理解智能家居?