Postgres PgAdmin 3: Server doesn't listen - Tried everything - postgresql

I tried opening ports in IPTables,
Set Listen address to *
Added
host all all 23.81.27.0/24 trust
and even
host all all 0.0.0.0/0 trust
YouGetSignal shows the port is closed, and i can't connect to my DB via PgAdmin.
I get
could not connect to server: Connection timed out (0x0000274C/10060)
Is the server running on host "23.81.27.206" and accepting TCP/IP
connections on port 5432?
Any ideas?
I already tried to reboot Postgresql, IPtables, and the server.

With this error
could not connect to server: Connection timed out (0x0000274C/10060)
Is the server running on host "23.81.27.206" and accepting TCP/IP
connections on port 5432?
no need to modify hba_file. Either listen_address in postgres.conf not set to listen on external iface, or firewall blocks it/ not translating/ othernetwork issues. First case often people modify listen_address in wrong postgres.conf or do not restart server. To make sure it did not happen to you, ssh to server, psql to it and check
show config_file;
show listen_addresses;
If those ok, then still on remotes shell :
psql -h 23.81.27.206
If you get connected, stop looking into postgres config - check network (firewall, PAT,NAT,routes, your client connection ((maybe you not connected to the Internet?..)))

Turns out it was IPTables after all. I did "Service iptables stop" And i can connect. I can't manage to allow my ip/open that port. But i guess this is how i have to do it. i just enable it whenever im done.

Related

How to connect pgadmin 4 to an external server?

I just created a server (droplets) in digital ocean, install postgresql, up there well, it works on the console. My problem is when I try to connect through pgadmin.
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "165.22.184.123" and accepting
TCP/IP connections on port 5432?
Look for information and modify the file
/etc/postgresql/10/main/postgresql.conf
where says listen_addresses='localhost' by listen_addresses='*'.
Also add a line to host all all 0.0.0.0/0 md5 to the file /etc/postgresql/10/main/pg_hba.conf and I still have the same problem. Do I have to do some additional configuration?

Can't connect to the default server of pgAdmin 4

I have just installed the pgAdmin-4, and trying to connect to the default server installed with it (PostgreSQL 9.5). It asks for the password (Which I assume by default it's "postgres"), however, I keep receiving the following message:
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
I am working on Windows 7.
Any ideas on how to fix this problem?
The first thing is to remove pgadmin from the problem. Try to connect with the command line using psql - if you get the same message you know that the problem is not with pgadmin. If the problem continues with psql then probably your configuration of postgresql is not complete. The issue might be in the file pg_hba.conf - this file controls who is allowed to connect to the backend. You might also check that the server application is running, using an appropriate Windows utility.

postgres server running in local host, but postico, pgadmin can't access to it

I successfully installed postgres through homebrew, and i set it run automatically by doing
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
So, right now i can access to psql from my terminal (i use iterm2 + oh my zsh)
psql (9.6.1)
Type "help" for help.
ty2kim=#
The problem is, postgres management tools like postico, pgadmin cannot access to it
for postico, error message is
could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5435?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5435?
which is weird because from my understanding, accessing to the database from terminal and management tools are basically the same if configured correctly
My pg_hba.conf and postgresql.conf are set as default (didn't make any changes there), but i tried doing
listen_addresses = 'localhost'
=>
listen_addresses = '*'
(restart server)
still didn't work
Please help!
Port 5435 is not standard for PostgreSQL. Are you sure PG is running on it? If you didn't change it in postgresql.conf it must be 5432. Please check it.
must check pg_hba.conf. If there doesn't have much restriction, you can put to end of this file by below line:
host all all all trust
After that, reload/restart instance.
Check if your PC is using firewall. If yes, please turn off it.

Canot connect to postgresql server from out

I want to connect to postgresql from another server but occur below error. i search and find some result like below but after do these again error occured
in postgresql.conf change listen_addresses from localhost to *
in pg_hba.conf change 127.0.0.1/32 to 0.0.0.0/0
reboot server
Error:
could not connect to server: Connection refused.Is the server running
on host "Ip Number"
and accepting.TCP/IP connections on port 5432?
I suggest that you should do as the following steps.
Check your PostgreSQL SERVER is running.
Check the listen_addresses parameter ( postgresql.conf )
Check the port number of your postgresql ( The port parameter of
postgresql.conf )
Check your the firewall policy of your database server , set
that allow the port of your postgresql.
If you want to connect your db from another server, may be you
shoud set the pg_hba.conf as following :
# TYPE DATABASE USER CIDR-ADDRESS METHOD
local all all trust
host all all 0.0.0.0/0 md5
Try to check if the network traffic reaches the server. You can sniff the network traffic to see what happen. Meassure on client and server and check the communication.
sudo tcpdump -A -n -s 0 -w test_on_client.log port 5432
After you try your connect stop tcpdump with CTRL-C and inspect the log file with Wireshark.
This procedure will find every network connection problems.

postgresql server doesn't listen

I just recently install PostgreSQL on our server via SSH. The installation went successful, until the time I tried to connect to it using pgAdmin on my Windows machine.I received this kind of error:
could not connect to server: Connection refused (0x0000274D/10061) Is
the server running on host "xxx.xxx.xxx.xxx" and accepting TCP/IP
connections on port 5432?
xxx.xxx.xxx.xxx = my server's public IP.
The docs suggest this can be fixed by setting the value of listen_addresses = '*' in the /etc/postgresql/9.1/main/postgresql.conf. I did that but still it won't let me.
additional error came up
FATAL: no pg_hba.conf entry for host "xxx.xx.xxx.xxx", user
"postgres", database "postgres", SSL on FATAL: no pg_hba.conf entry
for host "xxx.xx.xxx.xxx", user "postgres", database "postgres", SSL
off
xxx.xx.xxx.xxx = my IP address.
What seems to be I'm missing?
Things that could block a postgres connection:
misconfigured listen_address in postgresql.conf
selinux (?)
iptables
pg_hba.conf (although this should cause a different error, not server doesn't listen)
Can you connect to the server locally, if you ssh in and run psql?
On our internal dev servers, I just turn off selinux and iptables. This is a bad idea from a security standpoint, but it might serve as a temporary step to help you narrow down where the problem is.
You might need to change more than one configuration file. In your case, you probably need to edit pg_hba.conf, too. Search that file for "non-local connections".
I like to keep configuration files under version control. It's easier to recover from mistakes that way.
You probably need to restart the PostgreSQL server after making those changes.
After changing listen_addresses settings on the server, make sure to restart the PostgreSQL server (send SIGHUP to the postmaster process, with kill -HUP, etc).
Make sure that postgresql.conf port is set to 5432
Make sure that if a firewall is running on the server, that port 5432 is open for connections coming from the window's (client) machine you are using
Check pg_hba.conf to make sure that the subnet of your client machine is given access
Try using psql locally