简体   繁体   中英

mongodb replica set on azure vms - configure to run as a service

I've completed this tutorial and successfully deployed a 3 node replica set. I can connect to it from other hosts and all is good. The question I have is that in the tutorial it states

Start MongoDB

Once the configuration files have been edited, start the database process manual:mongod on each instance by:

    Log on onto the instance

    Run the following command to start the process:

    mongod --config /etc/mongod.conf

    This should start the manual:mongod process

To me this seems as though the replica set is running as a user process and not as a system service as in the command

sudo service mongodb start

So what happens if one of the machines reboots? Is that process dead? How can I configure the whole replica set to run as a service?

On machine reboots, the mongod process will stop and you have to restart it.

In system scripts, I am not sure if on box restarts, mongod restart is automatically taken care of or not. But you can have service scripts for mongod process, which you get automatically, when you install using mongodb apt-get/yum packages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM