-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception For database connection Timeout. Store IP of Database in cache #1748
Comments
This is not caused by the driver. It doesn't perform any DNS caching. Your operating system / network stack is probably doing it though. Check the DNS records for your database to see what the TTL (Time To Live) value. That's how many seconds the value can be cached. The default for your DNS provider is probably something large like 3600 (1 hour) or 7200 (2 hours). A smaller value like 60 (1-minute) would lower the failover time. |
I ran into similar issue. Our DB is hosted by Amazon's RDS and we connect to it by hostname, when RDS goes through upgrade our apps immediately go to |
I think the "problem" ist this: node-postgres/lib/connection-parameters.js Line 130 in 0993e4b
It's only called once upon initialisation |
When We have created database connection through connection string, it might store ip in the cache in your library and for next every connection it uses that IP. Now my database configuration changed but host, username, password is same and private ip of database changed. Now pg library try to connect on old IP and we are having new IP. So my every API gets failed.
{ "message": "error: terminating connection due to administrator command at Connection.parseE (/usr/src/app/node_modules/pg/lib/connection.js:545:11) at Connection.parseMessage (/usr/src/app/node_modules/pg/lib/connection.js:370:19) at Socket.<anonymous> (/usr/src/app/node_modules/pg/lib/connection.js:113:22) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at Socket.Readable.push (_stream_readable.js:208:10) at TCP.onread (net.js:597:20)", "timestamp": "2018-10-09T04:56:00.329Z", "type": "err", "process_id": 0, "app_name": "api-server" }
{ "message": "Error: connect ECONNREFUSED 11.0.3.5:5432 at Object._errnoException (util.js:992:11) at _exceptionWithHostPort (util.js:1014:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)", "timestamp": "2018-10-09T04:56:02.963Z", "type": "err", "process_id": 0, "app_name": "api-server" }
Here IP and PORT number is fake, but same error I was getting since last 3 days.
So I want to know the possible solution for this.
The text was updated successfully, but these errors were encountered: