[英]How to keep two MySQL databases of wordpress , AWS lightsail in sync?
I have got my client who wants following : 我有我的客户想要以下内容:
Suppose I apply 2 lightsail instances and one network load balancer for hosting two identical wordpress commerce sites. 假设我应用了2个lightail实例和一个网络负载平衡器来托管两个相同的wordpress商业站点。
How to ensure the databases, images, and plugin of wordpress are in sync? 如何确保Wordpress的数据库,图像和插件同步? It is because the order created by one user at one site, shall be recorded at the another database. 这是因为一个用户在一个站点上创建的订单应记录在另一个数据库中。
This is not a great use case for Lightsail (I'm the developer advocate for Lightsail, so you can trust me when I say that). 对于Lightsail来说,这不是一个很好的用例(我是Lightsail的开发者拥护者,所以当我这么说时,您可以信任我)。
You need to understand how WordPress work with regards to storing various data. 您需要了解WordPress在存储各种数据方面的工作方式。 There is a bunch of stuff stored in MySQL but there is also a bunch of stuff stored on the file system (including plugins, uploaded media, etc). MySQL中存储了一堆东西,但文件系统上还存储了一堆东西(包括插件,上传的媒体等)。
So you could fire up to lightsail instances, point them at a single lightsail database (or self-hosted MySQL) but that doesn't solve the issue with keeping the local filesystem in sync across the various instances. 因此,您可以启动lightail实例,将它们指向单个lightail数据库(或自托管的MySQL),但这不能解决在各个实例之间保持本地文件系统同步的问题。 Yo 哟
What you would really want with AWS is something like cloud front (for caching) in front of a load balancer. AWS真正想要的是负载平衡器之前的云前端(用于缓存)。 The LB fronts multiple EC2 instances that run WP. LB面向运行WP的多个EC2实例。 They are connected to an RDS instance running MYSQL as well as using a shared EFS* volume to host the file system.** 它们连接到运行MYSQL的RDS实例,并使用共享的EFS *卷托管文件系统。**
You can't do this on Lightsail because there is no good way to use EFS with Lightsail (even with VPC peering). 您无法在Lightsail上执行此操作,因为没有很好的方法将EFS与Lightsail一起使用(甚至与VPC对等)。
*Some will argue that EFS/NFS is not fast enough for WordPress, but I've seen with the right caching etc it be pretty effective. *有些人会认为EFS / NFS对于WordPress而言不够快,但是我已经看到了正确的缓存等,它非常有效。
**This one approach another is to use S3 to store common media, but I don't think that handles the issue w/ plugins - so maybe you want a combination of s3 for media and EFS for plug ins **另一种方法是使用S3存储常见的媒体,但我认为这无法解决带有插件的问题-因此,也许您希望将s3用于媒体,将EFS与用于插件的组合
It would be simpler and essentially as reliable to host a third database server and point both WP installs there. 托管第三个数据库服务器并将两个WP安装都指向该服务器将更简单,并且从根本上讲是可靠的。 In this case you would also be well served to set S3 offload and store uploads there. 在这种情况下,还可以很好地设置S3卸载并将存储的内容存储在那里。
TBH the db isn't your problem, keeping uploads, plugins and themes in sync is the more complicated issue TBH数据库不是您的问题,使上传,插件和主题保持同步是更复杂的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.