-
Type: Bug
-
Resolution: Duplicate
-
Priority: Critical - P2
-
None
-
Affects Version/s: 2.2.1
-
Component/s: Admin
-
None
-
ALL
-
copydatabase command is not working. I am trying to copy database from one server to another.
Want to copy database from server : ny-vmmongo-d01 where authentication is not enabled to another mongod instance.
Destination server:-mongo-dev01 authentication is enabled in this server)
---------------------------------------
Here is the sequence of command in Mongo server using mongo shell. I am running this on mongo-dev1 server where i want to create this new database.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[rsharma@mongo-dev01 data]$ mongod -version
db version v2.2.1-rc1, pdfile version 4.5
Wed Jul 17 11:02:17 git version: 9495696aa169fb34a85eafcb58b64d2ca5e74f25
[rsharma@mongo-dev01 data]$ mongo -u monadmin -p XXXXXXXX admin
MongoDB shell version: 2.2.1-rc1
connecting to: admin
replicadev01:PRIMARY> use admin
switched to db admin
replicadev01:PRIMARY> db.auth('monadmin','XXXXXXXXXX')
1
replicadev01:PRIMARY> db.copyDatabase( "mongo-dev", "fdr-dev", "ny-vmmongo-d01" )
replicadev01:PRIMARY>
The database is running with following options and I am executing the command on primary(master). The source database on "ny-vmmongo-d01" doesn't have authentication enabled.
----------------------------------------------------------------------------
logpath=/var/log/mongo/mongod.log
logappend=true
fork = true
cpu = true
directoryperdb=true
dbpath=/data/mongodb
oplogSize = 31440
replSet = replicadev01
journal = true
auth = true
keyFile = /var/lib/mongo/key
Copy database command is not working. In log file the following error is showing up.
replauthenticate: can't authenticate to master server, user:__system
As you can see in the command list, I have already authenticated myself with admin database super user which has write access.
Here is few useful output from mongo shells.
------------------------------------------------------------------------
replicadev01:PRIMARY> rs.status()
{
"set" : "replicadev01",
"date" : ISODate("2013-07-17T15:12:59Z"),
"myState" : 1,
"members" : [
,
{ "_id" : 1, "name" : "mongo-dqh01:27017", "health" : 1, "state" : 2, "stateStr" : "SECONDARY", "uptime" : 775559, "optime" : Timestamp(1374070109000, 1), "optimeDate" : ISODate("2013-07-17T14:08:29Z"), "lastHeartbeat" : ISODate("2013-07-17T15:12:59Z"), "pingMs" : 0 } ],
"ok" : 1
}
replicadev01:PRIMARY> db.system.users.find().pretty()
{
"_id" : ObjectId("50047ae6933b4c13dbcf5da3"),
"user" : "monadmin",
"readOnly" : false,
"pwd" : "714ab78bfee64a37df05f0d0885a83c3"
}
{
"_id" : ObjectId("517688344b63850b58594aa4"),
"user" : "dtsai",
"readOnly" : false,
"pwd" : "82863cecc9aee8f5789ec31171aec0e6"
}
{
"_id" : ObjectId("51c3552e8672a51ea8e53867"),
"user" : "reporter",
"readOnly" : true,
"pwd" : "ab018b5a20f2387f4bf4fbab440d0d5d"
}
replauthenticate: can't authenticate to master server, user:__system
- duplicates
-
SERVER-8280 copydb command always requires credentials if the destination mongod is running with authentication, even if the source is running without it
- Closed