请教这个问题:MySQL Connection Error: (2002) php_network_getaddresses
来源:7-4 在swarm集群里通过service部署wordpress
yjcia
2018-05-07
阿里云环境
1.mysql
docker service create --name mysql --env MYSQL_ROOT_PASSWORD=root --env MYSQL_DATABASE=wordpress --network demo --mount type=volume,source=mysql-data,destination=/var/lib/mysql mysql
6dy11svkuz8oi14522jf61nh4
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged
2.wordpress
[root@iZ2zebnlswk1d44x5zohfoZ ~]# docker service create --name wordpress -p 8089:80 --env WORDPRESS_DB_PASSWORD=root --env WORDPRESS_DB_HOST=mysql --network demo wordpress
qwo3b489lkqlgvbsu04jzgrd2
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged
3.docker service logs wordpress
MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
连接异常!
补充一下:
root@iZ2zebnlswk1d44x5zohfoZ ~]# docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
6dy11svkuz8o mysql replicated 1/1 mysql:latest
qwo3b489lkql wordpress replicated 1/1 wordpress:latest *:8089->80/tcp
2回答
-
yjcia
提问者
2018-05-07
初步排查原因:
1.阿里云3306 端口被防火墙阻隔,需要开启
022018-05-07 -
yjcia
提问者
2018-05-07
补充一下:
root@iZ2zebnlswk1d44x5zohfoZ ~]# docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
6dy11svkuz8o mysql replicated 1/1 mysql:latest
qwo3b489lkql wordpress replicated 1/1 wordpress:latest *:8089->80/tcp
00
相似问题