# Ubuntu upstart file at /etc/init/mongodb.conflimit nofile 20000 20000kill timeout 300 # wait 300s between SIGTERM and SIGKILL.pre-start script mkdir -p /var/lib/mongodb/ mkdir -p /var/log/mongodb/end scriptstart 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; fiend script
如果我想运行一个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.conflimit nofile 20000 20000kill timeout 300 # wait 300s between SIGTERM and SIGKILL.pre-start script mkdir -p /var/lib/mongodb2/ mkdir -p /var/log/mongodb2/end scriptstart 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; fiend script解决方法 我不能让“标准”的起步脚本工作(如上所述),所以我改变了这样:
# Ubuntu upstart file at /etc/init/mongodb.conflimit nofile 20000 20000kill timeout 300 # wait 300s between SIGTERM and SIGKILL.pre-start script mkdir -p /var/lib/mongodb/ mkdir -p /var/log/mongodb/end scriptstart on runlevel [2345]stop on runlevel [06]script exec sudo -u mongodb /usr/bin/mongod --config /etc/mongodb.confend script
并且如果要运行mongodb的其他实例,只需复制* .conf文件并对/etc/mongodb2.conf和/etc/init/mongodb2.conf进行更改
# Ubuntu upstart file at /etc/init/mongodb2.conflimit nofile 20000 20000kill timeout 300 # wait 300s between SIGTERM and SIGKILL.pre-start script mkdir -p /var/lib/mongodb2/ mkdir -p /var/log/mongodb2/end scriptstart on runlevel [2345]stop on runlevel [06]script exec sudo -u mongodb /usr/bin/mongod --config /etc/mongodb2.confend script
我认为唯一不起作用的是重新启动mongodb – 你必须停止然后重新开始
总结以上是内存溢出为你收集整理的linux – ubuntu:启动(upstart)mongodb的第二个实例全部内容,希望文章能够帮你解决linux – ubuntu:启动(upstart)mongodb的第二个实例所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)