Amazon S3使用新手。尝试使用简单的java方法从Amazon S3访问该文件时出现以下错误。
2016-08-23 09:46:48 INFO request:450 - Received successful response:200, AWS Request ID: F5EA01DB74D0D0F5
Caught an AmazonClientException, which means the client encountered an
internal error while trying to communicate with S3, such as not being
able to access the network.
Error Message: Unable to store object contents to disk: Read timed out
昨天确切的代码行。我可以在12分钟内下载100%的5GB文件。今天我处于一个更好的连接环境中,但只下载了2%或3%的文件,然后程序失败。
我用来下载的代码。
s3Client.getObject(new GetObjectRequest("mybucket", file.getKey()), localFile);
答案 0 :(得分:2)
您需要在客户端配置中设置连接超时和套接字超时。
Click here for a reference article
Here is an excerpt from the article:
Several HTTP transport options can be configured through the com.amazonaws.ClientConfiguration object. Default values will suffice for the majority of users, but users who want more control can configure:
Socket timeout
Connection timeout
Maximum retry attempts for retry-able errors
Maximum open HTTP connections
以下是如何操作的示例:
Downloading files >3Gb from S3 fails with "SocketTimeoutException: Read timed out"