--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
Conclusions:
1. mongodump is essentially broken. It's also inaccurately documented:
somewhere between the wiki and the man page and help I saw one version
claiming that I could connect to a replica set via the --host argument,
but that's wrong. mongodump does not support reading from a replica set,
despite the fact that it accepts a replica set argument. It will read
from one node (the first) and one node only, and if that node is in a
bad state ("rollback") it can hang for minutes. So, I created a special
little script to find the current secondary node and dump from there,
but encountered the same issues: mongodump just dies with no error.
2. I tried mongoexport instead. And then encountered this bug:
https://jira.mongodb.org/browse/SERVER-2157
So, mongoexport is broken, too.
3. Eliot gives a good suggestion in the bug description "I would
recommend writing your own json exportor." So, that's the direction
we're going now. MongoDB's CLI tools are just not ready for production.
(Version 1.8.2.) To others I would say: at this point, deploying MongoDB
will likely involve a lot of homegrown solutions.
4. This story has been repeating itself throughout our MongoDB replica
set deployment experience. We have nodes stuck in "rollback" mode for
minutes or dying on us suddenly (we wrote a special script to test if
MongoDB is up and restart it if it's not). 10gen would do well to stop
the race to add more features, buckle down and stabilize their product.
(Not to mention get their documentation up to date and in better quality.)
Re replica set nodes dying, is there any log message?
If not, is there anything in /var/log/messages killing processes?
Sorry for not updating you earlier --
I did not try a different shell, because I found out that the issue was not just in cron, but also running the script plainly (my theory about tty was only partially true; even after I got around that problem mongodump would still fail on occasion).
It could definitely be an issue specific to our setup. In particular we found that trying to dump a map-reduce-produced collection is especially prone to mongodump failing. And so I explicitly dump the "regular" collections calling mongodump once for every single one of them (would be nice if we could specify a list of collections in the command line!). Still, some of these "regular" collections cause mongodump to fail with no error output.
Perhaps
another approach to increase stability could be to have a
dedicated read-only node on the replica set, and do all
mongodumps from it after taking it out of the replica set,
rejoining it when we're done. But again this is quite elaborate
(and possibly expensive) to set up, and would require quite a
bit of custom scripting.
I'd love to help you debug this more, but quite honestly we spent far too much time on this approach.
Your suggestion to roll our own export tool is not a bad one: I'm working on a really nice multi-threaded tool similar to mongoexport, which I will make publicly available soon.
You aren't guaranteed a fully self consistent data set though.
I've released my "alternative backup" tool as part of the Savory Framework. The list announcement was here:
http://groups.google.com/group/mongodb-user/browse_thread/thread/2e1f3ad485543c49
A description of the backup service specifically:
It seems that when running mongodump through a bash script you may want
to add a "wait" command, like so:
#/bin/bash
# do things here
mongodump
wait
# do things here
Seems to have fixed things on one of our deployments, but I can't be
sure because we did a LOT of things there. I can't confirm this
entirely, and I'm also a bit skeptical that this is the issue. Why would
mongodump be running as a background process? It can explain, though,
why in some cases mongodump was cut off abruptly with no error code.
-Tal
Does it work from the shell 100% of the time?