简体   繁体   English

AWS EC2 突然无法连接 RDS?

[英]AWS EC2 suddenly cannot connect to RDS?

Suddenly, wordpress cannot connect to my RDS.突然,wordpress 无法连接到我的 RDS。 all configurations and inbound/outbound rules are correct.所有配置和入站/出站规则都是正确的。 I also tried creating basic php function to connect.. I tried it on my local machine and it's working but not on my EC2 server.我还尝试创建基本的 php function 进行连接。我在本地机器上尝试过,它可以工作,但在我的 EC2 服务器上没有。

$mysqli_connection = new MySQLi('xxxx.xxxxx.ap-southeast-1.rds.amazonaws.com', 'db_user', 'db_pass', 'db_name');
if ($mysqli_connection->connect_error) {
   echo "Not connected, error: " . $mysqli_connection->connect_error;
}
else {
   echo "Connected.";
}

Error: php_network_getaddresses: getaddrinfo failed: Name or service not known错误: php_network_getaddresses:getaddrinfo 失败:名称或服务未知

Just this morning this happened, I didn't do anything at all.就在今天早上发生了这种情况,我什么都没做。 Maybe this is an Apache error or something?也许这是一个 Apache 错误或什么? any help please?请问有什么帮助吗?

To those who might be facing the same issue.对于那些可能面临同样问题的人。 Rebooting the EC2 instance fixed the problem.重启 EC2 实例解决了这个问题。

Also, check if your volume is not full.另外,请检查您的音量是否未满。 run df -a in your ec2 through ssh to check通过 ssh 在您的 ec2 中运行df -a进行检查

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM