V
V
Vyacheslav Grachunov2021-10-02 17:36:28
MongoDB
Vyacheslav Grachunov, 2021-10-02 17:36:28

Why won't mongodb start?

The situation is this: everything worked and suddenly fell off.
I tried to start mongodb manually through the command mongod- I got this error:

exception in initAndListen: 29 Data directory /data/db not found., terminating

I was very surprised and created such a directory and made it to it chown -R mongodb /data/db
. After that, through the command , the mongoddatabase began to start, but it was empty. It doesn't care - there is operational data that becomes obsolete in half an hour.
But it still doesn't work systemctl start mongod- throws an error:
Failed to start mongod.service: Unit mongod.service not found.

It turned out that I do not have a mongod service, but there is mongodb, but it is disguised, I did it:
systemctl unmask mongodb
I tried it systemctl start mongodb- now it gives another error:
Process: 7409 ExecStart=/etc/init.d/mongodb start (code=exited, status=1/FAILURE)
systemd[1]: Failed to start LSB: An object/document-oriented database.


I don't understand what to do with it. How to make it work properly?

Ubuntu 18.04 system

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vyacheslav Grachunov, 2021-10-02
@Qwentor

In short, I still have old packages from another version of mongodb there, that's why all the problems. The following helped:

apt remove mongodb-org
apt purge mongodb-org
apt remove mongodb
apt purge mongodb
apt autoremove

apt install mongodb-org
systemctl start mongod
systemctl enable mongod

A
Alexander Karabanov, 2021-10-02
@karabanov

everything worked and suddenly fell off

A typical problem is when you don't know how it works. You think that your actions do not affect what is happening in any way, and then "everything worked and suddenly fell off."
Reinstall.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question