archlinux下mongodb服务启动失败

问题:

sudo systemctl status mongodb.service显示如下

mongodb.service: Failed with result 'exit-code'.
  1. 查看mongodb的配置文件/etc/mongodb.conf

    dbpath = /var/lib/mongodb
    logpath = /var/log/mongodb/mongod.log

  2. 查看日志获取错误信息

    IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.6 before attempting an upgrade to 4.0; see http://dochub.mongodb.org/core/4.0-upgrade-fcv for more details

  3. 原来是mongodb升级了之后,之前的数据库文件都是旧格式,所以现在启动不起来了

  4. 备份/var/lib/mongodb目录,重新创建一个一样的目录,把所属与权限设置正确,重启,问题解决