MongoDB安装+解决错误:Failed to start mongod.service:until not found

在ubuntu下安装MongoDB的步骤:

  • 1.运行"apt-get install mongo"如果遇到找不到安装包的话运行"apt-get update"
  • 2.这时装好以后应该会自动运行mongod程序,通过"pgrep mongo -l "查看进程是否已经启动
  • 3.在终端输入"mongo",然后回车进入数据库

   按照上面的步骤就可以使用了。当我装好以后,用了一下,等再次开机使用的时候,报错了。

 错误为:Failed to start mongod.service:until not  found此刻的心情,一万个CNM。。。。

 看了网上的一些帖子找到了解决方法:

解决方法:

1创建配置文件:

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

2.在里面追加文本:

   [Unit]

   Description=High-performance, schema-free document-oriented database

   After=network.target

   [Service]

   User=mongodb

   ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

   [Install]

   WantedBy=multi-user.target

3.按ctrl+X退出

4.启动服务

  sudo systemctl start mongodb

  sudo systemctl status mongodb

5.让它永久启动

     sudo systemctl enable mongodb

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务