大佬教程收集整理的这篇文章主要介绍了linux – ubuntu:启动(upstart)mongodb的第二个实例,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
# Ubuntu upstart file at /etc/init/mongodb.conf limit nofile 20000 20000 kill timeout 300 # wait 300s between SIGTERM and SIGKILl. pre-start script mkdir -p /var/lib/mongodb/ mkdir -p /var/log/mongodb/ end script start on runlevel [2345] stop on runlevel [06] script ENABLE_MONGODB="yes" if [ -f /etc/default/mongodb ]; then . /etc/default/mongodb; fi if [ "x$ENABLE_MONGODB" = "xyes" ]; then exec start-stop-daemon --start --quiet --chuid mongodb --exec /usr/bin/mongod -- --config /etc/mongodb.conf; fi end script
如果我想运行@L_336_2@mongod的第二个实例,我以为我只是复制/etc/mongodb.conf – > /etc/mongodb2.conf和/etc/init/mongodb.conf – > /etc/init/mongodb2.conf并更改第一个conf文件中的std端口.然后调整上面的脚本,以新创建的/etc/mongodb2.conf开头.
然后我可以说开始mongodb2,服务开始…但是在启动后就被杀死了.我改变了什么,让两个进程都运行起来?
# Ubuntu upstart file at /etc/init/mongodb2.conf limit nofile 20000 20000 kill timeout 300 # wait 300s between SIGTERM and SIGKILl. pre-start script mkdir -p /var/lib/mongodb2/ mkdir -p /var/log/mongodb2/ end script start on runlevel [2345] stop on runlevel [06] script ENABLE_MONGODB="yes" if [ -f /etc/default/mongodb ]; then . /etc/default/mongodb; fi if [ "x$ENABLE_MONGODB" = "xyes" ]; then exec start-stop-daemon --start --quiet --chuid mongodb --exec /usr/bin/mongod -- --config /etc/mongodb2.conf; fi end script
# Ubuntu upstart file at /etc/init/mongodb.conf limit nofile 20000 20000 kill timeout 300 # wait 300s between SIGTERM and SIGKILl. pre-start script mkdir -p /var/lib/mongodb/ mkdir -p /var/log/mongodb/ end script start on runlevel [2345] stop on runlevel [06] script exec sudo -u mongodb /usr/bin/mongod --config /etc/mongodb.conf end script
并且如果要运行mongodb的其他实例,只需复制* .conf文件并对/etc/mongodb2.conf和/etc/init/mongodb2.conf进行更改
# Ubuntu upstart file at /etc/init/mongodb2.conf limit nofile 20000 20000 kill timeout 300 # wait 300s between SIGTERM and SIGKILl. pre-start script mkdir -p /var/lib/mongodb2/ mkdir -p /var/log/mongodb2/ end script start on runlevel [2345] stop on runlevel [06] script exec sudo -u mongodb /usr/bin/mongod --config /etc/mongodb2.conf end script
以上是大佬教程为你收集整理的linux – ubuntu:启动(upstart)mongodb的第二个实例全部内容,希望文章能够帮你解决linux – ubuntu:启动(upstart)mongodb的第二个实例所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。