Mac启动mongo的问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/AliceGoToAnother/article/details/86643722

Mac启动mongo的问题


题主在Mac上启用mongodb遇到很多麻烦,查阅了很多资料,终于把问题解决了,在这里整理一下,分享一下。

  1. Question1:Error while upgrading Mongodb from 3.2 to 3.6
    在安装mongodb 4.X 版本前要先升级到3.6
    Solution:
    - 先卸载mongodb
    - 再一个版本一个版本的安装
Uninstall your current mongodb

brew uninstall mongodb
Install mongodb 3.2 version

brew install [email protected]
Start mongod 3.2 version (when you install the old version like above, you need the full path to run it.)

/usr/local/opt/[email protected]/bin/mongod
Start mongo 3.2 version

/usr/local/opt/[email protected]/bin/mongo
Run the important command

> db.adminCommand( { setFeatureCompatibilityVersion: "3.2" } )
Quit

>quit();
Terminate the mongod

Find PID of mongod process using $ top

Kill the process by $ kill <PID> (the Mongo docs have more info on this)
Uninstall mongodb 3.2

brew uninstall [email protected]
Repeat the above steps for 3.4

Install mongodb 3.4 version

brew install [email protected]
Start mongod 3.4 version

/usr/local/opt/[email protected]/bin/mongod
Start mongo 3.4 version

/usr/local/opt/[email protected]/bin/mongo
Run the important command

> db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
...

Repeat the above steps for mongodb 3.6

...

Last, after uninstall 3.6, then you can install the most current version, 4.x, you don't have to specify the @4.x etc., just

Install the most current version

brew install mongodb
  1. Question2:Error: File exists @ dir_s_mkdir - /Users/Library/LaunchAgents
    Solution:rm ~/Library/LaunchAgents

猜你喜欢

转载自blog.csdn.net/AliceGoToAnother/article/details/86643722