assertion: 18 { code: 18, ok: 0.0, errmsg: "auth fails" }
MongoDB Version: 2.4.7
Mongodump:
$ bin/mongodump -u admin -p admin -d test -o ./tmp/
connected to: 127.0.0.1:29017
assertion: 18 { code: 18, ok: 0.0, errmsg: "auth fails" }
解决方法:
这个是2.2.2版本以后出现的,参考:https://jira.mongodb.org/browse/SERVER-9991
$ bin/mongodump -u admin -p admin --authenticationDatabase admin -d test -o ./tmp/
$ bin/mongorestore -u admin -p admin --authenticationDatabase admin -d test ./tmp/test/