dimanche 19 avril 2015

NodeJs on DigitalOcean cannot connect to MySQL database on Amazon RDS

We deployed the NodeJS web service on DigitalOcean and connect to MySQL database on Amazon RDS. i can use Navicat Premium to remote to MySQL RDS and also works fine with NodeJS localhost (it means my application on localhost can connect to RDS database)


But when i deployed my app to DigitalOcean server. It cannot connect to MySQL RDS. The connect was timed out.


I use command to view opening port:



iptables -L


And the result is:



Chain INPUT (policy ACCEPT)
target prot opt source destination

ACCEPT tcp -- anywhere anywhere tcp dpt:3000
ACCEPT tcp -- anywhere anywhere tcp dpt:mysql
ACCEPT tcp -- anywhere anywhere tcp dpt:3000
ACCEPT tcp -- anywhere anywhere tcp dpt:mysql
ACCEPT tcp -- anywhere anywhere tcp dpt:mysql

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

ACCEPT tcp -- anywhere anywhere tcp dpt:mysql


I see output and input also opened for port 3306. But NodeJs still cannot connect. The problem is DigitalOcean droplet does not open port 3306 and NodeJS application cannot connect to outside via this port.


(P/S: Amazon RDS also opened all ports and anywhere for IP)


Please help me, thanks


Aucun commentaire:

Enregistrer un commentaire