mongo: ubuntu system install mongo error code=exited, status=48

Recently, I was working on the stress test of the project, found a new server, and everything had to be reinstalled, including mongo

Because I wrote an installation tutorial before, I followed my own tutorial:
Linux server installation and deployment of the latest stable version mongoDB Community Edition - Ubuntu-20.04 version

Error code=exited, status=48

The server versions are all Ubuntu-20.0, and there is no problem with the installation of sparks and lightning all the way, but an error is reported when starting

start mongo

sudo systemctl start mongod

View mongo status

sudo systemctl status mongod

Then the error message is as follows:

mongod.service - MongoDB Database Server
     Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor prese>
     Active: failed (Result: exit-code) since Fri 2023-01-13 16:35:33 CST; 7s a>
       Docs: https://docs.mongodb.org/manual
    Process: 1265675 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=>
   Main PID: 1265675 (code=exited, status=48)

Jan 13 16:35:33 inspur-NF5468M5 systemd[1]: Started MongoDB Database Server.
Jan 13 16:35:33 inspur-NF5468M5 systemd[1]: mongod.service: Main process exited>
Jan 13 16:35:33 inspur-NF5468M5 systemd[1]: mongod.service: Failed with result >

[4]  + 1265785 suspended  sudo systemctl status mongod

insert image description here

reason

Some ubuntu users have problems with ports: the ports run automatically when the OS is turned on!

When my mongo failed to start, the theory is that port 27017 is not occupied, but as shown below:
insert image description here

Solution

If you have this problem too, changing the port doesn't necessarily help! The port on which mongod can be killed, default => 27017

implement

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

Then

sudo systemctl start mongod
sudo systemctl status mongod

look at the result
insert image description here

Problem solved, continue to pave the way for my test environment!

Guess you like

Origin blog.csdn.net/m0_37482190/article/details/128676572