當前位置:
首頁 >
Mongodb~Linux环境下的部署~服务的部署与自动化
發布時間:2025/3/19
27
豆豆
生活随笔
收集整理的這篇文章主要介紹了
Mongodb~Linux环境下的部署~服务的部署与自动化
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<mongodb在linux上的部署>
事實上redis安裝程序挺好,直接幫我們生成了服務,直接可以使用systemctl去啟動它,而mongodb在這方面沒有那么智能,需要我們去編寫自己的服務腳本了,然后把它加到開機自啟動里面就可以了,主要的過程分為以下幾個步驟:
mongodb我安裝在了/root/tools目錄下
一 配置文件,ANSI,記事本編寫,UTF8可能有問題
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二 服務文件,文件位于:/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三 服務命令
#文件權限 chmod 754 mongodb.service #啟動服務 systemctl start mongodb.service #關閉服務 systemctl stop mongodb.service #開機啟動 systemctl enable mongodb.service這你幾步之后,我們的mongodb服務就做好了!
感謝各位閱讀!
轉載于:https://www.cnblogs.com/lori/p/7145114.html
總結
以上是生活随笔為你收集整理的Mongodb~Linux环境下的部署~服务的部署与自动化的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 从0到1再到100
- 下一篇: 20170710L07-09-03老男孩