Salta al contenuto

ECONNREFUSED Error in Log

0

Server is EBS and databse using Planetscale, when ever a query is run, following error appears in log.

Jun 21 14:52:50 ip-172-31-34-111 web: routeloginerr OperationalError: connect ECONNREFUSED 3.111.192.65:3306 Jun 21 14:52:50 ip-172-31-34-111 web: at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) Jun 21 14:52:50 ip-172-31-34-111 web: ... 16 lines matching cause stack trace ... Jun 21 14:52:50 ip-172-31-34-111 web: at Layer.handle [as handle_request] (/var/app/current/node_modules/express/lib/router/layer.js:95:5) { Jun 21 14:52:50 ip-172-31-34-111 web: cause: Error: connect ECONNREFUSED 3.111.192.65:3306 Jun 21 14:52:50 ip-172-31-34-111 web: at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) Jun 21 14:52:50 ip-172-31-34-111 web: -------------------- Jun 21 14:52:50 ip-172-31-34-111 web: at Protocol._enqueue (/var/app/current/node_modules/mysql/lib/protocol/Protocol.js:144:48) Jun 21 14:52:50 ip-172-31-34-111 web: at Protocol.handshake (/var/app/current/node_modules/mysql/lib/protocol/Protocol.js:51:23) Jun 21 14:52:50 ip-172-31-34-111 web: at PoolConnection.connect (/var/app/current/node_modules/mysql/lib/Connection.js:116:18) Jun 21 14:52:50 ip-172-31-34-111 web: at Pool.getConnection (/var/app/current/node_modules/mysql/lib/Pool.js:48:16) Jun 21 14:52:50 ip-172-31-34-111 web: at Pool.tryCatcher (/var/app/current/node_modules/bluebird/js/release/util.js:16:23) Jun 21 14:52:50 ip-172-31-34-111 web: at Pool.ret [as getConnectionAsync] (eval at make(/var/app/current/node_modules/bluebird/js/release/promisify.js:184:12), <anonymous>:13:39) Jun 21 14:52:50 ip-172-31-34-111 web: at getConnection (/var/app/current/dbqueries/dashUserAutheticateQuery.js:185:32) Jun 21 14:52:50 ip-172-31-34-111 web: at dashQueryAuthenticate (/var/app/current/dbqueries/dashUserAutheticateQuery.js:54:26) Jun 21 14:52:50 ip-172-31-34-111 web: at getCredentials (/var/app/current/dashboard/login.js:18:34) Jun 21 14:52:50 ip-172-31-34-111 web: at dashAuthenticate (/var/app/current/dashboard/login.js:62:12) Jun 21 14:52:50 ip-172-31-34-111 web: at dashAuthenticate (/var/app/current/allroutes/dashRoutes.js:1124:31) Jun 21 14:52:50 ip-172-31-34-111 web: at /var/app/current/allroutes/dashRoutes.js:1131:5 Jun 21 14:52:50 ip-172-31-34-111 web: at Layer.handle [as handle_request] (/var/app/current/node_modules/express/lib/router/layer.js:95:5) Jun 21 14:52:50 ip-172-31-34-111 web: at next (/var/app/current/node_modules/express/lib/router/route.js:144:13) Jun 21 14:52:50 ip-172-31-34-111 web: at Route.dispatch (/var/app/current/node_modules/express/lib/router/route.js:114:3) Jun 21 14:52:50 ip-172-31-34-111 web: at Layer.handle [as handle_request] (/var/app/current/node_modules/express/lib/router/layer.js:95:5) { Jun 21 14:52:50 ip-172-31-34-111 web: errno: -111, Jun 21 14:52:50 ip-172-31-34-111 web: code: 'ECONNREFUSED', Jun 21 14:52:50 ip-172-31-34-111 web: syscall: 'connect', Jun 21 14:52:50 ip-172-31-34-111 web: address: '3.111.192.65', Jun 21 14:52:50 ip-172-31-34-111 web: port: 3306, Jun 21 14:52:50 ip-172-31-34-111 web: fatal: true Jun 21 14:52:50 ip-172-31-34-111 web: }, Jun 21 14:52:50 ip-172-31-34-111 web: isOperational: true, Jun 21 14:52:50 ip-172-31-34-111 web: errno: -111, Jun 21 14:52:50 ip-172-31-34-111 web: code: 'ECONNREFUSED', Jun 21 14:52:50 ip-172-31-34-111 web: syscall: 'connect', Jun 21 14:52:50 ip-172-31-34-111 web: address: '3.111.192.65', Jun 21 14:52:50 ip-172-31-34-111 web: port: 3306, Jun 21 14:52:50 ip-172-31-34-111 web: fatal: true Jun 21 14:52:50 ip-172-31-34-111 web: } Jun 21 14:52:50 ip-172-31-34-111 web: loginAuthError: connect ECONNREFUSED 3.111.192.65:3306

Pls advise what action needs to be taken

posta un anno fa162 visualizzazioni

1 Risposta
0

The error "ECONNREFUSED" at IP 3.111.192.65:3306 indicates that your application is unable to establish a connection to the MySQL database. This is a common network connectivity issue that can occur for several reasons.

Based on the error logs, your application running on an EC2 instance (ip-172-31-34-111) is trying to connect to a MySQL database at 3.111.192.65:3306, but the connection is being refused.

Here are some potential causes and solutions:

  1. Network connectivity issues:
  • Ensure that the security groups for your EC2 instance allow outbound traffic to the database IP and port (3306).
  • Check if there are any network ACLs blocking the connection between your EC2 instance and the database.
  • Verify that the route tables are correctly configured to allow traffic between your application and the database.
  1. Database configuration:
  • Confirm that the MySQL server at 3.111.192.65 is running and listening on port 3306.
  • Verify that the database credentials in your application are correct.
  • Check if the database server is configured to accept connections from your EC2 instance's IP address.
  1. PlanetScale specific considerations:
  • If you're using PlanetScale, ensure that your database is properly set up to accept connections from AWS.
  • Verify that the connection string or configuration in your application matches what PlanetScale provides.
  • Check if there are any IP allowlisting requirements for PlanetScale that you need to configure.
  1. Firewall or security settings:
  • Check if there's a firewall on the database server that might be blocking incoming connections.
  • Ensure that the database's security settings allow connections from your application's IP address.

To troubleshoot further, you can:

con risposta un anno fa

AWS
TECNICO DI SUPPORTO

verificato un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.