使用以下.mongorc.js:
rs.slaveOk();
function startRS() {
config = {_id: 'rs', members: [{_id: 0, host: 'localhost:27017', priority: 1}, {_id: 1, host: 'localhost:27016', priority: 0}]};
rs.initiate(config);
}
以及以下启动脚本:
#!/bin/bash
mkdir /data/db/rs{0,1} >/dev/null 2>&1
/opt/mongo-db/bin/mongod --replSet rs --port 27016 --dbpath /data/db/rs1 &
/opt/mongo-db/bin/mongod --replSet rs --port 27017 --dbpath /data/db/rs0 &
/opt/mongo-db/bin/mongo --eval "startRS()"
Mongo开始一切正常。但是当我试着用
$ /opt/mongo-db/bin/mongorestore --drop dump/
它在不停地写着的时候挂着
2018-06-29T19:35:47.661+0200 [] ardoq-common.model.versions 753KB/753KB (100.0%)
2018-06-29T19:35:47.661+0200 [
2018-06-29T19:35:50.662+0200 [........................] home.component.versions 447KB/12.9MB (3.4%)
2018-06-29T19:35:50.662+0200 [
2018-06-29T19:35:50.662+0200
2018-06-29T19:35:53.664+0200 [] ardoq-common.model.versions 753KB/753KB (100.0%)
2018-06-29T19:35:53.664+0200 [
当MongoDB日志时
2018-06-29T19:37:57.368+0200 I NETWORK [listener] connection accepted from 127.0.0.1:62632 #60 (11 connections now open)
2018-06-29T19:37:57.372+0200 I NETWORK [listener] connection accepted from 127.0.0.1:62634 #10 (4 connections now open)
2018-06-29T19:37:57.377+0200 I COMMAND [conn60] CMD: drop home.component.versions
2018-06-29T19:37:57.377+0200 I STORAGE [conn60] dropCollection: home.component.versions (623af0a3-ee8d-4b8a-9e28-349bd1094b32) - renaming to drop-pending collection: home.system.drop.1530293877i1t5.component.versions with drop optime { ts: Timestamp(1530293877, 1), t: 5 }
2018-06-29T19:37:57.379+0200 I NETWORK [listener] connection accepted from 127.0.0.1:62636 #61 (12 connections now open)
2018-06-29T19:37:57.379+0200 I STORAGE [conn60] createCollection: home.component.versions with generated UUID: f5cb88f9-df22-4990-9ef8-cdd689892b50
2018-06-29T19:37:57.380+0200 I COMMAND [repl writer worker 9] CMD: drop home.component.versions
2018-06-29T19:37:57.380+0200 I STORAGE [repl writer worker 9] dropCollection: home.component.versions (623af0a3-ee8d-4b8a-9e28-349bd1094b32) - renaming to drop-pending collection: home.system.drop.1530293877i1t5.component.versions with drop optime { ts: Timestamp(1530293877, 1), t: 5 }
2018-06-29T19:37:57.382+0200 I NETWORK [listener] connection accepted from 127.0.0.1:62638 #62 (13 connections now open)
2018-06-29T19:37:57.383+0200 I COMMAND [conn61] CMD: drop piedpiper.component.versions
2018-06-29T19:37:57.383+0200 I STORAGE [conn61] dropCollection: piedpiper.component.versions (1eaf6561-eea5-414d-80d2-b914f5110559) - renaming to drop-pending collection: piedpiper.system.drop.1530293877i3t5.component.versions with drop optime { ts: Timestamp(1530293877, 3), t: 5 }
2018-06-29T19:37:57.384+0200 I STORAGE [repl writer worker 0] createCollection: home.component.versions with provided UUID: f5cb88f9-df22-4990-9ef8-cdd689892b50
这是MacOS High Sierra上的MongoDB-OSX-x86_64-Enterprise-3.6.5
我已经在另一台Mac上运行了这个精确的设置(可能不太精确,因为它正在工作),也有MacOS High Sierra,但可能有MongoDB-3.6.4。
有什么建议吗?