The issue is an inability to resolve the DB host but it's not persistent.
Environment:
AWS EC2 Ubuntu 16.04
connecting to:
MYSQL 5.7 RDS
This started just after an upgrade from Ubuntu 14.04 to 16.04.
It works probably 99/100 tries, but then fails and throws this exception: An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known.
It appears amazon supplies a local DNS server for your EC2 instance. I believe it has a request limit which causes failure if you go over it. My fix was to add this file: "/etc/resolvconf/resolv.conf.d/tail;" with the contents "nameserver 1.1.1.1" basically setting 1.1.1.1 as my fallback DNS server. It's a bit slower since it's outside the network, but it's better than a complete failure.
Source: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-dns-limits
Related
I am using Linux and trying to simulate a ibm mq server by myself via podman, however i got issue in podman run. I have added the docker.io to localhost in /etc/hosts. however i still got this issue, does someone know what i am missing here?
Thank you in advance.
Calling podman run to start the server in container [ibm_mqserver] public port is [51672] ...
Trying to pull docker.io/ibmcom/mq:latest...
Error: initializing source docker://ibmcom/mq:latest: pinging container registry registry-1.docker.io: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:62268->[::1]:53: read: connection refused
below is the error screenshot
Podman Run Error screenshot
As of writing the location for the latest MQ image is icr.io/ibm-messaging/mq:latest
I'm attempting to connect to a local Postgres server running as a docker container from my Lambda function.
I'm using the sam local invoke call to do so.
For some reason, it seems that outgoing connection from SAM's docker container for the function is disabled.
I'm getting this error message:
"errorMessage": "(psycopg2.OperationalError) could not connect to server: Connection refused\n\tIs the server running on host \"localhost\" (127.0.0.1) and accepting\n\tTCP/IP connections on port 5432?\ncould not connect to server: Cannot assign requested address\n\tIs the server running on host \"localhost\" (::1) and accepting\n\tTCP/IP connections on port 5432?\n\n(Background on this error at: http://sqlalche.me/e/e3q8)",
Is there a way to enable a Lambda function call to a local docker database?
I have no issues running the connection code outside the Lambda function as standard Python code - so I'm sure my database is up, my code works, etc.
Try running the command with —docker-network TEXT per the AWS SAM CLI documentation.
I had a similar issue attempting to run sam local start-api with a local Docker Postgres database and was getting connection refused errors. I ran sam local start-api —docker-network host and it resolved the issue.
This is a good post which helped me to understand more about Docker networks.
Hope this helps you and any others looking at this.
I resolve this by replacing localhost with host.docker.internal.
For example if you use psycopg2
conn = psycopg2.connect(host="host.docker.internal",port=5432, ...)
My phpmyadmin showing this error, I am working on Ubuntu OS:
2002 - Connection refused — The server is not responding (or the local server's socket is not correctly configured)
mysqli_real_connect(): (HY000/2002): Connection refused
Connection for controluser as defined in your configuration failed
mysqli_real_connect(): (HY000/2002): Connection refused
This problem is occurred on Ubuntu, I tried all previous stack overflow answers, but it doesn't work for me.
I faced that similar problem using lamp , check if you may have more than two mysql path like in
Find all the other mysql installed in your system
`whereis mysql`
`mysql: /opt/lampp/bin/mysql /opt/lampp/bin/mysql.server /usr/share/man/man1/mysql.1.gz`
Now if in you're system two mysql if overlapping then remove others and keep only one mysql installed by lamp
sudo rm -rf /etc/mysql
Here is the link i found for apache2 i did the same with mysql and it's working
http://xmodulo.com/how-to-uninstall-and-remove-apache2-on-ubuntu-debian.html
Finally stop all the mysql existing service running
sudo service mysql stop
sudo /etc/init.d/apache2 stop
sudo /opt/lampp/lampp start
After connecting to VPN I am facing issue with docker-machine create on windows 7. This is the error coming:
This machine has been allocated an IP address, but Docker Machine could not
reach it successfully.
SSH for the machine should still work, but connecting to exposed ports, such as
the Docker daemon port (usually :2376), may not work properly.
You may need to add the route manually, or use another related workaround.
This could be due to a VPN, proxy, or host file configuration issue.
You also might want to clear any VirtualBox host only interfaces you are not using.
Checking connection to Docker...
Error creating machine: Error checking the host: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168
.99.101:2376": dial tcp 192.168.99.101:2376: connectex: No connection could be made because the target machine actively refused it.
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which might stop running containers.
This issue is coming when connecting to vpn. Can anyone please help me with this issue?
Thanks,
Sanjiv
I have a PHP application running on homestead box. This application makes calls to another app that is running on glassfish on my localhost:8080.
When PHP application sends the request to localhost:8080, I am getting following error:
ConnectException in RequestException.php line 49:
cURL error 7: Failed to connect to localhost port 8080: Connection refused
Still I can make calls to localhost:8080 from web browser.Anyone has any suggestion?
Seeing how your application is running in Homestead (which by default is available on 192.168.10.10 and is forwarded to also be accessible on localhost:8000) your application running on Glassfish will not have access to it using localhost:8080. This is because localhost in your vagrant box (Homestead) is not actually the same localhost as on the host machine.
What you could do is grab the ip address from the host machine and connect to it from your application running in Homestead.
So here is how I could solve the problem. Vagrant is the guest machine running on my localhost as host machine. To access host from guest, you need to use gateway from VB.
I found this answer which helped me to access my application on localhost.