db.copyDatabase('t1','t1','52.74.199.141')
. Так же выдает ошибку:{
"ok" : 0,
"errmsg" : "couldn't connect to server 52.74.199.141:27017 (52.74.199.141), connection attempt failed"
}
> show dbs
Thu May 28 00:25:13.202 listDatabases failed:{ "ok" : 0, "errmsg" : "unauthorized" } at src/mongo/shell/mongo.js:46
> use admin
switched to db admin
> db.auth('root','password')
1
> show dbs
admin 0.203125GB
local 0.078125GB
...
client2 = MongoClient('52.76.49.245', 27017)
client2.admin.authenticate('root2', 'password')
print(client2.shoppr_backend_db.collection_names())
client = MongoClient()
client.admin.command(
'copydb',
fromdb='shoppr_backend_db',
todb='del4',
fromhost='52.76.49.245',
username='root2',
key=''
)
...on namespace admin.$cmd failed: exception: nextSafe(): { $err: "not authorized for query on shoppr_backend_db.system.namespaces", code: 16550 }
$ mongo -u USER -p PASSWORD --authenticationDatabase admin
$ mongo -u root -p password --authenticationDatabase admin
MongoDB shell version: 2.4.9
connecting to: test
> show dbs
admin 0.203125GB
local 0.078125GB
>