vqdym
vqdym

Reputation: 49

Reinstall MongoDB without deletion of database

I'm dealing with MongoDB having a large database (~600GB) on macOS. After mongodb has been removed from homebrew-core, I'm no longer able to configure it or simply restart. After some research, I came to the conclusion that I need to reinstall mongodb. How can I reinstall it without the deletion of the database?

Upvotes: 1

Views: 2302

Answers (1)

kevinadi
kevinadi

Reputation: 13765

You can use brew to install MongoDB:

Install MongoDB Community Edition on macOS

Once it's installed, you can either:

  • Change the dbpath in the config file in /usr/local/etc/mongod.conf, or
  • Run mongod --dbpath <the old database file path> ...

Take care to ensure that you're installing the same major version of MongoDB. If previously you're running 3.6.x, don't install 4.0.x or 4.2.x or you'll risk data issues if you do this without following the proper upgrade instructions.

Also recommended to take a backup of your dbpath before doing this.

Upvotes: 2

Related Questions