簡體   English   中英

無法在 AWS EC2 實例上運行 mongoexport

[英]Unable to run mongoexport on AWS EC2 instance

我在 DocumentDB 數據庫中有想要導出到 S3 存儲桶的數據。 但是,當我嘗試運行 mongoexport 命令時:

mongoexport --uri="my_cluster_address/database_to_use" --collection=my_collection --out=some_file.json

我收到此錯誤:

could not connect to server: server selection error: server selection timeout, current topology: 
{ Type: Single, Servers: [{ Addr: docdb_cluster_address, Type: Unknown, State: Connected, Average RTT: 0, Last error: 
connection() : connection(docdb_cluster_address[-13]) incomplete read of message header: read tcp port_numbers-
>port_numbers: i/o timeout }, ] }

我能夠將 ssh 放入集群並進行各種轉換以及與數據庫工作相關的任何其他事情,但是當我退出 mongoshell 並嘗試運行 mongoexport 命令時它不起作用。 我已經將 mongoexport 工具下載到 EC2 實例並將它們添加到 .bash_profile 路徑。 我認為這不是網絡問題,因為如果是這種情況,我將無法將 ssh 插入集群,所以我認為我在這方面做得很好,我不確定我可能會在這里遺漏什么。 有任何想法嗎?

使用 DocumentDB 時,mongoexport 不會采用與從/到 MongoDB 導出/導入/恢復/轉儲時通常使用的參數相同的參數

以下是對我有用的命令和文檔鏈接: https://docs.aws.amazon.com/documentdb/latest/developerguide/backup_restore-dump_restore_import_export_data.html

mongoexport --ssl \
    --host="tutorialCluster.node.us-east-1.docdb.amazonaws.com:27017" \
    --collection=restaurants \
    --db=business \
    --out=restaurant2.json \
    --username=<yourUsername> \
    --password=<yourPassword> \
    --sslCAFile rds-combined-ca-bundle.pem

以下是使用 MongoDB 時它如何正常工作的文檔: https://docs.mongodb.com/database-tools/mongoexport/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM