在ECS上运行Wordpress的Docker映像时如何在Wordpress中保留我的数据库? [英] How to persist my database in Wordpress when running docker image of Wordpress on ECS?

查看:144
本文介绍了在ECS上运行Wordpress的Docker映像时如何在Wordpress中保留我的数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在ECS上运行wordpress的docker镜像

I am running a docker image of wordpress on ECS

我将数据库用作Aurora "name": "WORDPRESS_DB_HOST",

I am using database as Aurora "name": "WORDPRESS_DB_HOST",

"value": "db.us-east-1.rds.amazonaws.com"

问题

如果我终止我的ECS实例并在另一个ECS实例上运行相同的任务,那么数据库将无法持久保存

If i terminate my ECS instance and run the same task on another ECS instance then the database is not persisting

我想要的

数据库可以持久保存,因此当我在另一个ECS实例上运行wordpress时,我可以运行相同的wordpress实例,即不必重新安装或重新发布或重新配置我的任何帖子/设置

The database to persist so that when i run wordpress on another ECS instance i can run the same instance of the wordpress that is i dont have to reinstall or repost or reconfigure any of my posts/settings

我到目前为止所做的事情

我在var/www/html/wp-content上安装了EFS,这基本上是只保留我的wp数据

I mounted EFS on var/www/html/wp-content ,What this basically does is persist my wp data only

问题

有什么办法可以使安装,配置,登录数据等保持不变吗?这样我就可以在任何ECS实例中运行任务配置,然后能够访问我的wordpress网站,而无需设置和重新发布我的所有内容?

Is there any way i can make the installation,configuration,log in data etc to persist ? So i can run the task configuration in lets say any ECS instance and then be able to access my wordpress site without setup and reposting all my content ?

推荐答案

如果您使用的是RDS实例,只需确保将适当的数据库相关环境变量添加到WordPress docker映像中即可:

If you're using an RDS instance, just be sure to add the proper database-related environment variables to the WordPress docker image:

WORDPRESS_DB_HOST=...
WORDPRESS_DB_USER=...
WORDPRESS_DB_PASSWORD=...
WORDPRESS_DB_NAME=...

您可以阅读完整的自述文件,以获取官方WordPress Docker映像的全部内容选项.

You can read the full README file for the official WordPress Docker image to understand all the options.

这篇关于在ECS上运行Wordpress的Docker映像时如何在Wordpress中保留我的数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆