【发布时间】:2016-11-25 07:15:45
【问题描述】:
我正在使用下面的代码来尝试导入 json 文档的 json 数组。无论我做什么,我都会在标题中得到错误。我正在使用一个名为 rs0 的副本集。我正在从运行mongod 服务的gcompute 实例运行命令。我尝试同时使用localhost 和127.0.0.1 作为本地主机种子。以及第二个副本成员的 ip。以及本地主机的外部ip。
mongoimport --db <db_name> --collection <collection_name> --username <uname> --password <pass> --host rs0/[ip_of_other_replica_member:27017],[127.0.0.1:27017] --type json --file "/tmp/json_backup_wilf17/json_array (10).json" --jsonArray --authenticationDatabase <db_name(same as --db)>
如前所述,我不断收到 Failed: error connected to db server: no reachable servers 。
mongod 正在运行。我可以登录到 mongo shell。我尝试使用rs.slaveOk(),现在我已经完全没有想法了。
【问题讨论】:
标签: json mongodb google-compute-engine mongoimport