Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the status of mongo throw me (code = exited, status = 48)?

I am experiencing extreme slowness with mongo. Earlier when I put sudo systemctl status mongodb mongo I appeared Online and in green. Now after a few days he started to throw me away

 mongodb.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2019-11-29 08:55:07 -03; 3 days ago
  Process: 13231 ExecStart = / usr / bin / mongod --quiet --config /etc/mongod.conf (code = exited, status = 48)
 Main PID: 13231 (code = exited, status = 48)

Nov 29 08:55:07 production-power systemd [1]: Started High-performance, schema-free document-oriented database.
Nov 29 08:55:07 production-power systemd [1]: mongodb.service: Main process exited, code = exited, status = 48 / n / a
Nov 29 08:55:07 production-power systemd [1]: mongodb.service: Unit entered failed state.
Nov 29 08:55:07 production-power systemd [1]: mongodb.service: Failed with result 'exit-code'.

This started to happen after an unexpected restart of Google VPS. I think it may be the cause of slowness. In any case, the mongo service is working, so write and read at the base normally nothing but slower. Anyone know how to solve the problem?

like image 517
Franco Androetto Avatar asked Dec 02 '19 14:12

Franco Androetto


2 Answers

I got error code 48 when i tried to run mongodb.

Here is the output:

sudo service mongod status
● mongod.service - MongoDB Database Server
   Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2019-12-31 13:15:04 +03; 33min ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 18645 (code=exited, status=48)

Dec 31 13:15:03 cem systemd[1]: Started MongoDB Database Server.
Dec 31 13:15:04 cem systemd[1]: mongod.service: Main process exited, code=exited, status=48/n/a
Dec 31 13:15:04 cem systemd[1]: mongod.service: Failed with result 'exit-code'.

My solution was changing the default port, because this error occurs when the port for MongoDB is already in use.

Step 1: open conf file to edit.

sudo vim /etc/mongod.conf

Step 2: find port and change it.

net: port: 27017 -> default port before any change

After changing port, my issue solved :

sudo service mongod status
● mongod.service - MongoDB Database Server
   Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-12-31 13:48:32 +03; 1s ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 25254 (mongod)
   CGroup: /system.slice/mongod.service
           └─25254 /usr/bin/mongod --config /etc/mongod.conf

Dec 31 13:48:32 cem systemd[1]: Started MongoDB Database Server.

I hope this works for you.

like image 166
cem Avatar answered Oct 16 '22 17:10

cem


Some ubuntu users have a problem with ports

Because the ports will run automatically when the OS opens!

If you have this issue, change the ports will not useful a lot! kill the port of mongod, as a default is => 27017

sudo kill -9 $(sudo lsof -t -i:27017)

then

sudo systemctl start mongod
sudo systemctl status mongod

It will return

● mongod.service - MongoDB Database Server

Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)

Active: active (running) since Tue 2021-08-17 09:47:31 EEST; 2s ago

   Docs: https://docs.mongodb.org/manual

Main PID: 7119 (mongod)

 Memory: 166.7M

 CGroup: /system.slice/mongod.service

         └─7119 /usr/bin/mongod --config /etc/mongod.conf
like image 22
Yousef R Hammad Avatar answered Oct 16 '22 18:10

Yousef R Hammad