Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

890
Visualizações
could not connect to server: Connection refused Is the server running on host ... and accepting TCP/IP connections on port 5432?

I have just deployed a Postgres / timescaleDB on Ubuntu in AWS.

When I ssh my postgres VM, I can connect pgsql via CLI.

ubuntu@ip-172-31-35-57:~$ psql -U julien -h localhost db
Password for user julien: 
psql (12.3 (Ubuntu 12.3-1.pgdg20.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.

db=> 

I can also see postgres is listening

ubuntu@ip-172-31-35-57:~$ sudo netstat -nlpute
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode      PID/Program name    
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      101        46086      6152/systemd-resolv 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          20033      700/sshd: /usr/sbin 
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      113        62083      20332/postgres      
tcp6       0      0 :::80                   :::*                    LISTEN      0          68924      23549/apache2       
tcp6       0      0 :::22                   :::*                    LISTEN      0          20044      700/sshd: /usr/sbin 
udp        0      0 127.0.0.53:53           0.0.0.0:*                           101        46085      6152/systemd-resolv 
udp        0      0 172.31.35.57:68         0.0.0.0:*                           100        651337     6134/systemd-networ 

I checked ufw:

ubuntu@ip-172-31-35-57:~$ sudo ufw status
Status: inactive

I also opened fully Security Groups.

But still, I cannot connect my postgres DB from local.

With a local Postgres DB, I have no problem ( my app works )

What did I forget ???

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

  1. Check listen_addresses in postgresql.conf file allowed remote connections. It should be

    listen_addresses = '*'

  2. In pg_hba.conf file you need to add following entry

    host all all 0.0.0.0/0 md5

  3. Be sure it is not a firewall issue.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda