0

I'm trying to dump a MongoDB collection from a remote server to a local JSON file.

First, I do some ssh port forwading to begin with:

ssh -NL 12345:localhost:27017 $REMOTE_USERNAME@$REMOTE_HOST &

Then, the export itself:

mongoexport -h $MONGODB_URL -d $MONGODB_DBNAME -c $MONGODB_COLLECTION -o $BACKUP_FILE --pretty

What I would normaly get is something like this:

2019-02-07T14:58:15.322-0400    writing bubeIO.requests to
2019-02-07T14:58:18.754-0400    [........................]  bubeIO.requests  0/2773  (0.0%)
2019-02-07T14:58:21.754-0400    [........................]  bubeIO.requests  10/2773  (0.3%)
2019-02-07T14:58:24.754-0400    [........................]  bubeIO.requests  20/2773  (0.6%)
...
...
2019-02-07T14:59:00.754-0400    [........................]  bubeIO.requests  2773/2773  (100.0%)

But, what what I'm getting is this:

2019-02-07T14:58:15.322-0400    writing bubeIO.requests to
2019-02-07T14:58:18.754-0400    [........................]  bubeIO.requests  0/2773  (0.0%)
2019-02-07T14:58:21.754-0400    [........................]  bubeIO.requests  0/2773  (0.0%)
2019-02-07T14:58:24.754-0400    [........................]  bubeIO.requests  0/2773  (0.0%)
2019-02-07T14:58:27.753-0400    [........................]  bubeIO.requests  101/2773  (3.6%)
2019-02-07T14:58:30.753-0400    [........................]  bubeIO.requests  101/2773  (3.6%)
2019-02-07T14:58:33.754-0400    [........................]  bubeIO.requests  101/2773  (3.6%)
2019-02-07T14:58:36.753-0400    [........................]  bubeIO.requests  101/2773  (3.6%)
2019-02-07T14:58:39.753-0400    [........................]  bubeIO.requests  101/2773  (3.6%)
2019-02-07T14:58:42.753-0400    [........................]  bubeIO.requests  101/2773  (3.6%)
2019-02-07T14:58:45.754-0400    [........................]  bubeIO.requests  101/2773  (3.6%)
2019-02-07T14:58:48.753-0400    [........................]  bubeIO.requests  101/2773  (3.6%)
2019-02-07T14:58:51.753-0400    [........................]  bubeIO.requests  101/2773  (3.6%)
2019-02-07T14:58:54.754-0400    [........................]  bubeIO.requests  101/2773  (3.6%)
2019-02-07T14:58:57.753-0400    [........................]  bubeIO.requests  101/2773  (3.6%)
2019-02-07T14:59:00.594-0400    [........................]  bubeIO.requests  101/2773  (3.6%)
2019-02-07T14:59:00.594-0400    Failed: error writing data for collection `bubeIO.requests` to disk: error reading collection: read tcp [::1]:61276->[::1]:12345: use of closed network connection

As you can see, it goes from 0 to 101 real quick and then it doesn't go anywhere from there until timeout.

It worked nicely before for remote dumps and suddenly this starts to happen. Local dumps work just fine, so this could be a networking issue?

Can anyone give me a direction on how to solve this?

PS: mongod and mongoexport are both version 4.0.2

Victor Valente
  • 761
  • 9
  • 24
  • Have you seen: https://stackoverflow.com/questions/29568427/mongodump-fails-frequently-after-upgrade-from-2-6-to-3-0 – Jake1164 Feb 07 '19 at 20:40
  • Do you have the same version of MongoDB server and the `mongoexport` tool? What's the output of `mongod --version` and `mongoexport --version`? – kevinadi Feb 08 '19 at 00:28
  • Hi, Kevin. I just checked and they both seem to be on the same version: `mongod --version` -> db version v4.0.2 and `mongexport --version` -> mongoexport version: r4.0.2 – Victor Valente Feb 08 '19 at 12:51

0 Answers0