In 2.0.8, mongodump/restore are unable to connect to auth enabled replica sets using the replicaSet format connection string, e.g., "replTest/localhost:31000,localhost:31001"
This can be worked around by connecting directly to one of the members.
> db.auth('super','pass')
|
> rs.status()
|
{
|
"set" : "myapp",
|
"date" : ISODate("2012-11-23T16:05:35Z"),
|
"myState" : 1,
|
"members" : [
|
{
|
"_id" : 0,
|
"name" : "Gianfranco-10gen.local:40001",
|
"health" : 1,
|
"state" : 2,
|
"stateStr" : "SECONDARY",
|
"uptime" : 2630,
|
"optime" : Timestamp(1353684410000, 1),
|
"optimeDate" : ISODate("2012-11-23T15:26:50Z"),
|
"lastHeartbeat" : ISODate("2012-11-23T16:05:34Z"),
|
"pingMs" : 0
|
},
|
{
|
"_id" : 1,
|
"name" : "Gianfranco-10gen.local:40002",
|
"health" : 1,
|
"state" : 1,
|
"stateStr" : "PRIMARY",
|
"optime" : Timestamp(1353684410000, 1),
|
"optimeDate" : ISODate("2012-11-23T15:26:50Z"),
|
"self" : true
|
},
|
{
|
"_id" : 2,
|
"name" : "Gianfranco-10gen.local:40003",
|
"health" : 1,
|
"state" : 7,
|
"stateStr" : "ARBITER",
|
"uptime" : 2622,
|
"optime" : Timestamp(0, 0),
|
"optimeDate" : ISODate("1970-01-01T00:00:00Z"),
|
"lastHeartbeat" : ISODate("2012-11-23T16:05:34Z"),
|
"pingMs" : 0
|
}
|
],
|
"ok" : 1
|
}
|
> use admin
|
> show users
|
{
|
"_id" : ObjectId("50af93cd91fd68039a8d635a"),
|
"user" : "mod",
|
"readOnly" : true,
|
"pwd" : "1f6fcc8d0acedbf19216156f244f9f77"
|
}
|
{
|
"_id" : ObjectId("50af93d691fd68039a8d635b"),
|
"user" : "super",
|
"readOnly" : false,
|
"pwd" : "bd42eafe6f7aa5c8f8fd874f1364085b"
|
}
|
|
> db.auth('localadmin','pass')
|
> use test
|
> show users
|
{
|
"_id" : ObjectId("50af938991fd68039a8d6358"),
|
"user" : "localadmin",
|
"readOnly" : false,
|
"pwd" : "07a52d0f3417ec013a63523f303c7b08"
|
}
|
{
|
"_id" : ObjectId("50af93a891fd68039a8d6359"),
|
"user" : "localreadonly",
|
"readOnly" : true,
|
"pwd" : "1b51f54683554baf8e6019f2e484bfbc"
|
}
|
$ mongodump --version
|
mongodump version 2.0.7
|
$ mongodump -d test -c test -u localadmin -p pass -h myapp/Gianfranco-10gen.local:40001,Gianfranco-10gen.local:40002 --out testdump
|
Fri Nov 23 16:10:18 starting new replica set monitor for replica set myapp with seed of Gianfranco-10gen.local:40001,Gianfranco-10gen.local:40002
|
Fri Nov 23 16:10:18 successfully connected to seed Gianfranco-10gen.local:40001 for replica set myapp
|
Fri Nov 23 16:10:18 changing hosts to { 0: "Gianfranco-10gen.local:40001", 1: "Gianfranco-10gen.local:40002" } from myapp/
|
Fri Nov 23 16:10:18 trying to add new host Gianfranco-10gen.local:40001 to replica set myapp
|
Fri Nov 23 16:10:18 successfully connected to new host Gianfranco-10gen.local:40001 in replica set myapp
|
Fri Nov 23 16:10:18 trying to add new host Gianfranco-10gen.local:40002 to replica set myapp
|
Fri Nov 23 16:10:18 successfully connected to new host Gianfranco-10gen.local:40002 in replica set myapp
|
Fri Nov 23 16:10:18 replica set monitor for replica set myapp started, address is myapp/Gianfranco-10gen.local:40001,Gianfranco-10gen.local:40002
|
Fri Nov 23 16:10:18 [ReplicaSetMonitorWatcher] starting
|
connected to: myapp/Gianfranco-10gen.local:40001,Gianfranco-10gen.local:40002
|
DATABASE: test to testdump/test
|
assertion: 13106 nextSafe(): { $err: "unauthorized db:test lock type:-1 client:10.7.100.14", code: 10057 }
|
This happens with any of the other 3 accounts
$ mongodump --version
|
mongodump version 2.2.1
|
$ mongodump -d test -c test -u localadmin -p pass -h myapp/Gianfranco-10gen.local:40001,Gianfranco-10gen.local:40002 --out testdump
|
Fri Nov 23 16:15:33 starting new replica set monitor for replica set myapp with seed of Gianfranco-10gen.local:40001,Gianfranco-10gen.local:40002,Gianfranco-10gen.local:40003
|
Fri Nov 23 16:15:33 successfully connected to seed Gianfranco-10gen.local:40001 for replica set myapp
|
Fri Nov 23 16:15:33 changing hosts to { 0: "Gianfranco-10gen.local:40001", 1: "Gianfranco-10gen.local:40002" } from myapp/
|
Fri Nov 23 16:15:33 trying to add new host Gianfranco-10gen.local:40001 to replica set myapp
|
Fri Nov 23 16:15:33 successfully connected to new host Gianfranco-10gen.local:40001 in replica set myapp
|
Fri Nov 23 16:15:33 trying to add new host Gianfranco-10gen.local:40002 to replica set myapp
|
Fri Nov 23 16:15:33 successfully connected to new host Gianfranco-10gen.local:40002 in replica set myapp
|
Fri Nov 23 16:15:33 successfully connected to seed Gianfranco-10gen.local:40003 for replica set myapp
|
Fri Nov 23 16:15:33 Primary for replica set myapp changed to Gianfranco-10gen.local:40002
|
Fri Nov 23 16:15:33 replica set monitor for replica set myapp started, address is myapp/Gianfranco-10gen.local:40001,Gianfranco-10gen.local:40002
|
Fri Nov 23 16:15:33 [ReplicaSetMonitorWatcher] starting
|
connected to: myapp/Gianfranco-10gen.local:40001,Gianfranco-10gen.local:40002,Gianfranco-10gen.local:40003
|
Fri Nov 23 16:15:33 DATABASE: test to testdump/test
|
Fri Nov 23 16:15:33 test.test to testdump/test/test.bson
|
Fri Nov 23 16:15:33 doing snapshot query
|
Fri Nov 23 16:15:33 1004 objects
|
Fri Nov 23 16:15:33 Metadata for test.test to testdump/test/test.metadata.json
|
Logstream::get called in uninitialized state
|
Fri Nov 23 16:15:33 deleting replica set monitor for: myapp/Gianfranco-10gen.local:40001,Gianfranco-10gen.local:40002
|