简体   繁体   English

使用亚马逊s3作为PHP应用程序的数据库(各种各样)做出错误的决定?

[英]Is using Amazon s3 as a database (of sorts) for a PHP app a bad decision?

I'm teaching myself JavaScript and PHP by building an app, and I decided I would like to use Amazon EC2 and S3 as the platform. 我通过构建应用程序自学JavaScript和PHP,我决定使用Amazon EC2和S3作为平台。 My question is about using S3 as a "database", but I'll start with a bit of background. 我的问题是关于使用S3作为“数据库”,但我将从一些背景开始。

The app uses this class to interact with S3 buckets: http://undesigned.org.za/2007/10/22/amazon-s3-php-class/documentation#getObject 该应用程序使用此类与S3存储桶交互: http//undesigned.org.za/2007/10/22/amazon-s3-php-class/documentation#getObject

When a user logs into the app, the app will download a file from a S3 bucket. 当用户登录应用程序时,应用程序将从S3存储桶下载文件。 Every user has their own file. 每个用户都有自己的文件。 Using JSON, it will then bring the data client side, and then most of the "interaction" is client side (using JavaScript) and a bit of PHP. 使用JSON,它将带来数据客户端,然后大多数“交互”是客户端(使用JavaScript)和一些PHP。 Once the user is done (probably after 30 minutes or so), the app will then save/upload and replace the S3 file. 一旦用户完成(可能在30分钟左右),应用程序将保存/上传并替换S3文件。

My reasoning behind all of this is that I think the app will be very scalable. 我所有这一切背后的原因是我认为该应用程序将具有很高的可扩展性。 My hope is that I can use load balancing, with each instance being able to interact directly with S3. 我希望我可以使用负载平衡,每个实例都可以直接与S3交互。 If lots of users log on, I can simply create lots of "micro" or "small" instances to handle them all. 如果有很多用户登录,我可以简单地创建许多“微”或“小”实例来处理它们。 One of the drawbacks of EC2 is if the instance crashes or goes offline, all the data is lost, so my thoughts are that instead of constantly having to back up everything - why not build the app around S3 in the first place? EC2的一个缺点是如果实例崩溃或脱机,所有数据都会丢失,所以我的想法是,而不是经常不得不备份所有内容 - 为什么不首先在S3周围构建应用程序?

My question: Does this make sense? 我的问题:这有意义吗? Is there a reason I haven't seen many examples of this kind of thing "in the real world"? 有没有理由我没有在“现实世界”中看到过很多关于这种事情的例子?

Thank you so much for your time! 非常感谢您的参与!

Cheers, 干杯,

I just visited this site that has a good description of experiences with using S3 as database 我刚访问过这个网站,它很好地描述了使用S3作为数据库的经验

http://petewarden.typepad.com/searchbrowser/2010/10/how-i-ended-up-using-s3-as-my-database.html http://petewarden.typepad.com/searchbrowser/2010/10/how-i-ended-up-using-s3-as-my-database.html

Have you seen Amazon SimpleDB ? 你见过Amazon SimpleDB吗?

Creating your own datastore and storing it on S3 doesn't sound that practical, especially as you have to upload and download a file every 30 minuites, that hardly sounds scalable to me! 创建自己的数据存储区并将其存储在S3上听起来并不实用,特别是因为你必须每隔30分钟上传和下载一个文件,这对我来说几乎听起来不太可能! What if your server goes down or the file gets lost? 如果您的服务器出现故障或文件丢失怎么办?

You can run MySQL and other databases on Amazon, why not back those up (say daily) to S3 instead. 您可以在亚马逊上运行MySQL和其他数据库,为什么不将它们(比如说每天)备份到S3。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM