how to set mongod --dbpath

前端 未结 12 1785
囚心锁ツ
囚心锁ツ 2020-12-29 19:50

very new to mongodb and databases in general. whenever i run mongo i receive this error message: ​​​

MongoDB shell version: 2.         


        
12条回答
  •  抹茶落季
    2020-12-29 20:31

    First you will have a config file in /etc/mongodb.conf, therefore this sounds like a homebrew install which will use some more standardized paths. The whole /data/db/ thing is referenced in a lot of manual install documentation.

    So basically from your log the server is not running, it's shutting down, so there is nothing for the shell to connect to. Seems like you have had some unclean shutdowns/restarts which has led to the inconsistency.

    Clear the files in the journal /usr/local/var/mongodb/journal/ on your config.

    Also:

    sudo rm /var/lib/mongodb/mongod.lock
    

    Just in case, even though that part looks clean. And then restart.

提交回复
热议问题