0

I had an install of MongoDB that was using on OSX that was using ~/data/db. I had a crash and re-installed MongoDB using Homebrew and it set up the new db path at ~/usr/local/var/mongodb.

All of my apps are working (default port 27017), but when I try to run mongodump it backs up the db in ~/data/db which is now out of date.

How can I get mongodump to reference the correct db folder?

Brian Flanagan
  • 4,612
  • 5
  • 29
  • 38
  • What version of mongodump are you using and how exactly are you calling it? By simply executing `mongodump` in the terminal? – Sergio Tulentsev Feb 25 '19 at 20:38
  • The version is `3.6.5`. And yep, calling it from terminal. (I'm also using it in a bash script but it performs the same way for both.) – Brian Flanagan Feb 26 '19 at 14:26
  • 1
    Since version 3.2 (IIRC) mongodump does not accept `--dbpath` argument. It now requires a live server. So chances are good that either a) you're mistaken about which data dir your server uses or b) there are _two_ servers on the machine and mongodump is talking to a wrong one. – Sergio Tulentsev Feb 26 '19 at 14:30
  • I'm confident about the correct data dir. Timestamps show which one is getting updated. Not sure about two servers running though... how could I check that? – Brian Flanagan Feb 26 '19 at 14:43
  • Try something like `ps aux | grep mongod`. Followup question: How do you know that mongodump dumps the wrong data dir? – Sergio Tulentsev Feb 26 '19 at 14:48
  • Looks like there might be two running: 367 0.0 0.2 5226396 27108 ?? S 14Feb19 6:03.43 /usr/local/opt/mongodb/bin/mongod --config /usr/local/etc/mongod.conf 72163 0.0 0.0 4277252 824 s010 S+ 9:48AM 0:00.00 grep mongod – Brian Flanagan Feb 26 '19 at 14:49
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/189079/discussion-between-brian-flanagan-and-sergio-tulentsev). – Brian Flanagan Feb 26 '19 at 14:54

0 Answers0