Is the server running on host "localhost" (127.0.0.1) and accepting TCP / IP connections on port 5432?

1

I have a DJANGO application on a server (digitalocean). Following a tutorial I have put the application in production with gunicorn, nginx, supervisor and postgres. It worked correctly, but then I restarted the server (reboot) and it no longer connects me to the database, neither from the console in localhost, nor from / admin in the browser or from pgAdmin.

The postgrest service is running:

sudo service postgresql status
  

● postgresql.service - PostgreSQL RDBMS    Loaded: loaded
> (/lib/systemd/system/postgresql.service; enabled; vendor preset:
> enabled)    Active: active (exited) since jue 2017-10-19 22:08:00 UTC;
> 9min ago   Process: 2167 ExecStart=/bin/true (code=exited,
> status=0/SUCCESS)  Main PID: 2167 (code=exited, status=0/SUCCESS)
> 
> oct 19 22:08:00 ubuntu-512mb-nyc1-01 systemd[1]: Starting PostgreSQL
> RDBMS... oct 19 22:08:00 ubuntu-512mb-nyc1-01 systemd[1]: Started
> PostgreSQL RDBMS.

netstat -na
  

active Internet connections (servers and established)
>     Proto Recv-Q Send-Q Local Address           Foreign Address         State      
>     tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN     
>     tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
>     tcp        0    316 67.207.91.208:22        95.20.34.170:39956      ESTABLISHED
>     tcp6       0      0 :::22                   :::*                    LISTEN



nmap -p 5432 -PN Localhost

> Starting Nmap 7.01 ( https://nmap.org ) at 2017-10-19 22:20 UTC Nmap
> scan report for localhost (127.0.0.1) Host is up (0.00017s latency).
> PORT     STATE  SERVICE 5432/tcp closed postgresql

Therefore the problem is that the port is closed, no ??

The postgresql.conf file looks like this:

The pg_hba.conf file looks like this:

I'm using UBUNTU.

How can I open the port ??

What solution do you give me?

    
asked by David 20.10.2017 в 00:25
source

1 answer

2

After several days I finally found the solution to the problem.

Apparently when installing postgres you have to tell them what version you want to install.

So what I did was uninstall postgres and install it again but manually putting the latest version.

$ sudo apt-get --purge remove postgresql-9.6


$ sudo apt install postgresql-9.6
    
answered by 23.10.2017 / 18:38
source