gpt4 book ai didi

amazon-web-services - AWS ECS 容器链接 : MySQL connection refused

转载 作者:行者123 更新时间:2023-12-05 06:42:41 26 4
gpt4 key购买 nike

我试图用这个简单的例子链接 Amazon ECS(容器服务)中的两个容器:http://docs.aws.amazon.com/AmazonECS/latest/developerguide/example_task_definitions.html

出于某种原因,WordPress 容器无法访问 MySQL 数据库,从 WordPress 容器的日志中,我看到以下内容:

警告:mysqli::mysqli(): (HY000/2002): Connection refused in - on line 10

上面写着 DockerHub WordPress 容器会自动从链接的容器中获取 Root PW 和 HOST IP,所以为什么我会遇到这个问题。

我的 JSON 配置如下所示:

{
"requiresAttributes": [],
"taskDefinitionArn": "arn:aws:ecs:us-east-1:996820535158:task-definition/wordpress-task:2",
"status": "ACTIVE",
"revision": 2,
"containerDefinitions": [
{
"volumesFrom": [],
"memory": 128,
"extraHosts": null,
"dnsServers": null,
"disableNetworking": null,
"dnsSearchDomains": null,
"portMappings": [
{
"hostPort": 8080,
"containerPort": 80,
"protocol": "tcp"
}
],
"hostname": null,
"essential": true,
"entryPoint": null,
"mountPoints": [],
"name": "wordpress",
"ulimits": null,
"dockerSecurityOptions": null,
"environment": [],
"links": [
"mysql:mysql"
],
"workingDirectory": null,
"readonlyRootFilesystem": null,
"image": "wordpress",
"command": null,
"user": null,
"dockerLabels": null,
"logConfiguration": null,
"cpu": 500,
"privileged": null,
"expanded": false
},
{
"volumesFrom": [],
"memory": 128,
"extraHosts": null,
"dnsServers": null,
"disableNetworking": null,
"dnsSearchDomains": null,
"portMappings": [],
"hostname": null,
"essential": true,
"entryPoint": null,
"mountPoints": [],
"name": "mysql",
"ulimits": null,
"dockerSecurityOptions": null,
"environment": [
{
"name": "MYSQL_ROOT_PASSWORD",
"value": "root"
}
],
"links": null,
"workingDirectory": null,
"readonlyRootFilesystem": null,
"image": "mysql:latest",
"command": null,
"user": null,
"dockerLabels": null,
"logConfiguration": null,
"cpu": 500,
"privileged": null,
"expanded": false
}
],
"volumes": [],
"family": "wordpress-task"
}

最佳答案

问题已解决:内存设置得太低,128 显然对 MySQL 不够用,WordPress 可以处理。将内存设置为 300 解决了这个问题。

关于amazon-web-services - AWS ECS 容器链接 : MySQL connection refused,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36102651/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com