如何让mongo在远程服务器上运行?

时间:2021-08-14 00:31:45

When running mongo on a remote aws server (ubuntu) what is the best way to keep a mongo instance running after sshing to it to start it?

在远程aws服务器(ubuntu)上运行mongo时,让一个mongo实例在启动后运行的最佳方式是什么?

5 个解决方案

#1


22  

Take a look here. In short, you should use mongod --fork --logpath /var/log/mongod.log

看看这里。简而言之,您应该使用mongod—fork—logpath /var/log/mongod.log

#2


7  

Start it as a service. Here's the command

以服务的形式开始。这是命令

sudo service mongod start

sudo服务mongod开始

#3


1  

You should be able to use the auto-generated init script if you installed the -10gen distro: http://www.mkyong.com/mongodb/how-to-install-mongodb-on-ubuntu/

如果安装了-10gen发行版:http://www.mkyong.com/mongodb/how-to-install-mongodb-on-ubuntu/,您应该能够使用自动生成的init脚本

#4


1  

You can use screen too for this purpose.

您也可以为此目的使用screen。

First execute the command

第一次执行命令

screen

Then run your server using

然后使用

mongod --dbpath=/example/dbpath

Then detach it by pressing ctrl+a and then pressing d

然后按ctrl+a再按d将其分离

#5


0  

The MongoDB documentation has two useful links

MongoDB文档有两个有用的链接

Installing on Ubuntu

在Ubuntu安装

http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages

http://www.mongodb.org/display/DOCS/Ubuntu +和+ Debian包

Starting and stopping MongoDB

启动和停止MongoDB

http://www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo

http://www.mongodb.org/display/DOCS/Starting +和+停止+ Mongo

You need to use the --fork and --log parameters to detach the process from the ssh login.

您需要使用-fork和-log参数从ssh登录中分离进程。

#1


22  

Take a look here. In short, you should use mongod --fork --logpath /var/log/mongod.log

看看这里。简而言之,您应该使用mongod—fork—logpath /var/log/mongod.log

#2


7  

Start it as a service. Here's the command

以服务的形式开始。这是命令

sudo service mongod start

sudo服务mongod开始

#3


1  

You should be able to use the auto-generated init script if you installed the -10gen distro: http://www.mkyong.com/mongodb/how-to-install-mongodb-on-ubuntu/

如果安装了-10gen发行版:http://www.mkyong.com/mongodb/how-to-install-mongodb-on-ubuntu/,您应该能够使用自动生成的init脚本

#4


1  

You can use screen too for this purpose.

您也可以为此目的使用screen。

First execute the command

第一次执行命令

screen

Then run your server using

然后使用

mongod --dbpath=/example/dbpath

Then detach it by pressing ctrl+a and then pressing d

然后按ctrl+a再按d将其分离

#5


0  

The MongoDB documentation has two useful links

MongoDB文档有两个有用的链接

Installing on Ubuntu

在Ubuntu安装

http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages

http://www.mongodb.org/display/DOCS/Ubuntu +和+ Debian包

Starting and stopping MongoDB

启动和停止MongoDB

http://www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo

http://www.mongodb.org/display/DOCS/Starting +和+停止+ Mongo

You need to use the --fork and --log parameters to detach the process from the ssh login.

您需要使用-fork和-log参数从ssh登录中分离进程。