Mongodb and mongod, which to choose for web app

Hi,
On my 1st (original) Ubuntu 20.04 Dev Server I have Mongodb installed and use nodejs to provide a web application.

I now want to create a fresh server (2nd server) installed Mongodb using this guide : https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu and all went well.

However, the two server use different commands to start, stop etc and I don’t understand why ? Is it related to one being a daemon and the other being a DB ?
1st server - MongoDB shell version v3.6.8
systemctl start mongodb

root@ubuntu-s-1vcpu01:/# systemctl status mongodb
● mongodb.service - An object/document-oriented database
Loaded: loaded (/lib/systemd/system/mongodb.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-08-05 19:54:47 UTC; 53min ago
Docs: man:mongod(1)
Main PID: 1250559 (mongod)
Tasks: 26 (limit: 1137)
Memory: 133.5M
CGroup: /system.slice/mongodb.service
└─1250559 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf

2nd server - MongoDB shell version v4.4.0
systemctl start mongod (no ‘b’ at end of command)

root@ubuntu1:~# systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2020-08-05 20:45:54 UTC; 21s ago
Docs: https://docs.mongodb.org/manual
Main PID: 36251 (mongod)
Memory: 162.6M
CGroup: /system.slice/mongod.service
└─36251 /usr/bin/mongod --config /etc/mongod.conf

Thanks

Hi @Jon_C,

The difference is that your 3.6 install was created using Ubuntu’s MongoDB package, while your 4.4 install is using the official mongodb-org package.

Both are service definitions for managing mongod processes, but Ubuntu named their service after the product while the official packages name the service after the mongod binary. The Ubuntu packages are older MongoDB releases with a few different configuration defaults (service name and config file path) from the MongoDB documentation.

I recommend installing the official packages to get the latest release versions and support. Attempted installation of the two different packages should conflict since both provide mongod, so I suspect your mongodb.service definition remained from a previous installation that was removed.

Regards,
Stennie

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.