MongoDB --- Failed global initialization: Failed to open "/var/log/mongodb/mongod-config.log"
So, I have figured out my own question.
Firstly, the issue was that since I was using a different port 27019 for the config servers, I needed to open that port from the firewall.
Second, I changed the dbPath in my config file from /var/lib/mongodb
to /data/db
since that is the default path for mongodb to store data.
Make sure to run sudo service mongod restart
after.
With that done, I was able to start mongod with my specific config file:
sudo mongod --config <path-to-config-file>
The key is to include sudo
for me. That solved the issue of:
F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open
"/var/log/mongodb/mongod-config.log"
After running the command, I see that mongod has started on my virtual machine (vm) and now I am able to connect to the mongo shell of said vm from another machine with:
mongo <ip_address_of_said_vm>:27019