1

I am new to heroku.I have deployed my app to heroku which has python script running on clock process.In that script I need to write to xml file using heroku's Ephemeral filesystem in /tmp folder and I would need url for that file so that I can use this url to do some other processing which reads data from this file.

4

1 回答 1

2

在 Heroku 上,您无法将文件/tmp设为可公开访问。访问该文件内容的唯一方法是将该文件http传输到其他地方,例如 Amazon S3,或者scp将其传输到其他服务器。

想一想:假设你有 10 个 dynos 正在运行,有人提出一个请求,导致newFile/tmp. 好吧,它只在/tmp你的一个测功机上。如果负载均衡器的下一个请求将您定向到不同的测功机,则该文件不存在。而且,您刚刚创建的测功机newFile可能在 5 秒后甚至不存在!Heroku 一直在上下旋转测功机。

HTTP 是一种无状态协议。如果你要正确地设计你的系统,你应该这样对待它。

于 2013-05-06T02:47:20.497 回答