Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-10239

copydb mongod fails

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: 2.2.1
    • Component/s: Admin
    • None
    • Environment:
    • ALL
    • Hide

      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

      Show
      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

      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

            Assignee:
            Unassigned Unassigned
            Reporter:
            rajeshks117 Rajesh Sharma
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: