I have to install mongodb version 2.4.9 according to project requirement. But I can't start the mongodb service after installing. The error is as follow.
systemctl status mongodb.service
● mongodb.service
Loaded: loaded (/etc/init.d/mongodb; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since ဟူး 2018-03-28 22:04:36 +0630; 28s ago
Docs: man:systemd-sysv-generator(8)
Process: 31482 ExecStart=/etc/init.d/mongodb start (code=exited, status=1/FAILURE)
မတ် 28 22:04:36 ubuntu mongodb[31482]: Rather than invoking init scripts through /etc/init.d, use the service(8)
မတ် 28 22:04:36 ubuntu mongodb[31482]: utility, e.g. service mongodb start
မတ် 28 22:04:36 ubuntu mongodb[31482]: initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
မတ် 28 22:04:36 ubuntu mongodb[31482]: Since the script you are attempting to invoke has been converted to an
မတ် 28 22:04:36 ubuntu mongodb[31482]: Upstart job, you may also use the start(8) utility, e.g. start mongodb
မတ် 28 22:04:36 ubuntu mongodb[31482]: start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
မတ် 28 22:04:36 ubuntu systemd[1]: mongodb.service: Control process exited, code=exited status=1
မတ် 28 22:04:36 ubuntu systemd[1]: Failed to start mongodb.service.
မတ် 28 22:04:36 ubuntu systemd[1]: mongodb.service: Unit entered failed state.
မတ် 28 22:04:36 ubuntu systemd[1]: mongodb.service: Failed with result 'exit-code'.
Please..
Because sudo -u mongodb /usr/bin/mongod -f /etc/mongodb.conf starts mongod as it should be, there must be something wrong at /etc/init.d/monngodb -script...
Related
I currently have MongoDB 4.4 installed, as my system does not support 5.0. I have previously had 4.4 installed on Arch Linux, however when I moved over to Ubuntu and tried to run mongod, I get this result from systemd:
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: signal) since Fri 2021-12-10 15:57:00 CST; 2min 3s ago
Docs: https://docs.mongodb.org/manual
Process: 4369 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=killed, signal=ILL)
Main PID: 4369 (code=killed, signal=ILL)
Dec 10 15:57:00 system systemd[1]: Started MongoDB Database Server.
Dec 10 15:57:00 system systemd[1]: mongod.service: Main process exited, code=killed, status=4/ILL
Dec 10 15:57:00 system systemd[1]: mongod.service: Failed with result 'signal'.
MongoDB fails before logs can be created.
While this doesn't completely solve the issue, I'm fine with this resolution:
For whatever reason, 4.2 works fine, but 4.4 doesn't, even though I was completely fine running 4.4 on Arch.
I installed Mongodb 4.4.1 following the documentation of the mongodb site. installation was smooth. But when I am checking the status of the mongod service, I am getting an error as below:
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2020-09-16 22:22:23 IST; 6s ago
Docs: https://docs.mongodb.org/manual
Process: 36655 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, stat> Main PID: 36655 (code=exited, status=14)
Sep 16 22:22:22 Ubuntu-PC systemd[1]: Started MongoDB Database Server.
Sep 16 22:22:23 Ubuntu-PC systemd[1]: mongod.service: Main process
exited, code=exited, s> Sep 16 22:22:23 Ubuntu-PC systemd[1]:
mongod.service: Failed with result 'exit-code'.
Even when I try to open mongo shell typing mongo, I get the following error:
MongoDB shell version v4.4.1 connecting to:
mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt
failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused
by :: Connection refused : connect#src/mongo/shell/mongo.js:374:17
#(connect):2:6 exception: connect failed exiting with code 1
The service is showing as started and enabled. Pleas help. Where have I done the mistake. Thanks in advance.
Try this:
service mongod stop
systemctl start mongod
To start using MongoDB:
mongo
I installed MongoDB on the Ruspberry pi desktop on a VM, then I started it with the following command:
sudo service mongod start
The result of this command is the following:
systemctl list-unit-files --state enabled
mongodb.service enabled
Then when I check the status using
sudo service mongod status
The other issue is that there´s no .sock file in my /tmp folder.
PS: I removed MongoDB and reinstalled it trying to fix the issue but I always get the same problem.
Can anyone help me please?
Thank you in advance.
I get the following error:
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-06-08 12:33:17 CEST; 3s ago
Docs: https://docs.mongodb.org/manual
Process: 22168 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=203/EXEC)
Main PID: 22168 (code=exited, status=203/EXEC)
Jun 08 12:33:17 raspberry systemd[1]: Started MongoDB Database Server.
Jun 08 12:33:17 raspberry systemd[22168]: mongod.service: Failed to execute command: Exec format error
Jun 08 12:33:17 raspberry systemd[22168]: mongod.service: Failed at step EXEC spawning /usr/bin/mongod: Exec format error
Jun 08 12:33:17 raspberry systemd[1]: mongod.service: Main process exited, code=exited, status=203/EXEC
Jun 08 12:33:17 raspberry systemd[1]: mongod.service: Failed with result 'exit-code'.```
command mongo gives the interactive shell on command but when this command is executed as sudo systemctl enable mongod.service, it gives following output.
Failed to enable unit: Unit file mongod.service does not exist.
I am using ubuntu 17 machine.
also sudo systemctl start mongodb doesn't give any output.
on running sudo service mongodb status
it gives output as
● mongodb.service - An object/document-oriented database
Loaded: loaded (/lib/systemd/system/mongodb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2018-02-15 23:08:02 IST; 1min 37s ago
Docs: man:mongod(1)
Process: 19137 ExecStart=/usr/bin/mongod --unixSocketPrefix=${SOCKETPATH} --config ${CONF} $DAEMON_OPTS (code=exited, status=100)
Main PID: 19137 (code=exited, status=100)
Feb 15 23:08:02 gd systemd[1]: Started An object/document-oriented database.
Feb 15 23:08:02 gd systemd[1]: mongodb.service: Main process exited, code=exited, status=100/n/a
Feb 15 23:08:02 gd systemd[1]: mongodb.service: Unit entered failed state.
Feb 15 23:08:02 gd systemd[1]: mongodb.service: Failed with result 'exit-code'.
how can I solve this problem?
Your mongo service is called mongodb, pretty sure it should called mongod like you tried! Similar question here.
If your service is called mongodb you could so try:
sudo systemctl enable mongodb.service
When starting a service it wont give you any output and just returns back to the prompt. You can use systemctl status like you’ve done or you look st journalctl
If you’re using systemctl then you can check the service status by running:
sudo systemctl status mongodb.service
I have installed with the help of following link: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04
It was working fine by default. But when I change data directory in /etc/mongod.conf
#From
dbPath: /var/lib/mongodb
#To
dbPath: /media/user/'Mounted Volume'/mongodb_data
I am unable to start MongoDB. Following is the error message
$mongo
MongoDB shell version: 3.2.11
connecting to: test
2017-01-06T00:57:01.472+0530 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2017-01-06T00:57:01.472+0530 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:229:14
#(connect):1:6
exception: connect failed
Following is the status
$ sudo systemctl status mongodb
mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset:
Active: failed (Result: exit-code) since Fri 2017-01-06 00:56:40 IST; 7s ago
Process: 5735 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (cod
Main PID: 5735 (code=exited, status=100)
Jan 06 00:56:40 GL552VW systemd[1]: Started High-performance, schema-free docume
Jan 06 00:56:40 GL552VW systemd[1]: mongodb.service: Main process exited, code=e
Jan 06 00:56:40 GL552VW systemd[1]: mongodb.service: Unit entered failed state.
Jan 06 00:56:40 GL552VW systemd[1]: mongodb.service: Failed with result 'exit-co
I am new to MongoDB. Maybe I am missing something very simple.
From the MongoDB config file documentation page
The Linux package init scripts included in the official MongoDB packages depend on specific values for systemLog.path, storage.dbpath, and processManagement.fork. If you modify these settings in the default configuration file, mongod may not start.
So if you modify these properties in the configuration file, you most probably have to write a new init script.