在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.