"psycopg2.OperationalError: could not connect to server: Connection refused" error when bootstrapping

20,364

Solution 1

It looks like postgres is not running or not installed.

Try:

sudo service postgresql start

Solution 2

If the server is running and you still get the error, you must configure Postgres to accept connections from other IPs. In order to do so, locate the postgresql.conf file.

Look for listen_addresses property and replace localhost with the choice of your IPs separated by comma OR * to accept connections from any IP.

Restart the postgresql server. You should be good. :)

Share:
20,364

Related videos on Youtube

Sidiney Rodrigues
Author by

Sidiney Rodrigues

Student, TI, code, learning, ux, iot, curious, blogger, services, tech, teach.

Updated on September 18, 2022

Comments

  • Sidiney Rodrigues
    Sidiney Rodrigues over 1 year

    After the successful import of the ssh keypairs, the bootstrap generates this error.

    Can anyone help me?

    connection_factory=connection_factory, async=async)
    psycopg2.OperationalError: 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 5432?
    

    I have tried:

    • Ensuring PostgreSQL is installed and running via: 'sudo service postgresql start`

    This errors appears how i running 'sudo apt-get update'.

    • Sidiney Rodrigues
      Sidiney Rodrigues over 10 years
      In trying install maas as a service. I'm newbie! This occurs. I believe my proxy or other config is generate this error or my network config.
  • Sidiney Rodrigues
    Sidiney Rodrigues over 10 years
    Hi, thanks, but continuous get the same error.
  • Sidiney Rodrigues
    Sidiney Rodrigues over 10 years
    The error get in the if i apply Updates. Maybe my configuration port are broken or config with error. It's various days I seek help, and don't understand whats happening with the ssh key.
  • Jorge Castro
    Jorge Castro over 10 years
    @SidineyRodrigues Can you add anymore information to your question? Also please click the green check on this answer to mark it as unanswered, that way it can get more attention, thanks!
  • Sidiney Rodrigues
    Sidiney Rodrigues about 6 years
    I gave up trying to set up