I have Aws EC2 (Nginx Debian) and RDS, with a simple php script
if ($mysqli_connection->connect_error) {
echo "Not connected, error: " . $mysqli_connection->connect_error;
}
else {
echo "Connected.";
}
sometimes get this error:
Not connected, error: php_network_getaddresses: getaddrinfo failed: Name or service not known
I have already reboot EC2, but the error still appears.
2
Answers
Have you checked the security group of the attached to RDS? Make sure the EC2 is visible in inbound rules and outbound rules.
According to this response the problem may be with DNS rate-limiting.
I would suggest trying a DNS cache, like
dnsmasq
, to reduce the number of requests.