By AAnsari1998
Hey , i’ve been running a discord bot script on my digital ocean droplet(ubuntu 16.04) for going on 3 years now. Recently i’ve been trying to rewrite it to a newer library but for whatever reason my postgresql connect command consistently throws a Timeout Error when i try to run it from my desktop. However the same script running on the vps itself works perfectly fine for some reason.
This would lead me to think that it’s a firewall error however i have double checked and my sql server port is forwarded which is also evidenced by the fact that i can consistently use PGAdmin to view the database from my desktop.
Another point of notice is that sometimes my droplet starts acting up where even ssh’ing into it using putty times out and i have to try a handful of times before i can get in which makes me guess that it’s a digital ocean side issue ?
I have checked my internet connection and it’s stable so that’s not the issue either. I’m fairly confused about this as i’ve never had any troubles in the 3 years i’ve been using DO before this ; any insight and help is appreciated.
This is the exact error my script raises on my desktop. TimeoutError: [Errno 10060] Connect call failed (‘my ip’, 5432)
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there @AAnsari1998,
I believe that you would need to enable remote connections on PostgreSQL server. To do that you need to edit your pg_hba.conf configuration file and add the following:
host all all your_home_ip_address_or_range/32 md5
After that change:
listen_addresses = 'localhost'
To:
listen_addresses = '*'
And finally, restart your PostgreSQL service.
Also as you mentioned, make sure that port 5432 is open for TCP connections from your IP address.
Hope that this helps! Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.