MongoDB on the air at AWS

0

I need a help, I did not find anything practical and accurate in google, I have a node backend and using mongoose, and I can run locally quietly, because in CMD I execute the command 'mongod', and my mongo local is in the air, and I connect by cmd on my sv in aws, and I only have access to the command line, if I run 'mongod' right, but if I close the connection with sv, it will drop, he active all the time? type a pm2 with node.

    
asked by anonymous 22.03.2018 / 14:50

1 answer

0

You need to start mongo with the --fork flag. The fork flag requires another flag to indicate where the logs will be logged (since it will no longer be on the console itself).

Example:

mongod --fork --logpath /var/log/mongod.log

Instead of --logpath you can also use the --syslog flag that sends all logs to the operating system's own log system (this flag does not work on windows).

This way when you disconnect from the instance in AWS the mongo keeps rolling.

    
23.03.2018 / 00:18