[SERVER-10239]  copydb mongod fails Created: 17/Jul/13  Updated: 10/Dec/14  Resolved: 17/Jul/13

Status: Closed
Project: Core Server
Component/s: Admin
Affects Version/s: 2.2.1
Fix Version/s: None

Type: Bug Priority: Critical - P2
Reporter: Rajesh Sharma Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 5.8 (Final)
Release: 5.8
Codename: Final


Issue Links:
Duplicate
duplicates SERVER-8280 copydb command always requires creden... Closed
Related
Operating System: ALL
Steps To Reproduce:

Here is the sequence of command in Mongo database using mogo shell. I am running this on mongo-dev1 server
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[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" )

{ "errmsg" : "", "ok" : 0 }

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" : 0, "name" : "mongo-dev01:27017", "health" : 1, "state" : 1, "stateStr" : "PRIMARY", "uptime" : 775690, "optime" : Timestamp(1374073846000, 1), "optimeDate" : ISODate("2013-07-17T15:10:46Z"), "self" : true }

,

{ "_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

Participants:

 Description   

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" )

{ "errmsg" : "", "ok" : 0 }

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" : 0, "name" : "mongo-dev01:27017", "health" : 1, "state" : 1, "stateStr" : "PRIMARY", "uptime" : 775690, "optime" : Timestamp(1374073846000, 1), "optimeDate" : ISODate("2013-07-17T15:10:46Z"), "self" : true }

,

{ "_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



 Comments   
Comment by Spencer Brody (Inactive) [ 17/Jul/13 ]

This is a known issue, SERVER-8280, which will be fixed in 2.6.

As a workaround you can use mongodump/mongorestore to move data from one server to another.

Generated at Thu Feb 08 03:22:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.