Mongodb on air at AWS

Asked

Viewed 28 times

0

I need a help, I did not find anything practical and exact in google, I have a backend with Node and using Mongoose, and I can run site quietly, because in CMD I run the command 'mongod', and my local Mongo is in the air, and I connect by cmd in my Sv in aws, and I only have access to the command line, if I run mongod for sure, but if I close the connection with Sv, it will fall, how do I keep it active all the time? type a pm2 with Node.

  • This might help: https://aws.amazon.com/pt/quickstart/architecture/mongodb/

1 answer

0


You need to start Mongo with the flag --fork. The Fork flag requires another flag to indicate where the logs will be registered (since it will no longer be in the console itself).

Example:

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

Instead of --logpath you can also use the flag --syslog which sends all logs to the operating system itself (this flag does not work in windows).

That way when you disconnect from the instance in AWS Mongo keeps running.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.