Failed to start mongod.service: Unit not found;mongodb in unbuntu

Failed to start mongod.service: Unit not found

In fact, I am used to MYSQL, and then the last step of the project is to improve the data reading and writing part. I originally planned to use mysql. However, I found that there was always a problem with the installation on the centOS system. Mariadb, which is a branch of MYSQL, said that after Oracle acquired MYSQL, in order to avoid the risk of closed source, the community began to use and maintain this MariaDB.

Then I installed Maria and kept getting stuck there. . .

But in other words, why am I a front-end, doing these things? . .

Then I quit to use mongodb and forget it. . .

Then report this error when starting mongodb: Failed to start mongod.service: Unit not found

mood at the moment. . . .

After some reading, I finally found a solution after reading a lot of posts:

1 Create a configuration file:

sudo nano /etc/systemd/system/mongodb.service

2. Append text inside:

Press Ctrl+C to copy the code
Press Ctrl+C to copy the code

3. Press ctrl+X to exit

4. Start the service

sudo systemctl start mongodb
sudo systemctl status mongodb

5. Let it start permanently

sudo systemctl enable mongodb

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325722386&siteId=291194637