简体   繁体   English

Mongorestore 不断向我抛出“(NotMaster) not master”错误

[英]Mongorestore keeps throwing "(NotMaster) not master" error at me

I am new to mongodb and I've been trying to restore my data from mongodump.我是 mongodb 的新手,我一直在尝试从 mongodump 恢复我的数据。 Any time I try running the script in terminal, it executes nearly entirely, then reverts.每当我尝试在终端中运行脚本时,它几乎会完全执行,然后恢复。 I've tried looking around but solutions haven't touched on the 'not master' issue我试过环顾四周,但解决方案没有触及“非大师”问题

This is my mongorestore script;这是我的 mongorestore 脚本; placeholders used for brevity为简洁起见的占位符

mongorestore --host 'the-given-shard.net:27017' \
  --ssl -u 'username' -p 'placeholder' --authenticationDatabase admin --db=loc8r \
  --collection=locations dump/loc8r/locations.bson

And this is the output这是输出

2020-02-04T17:30:21.817+0000    checking for collection data in dump/loc8r/locations.bson
2020-02-04T17:30:22.123+0000    restoring to existing collection loc8r.locations without dropping
2020-02-04T17:30:22.123+0000    reading metadata for loc8r.locations from dump/loc8r/locations.metadata.json
2020-02-04T17:30:22.124+0000    restoring loc8r.locations from dump/loc8r/locations.bson
2020-02-04T17:30:24.205+0000    [########################]  loc8r.locations  8.21KB/8.21KB  (100.0%)
2020-02-04T17:30:24.888+0000    [########################]  loc8r.locations  8.21KB/8.21KB  (100.0%)
2020-02-04T17:30:24.888+0000    finished restoring loc8r.locations (0 documents, 0 failures)
2020-02-04T17:30:24.889+0000    Failed: loc8r.locations: error restoring from dump/loc8r/locations.bson: (NotMaster) not master
2020-02-04T17:30:24.889+0000    0 document(s) restored successfully. 0 document(s) failed to restore.

db.isMaster() does not work for me when I follow当我跟随时db.isMaster()对我不起作用

https://docs.mongodb.com/manual/tutorial/getting-started/ https://docs.mongodb.com/manual/tutorial/getting-started/

db.inventory.insertMany([    { item: "journal", qty: 25, status: "A", size: { h: 14, w: 21, uom: "cm" }, tags: [ "blank", "red" ] },    { item: "notebook", qty: 50, status: "A", size: { h: 8.5, w: 11, uom: "in" }, tags: [ "red", "blank" ] },    { item: "paper", qty: 10, status: "D", size: { h: 8.5, w: 11, uom: "in" }, tags: [ "red", "blank", "plain" ] },    { item: "planner", qty: 0, status: "D", size: { h: 22.85, w: 30, uom: "cm" }, tags: [ "blank", "red" ] },    { item: "postcard", qty: 45, status: "A", size: { h: 10, w: 15.25, uom: "cm" }, tags: [ "blue" ] } ]);

and actually outputs:并实际输出:

uncaught exception: WriteCommandError({
    "operationTime" : Timestamp(1615842692, 6),
    "ok" : 0,
    "errmsg" : "not master",
    "code" : 10107,
    "codeName" : "NotMaster",
    "$clusterTime" : {
        "clusterTime" : Timestamp(1615842692, 6),
        "signature" : {
            "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
            "keyId" : NumberLong(0)
        }
    }
}) :
WriteCommandError({
    "operationTime" : Timestamp(1615842692, 6),
    "ok" : 0,
    "errmsg" : "not master",
    "code" : 10107,
    "codeName" : "NotMaster",
    "$clusterTime" : {
        "clusterTime" : Timestamp(1615842692, 6),
        "signature" : {
            "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
            "keyId" : NumberLong(0)
        }
    }
})
WriteCommandError@src/mongo/shell/bulk_api.js:417:48
executeBatch@src/mongo/shell/bulk_api.js:915:23
Bulk/this.execute@src/mongo/shell/bulk_api.js:1163:21
DBCollection.prototype.insertMany@src/mongo/shell/crud_api.js:326:5
@(shell):1:1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM