Mongoexport远程数据库无法连接

时间:2014-09-18 03:09:06

标签: mongodb csv mongohq mongoexport

我需要从MongoDB(托管在MongoHQ // Compose.io上)实例导出一些信息。我按照these说明操作,这些说明提供了我需要的所有示例,并且似乎与官方mongo文档相对应。这是我正在运行的命令:

mongoexport -h kahana.mongohq.com:12345/my_db_name -u username -p password -d my_db -c usercollection -f "firstName,lastName,macIdNum,iclass" --csv

和输出:

2014-09-17T21:58:12.806-0500 starting new replica set monitor for replica set kahana.mongohq.com:10043 with seeds my_db_name:27017
2014-09-17T21:58:12.806-0500 [ReplicaSetMonitorWatcher] starting
2014-09-17T21:58:12.919-0500 getaddrinfo("my_db_name") failed: nodename nor servname provided, or not known
2014-09-17T21:58:12.952-0500 warning: No primary detected for set kahana.mongohq.com:12345
2014-09-17T21:58:12.952-0500 All nodes for set kahana.mongohq.com:12345 are down. This has happened for 1 checks in a row. Polling will stop after 29 more failed checks
couldn't connect to [kahana.mongohq.com:12345/my_db_name] connect failed to replica set kahana.mongohq.com:12345/my_db_name:27017

不确定这里的问题是什么。任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:7)

这应该有效:

mongoexport -h kahana.mongohq.com:12345 -u username -p password -d my_db -c usercollection -f "firstName,lastName,macIdNum,iclass" --csv

' -h' hostname选项仅用于指定' hostname / IP:port'。