2020年1月8日 星期三

Change or move MongoDB 4.0 data folder on Windows 10

In 2019, a typical MongoDB 4.0 installs with data folder at C:\Program Files\MongoDB\Server\4.0\data with a service.

How to move \data to another bigger drive, say D drive?

1. services.msc, stop MongoDB service
2. Move all files from C:\Program Files\MongoDB\Server\4.0\data to D:\Program Files\MongoDB\Server\4.0\data
3. Edit C:\Program Files\MongoDB\Server\4.0\bin\mongod.cfg so that its dbPath starts a D: instead of C:

storage:
  dbPath: D:\Program Files\MongoDB\Server\4.0\data
  journal:
    enabled: true

4. admin cmd.exe, run below

C:\Program Files\MongoDB\Server\4.0\bin>mongod --config "C:\Program Files\MongoD
B\Server\4.0\bin\mongod.cfg" --install

5. services.msc, start MongoDB service

Done!

沒有留言:

張貼留言

2007 to 2023 HP and Dell Servers Comparison

  HP Gen5 to Gen11  using ChatGPT HP ProLiant Gen Active Years CPU Socket Popular HP CPUs Cores Base Clock Max RAM Capacity Comparable Dell ...