回形针、大文件上传和 AWS

发布于 2024-07-30 19:57:02 字数 415 浏览 2 评论 0原文

所以,我使用 Paperclip 和 AWS-S3,这非常棒。 而且效果很好。 不过,只有一个问题:我需要上传非常大的文件。 超过 50 MB。 就这样,nginx 死了。 那么显然 Paperclip 在前往 S3 之前将内容存储到磁盘上?

我发现了这个 非常酷的文章,但它似乎也是先写入磁盘,然后在后台执行其他所有操作。

理想情况下,我能够在后台上传文件...我有少量使用 PHP 执行此操作的经验,但到目前为止还没有使用 Rails 的经验。 有人能给我指出一个大概的方向吗?

So, I'm using Paperclip and AWS-S3, which is awesome. And it works great. Just one problem, though: I need to upload really large files. As in over 50 Megabytes. And so, nginx dies. So apparently Paperclip stores things to disk before going to S3?

I found this really cool article, but it also seems to be going to disk first, and then doing everything else in the background.

Ideally, I'd be able to upload the file in the background... I have a small amount of experience doing this with PHP, but nothing with Rails as of yet. Could anyone point me in a general direction, even?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

请别遗忘我 2024-08-06 19:57:02

您可以完全绕过服务器并直接上传到 S3,这将防止超时。 同样的事情也发生在 Heroku 上。 如果您使用的是 Rails 3,请查看我的示例项目:

使用 Rails 3、Flash 和基于 MooTools 的 FancyUploader 直接上传到 S3 的示例项目:https://github.com/iwasrobbed/Rails3-S3-Uploader-FancyUploader

使用 Rails 3、Flash/Silverlight/GoogleGears/BrowserPlus 和基于 jQuery 的 Plupload 的示例项目直接上传到 S3: https://github.com/iwasrobbed/Rails3-S3-Uploader -Plupload

顺便说一下,您可以使用 Paperclip 进行后期处理,使用类似这篇博客文章(Nico 写的)所描述的内容:

http://www.railstoolkit.com/posts/fancyupload-amazon-s3-uploader-with-paperclip

You can bypass the server entirely and upload directly to S3 which will prevent the timeout. The same thing happens on Heroku. If you are using Rails 3, please check out my sample projects:

Sample project using Rails 3, Flash and MooTools-based FancyUploader to upload directly to S3: https://github.com/iwasrobbed/Rails3-S3-Uploader-FancyUploader

Sample project using Rails 3, Flash/Silverlight/GoogleGears/BrowserPlus and jQuery-based Plupload to upload directly to S3: https://github.com/iwasrobbed/Rails3-S3-Uploader-Plupload

By the way, you can do post-processing with Paperclip using something like this blog post (that Nico wrote) describes:

http://www.railstoolkit.com/posts/fancyupload-amazon-s3-uploader-with-paperclip

疾风者 2024-08-06 19:57:02

也许你必须增加 ngix 配置中的超时?

Maybe you have to increase the timeout in the ngix configs?

没有心的人 2024-08-06 19:57:02

您可能对我的帖子感兴趣:

http://www .railstoolkit.com/posts/fancyupload-amazon-s3-uploader-with-paperclip

它是将多个文件(同时带有进度条)直接上传到 S3,而无需访问服务器。

You might be interested in my post here:

http://www.railstoolkit.com/posts/fancyupload-amazon-s3-uploader-with-paperclip

Its about uploading multiple files (with progress bars, simultaneously) directly to S3 without hitting the server.

金兰素衣 2024-08-06 19:57:02

我遇到了类似的问题,但是使用回形针、乘客和 apache。
与 nginx 一样,apache 在 apache 中有一个 Timeout 指令,我增加了它来解决我的问题。

另外,乘客在上传大文件时会做一件有趣的事情。
任何超过 8k 的内容都会写入 /tmp/passenger。 如果 apache 没有
在那里写的权限你也会得到 500 个错误。

这是文章。
http://tinyw.in/fwVB

I was having a similar problem but with using paperclip, passenger and apache.
Like nginx, apache has a Timeout directive in apache which I increased to solve my problem.

Also there's an interesting thing passenger does when uploading large files.
Anything over 8k is written to /tmp/passenger. and if apache doesn't have
permissions to write there you get 500 errors also.

Here's the article.
http://tinyw.in/fwVB

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文