After connecting to the server remotely, start the mongodb service on the server. How can the service still run after disconnecting from the remote connection?
Use mongod -f plus setting fork=true in the configuration file to run in the background.
My mongo profile is in /data/mongo/27017.confPort=27017 # port number Fork=true # runs as a daemon, creating a server process Master=true # Set as Master Server in Single Master-Slave Configuration #salve=true ## Set as Slave in Single Master-Slave Configuration Log path =/data/mongo/27017/mongo.log # log output file path Logappend=true # log output method Dbpath=/data/mongo/27017 # database path #replSet=testrs # sets the name of the rich set #shardsvr=true # sets whether to slice Auth=true# whether to open the license
Just run the command mongod-f/data/mongo/27017.conf.