首页 > 解决方案 > mongoimport 套接字意外关闭

问题描述

我正在使用 mongoimport 将 json 文件导入 MongoDB Cloud Atlas,但以下命令返回超时错误。我的命令有什么问题?

mongoimport -u=foo -p=bar mongodb://clustersandbox-shard-00-01.wudsw.mongodb.net:27017 -d=foobar --type=json -c=users --drop --file=users.metadata.json

错误信息:

2021-07-24T23:48:00.709+0800    error connecting to host: could not connect to server: server selection error: server selection timeout, current topology: { Type: Single, Servers: [{ Addr: clustersandbox-shard-00-01.wudsw.mongodb.net:27017, Type: Unknown, Last error: connection() error occured during connection handshake: connection(clustersandbox-shard-00-01.wudsw.mongodb.net:27017[-64]) socket was unexpectedly closed: EOF }, ] }

我已将我的 IP 地址列入白名单。

标签: mongodbmongoimport

解决方案


推荐阅读