could not connect to server: Connection refused Is the server running on host

1,268 views
Skip to first unread message

Pasquale Dahlmanns

unread,
Oct 28, 2021, 5:58:29 AM10/28/21
to NetBox
Getting the following error:

<class 'django.db.utils.OperationalError'>
could not connect to server: Connection refused Is the server running on host "192.168.2.40" and accepting TCP/IP connections on port 5432? Python version: 3.6.8 NetBox version: 2.11.8

Brian Candler

unread,
Oct 28, 2021, 6:47:54 AM10/28/21
to NetBox
That's a pretty clear error message.  Netbox is trying to connect to a database on address 192.168.2.40 port 5432, and the connection is refused.

On the remote database server 192.168.2.40: either postgres isn't running, or it isn't configured to accept connections over the network (perhaps it's listening on 127.0.0.1), or it's blocking connections with firewall rules.  It's an issue with configuration of your postgres server anyway.

However if 192.168.2.40 *is* your netbox server, and netbox and postgres are both running there, then you should set 'HOST': 'localhost' in your configuration.py

Pasquale Dahlmanns

unread,
Oct 28, 2021, 7:05:16 AM10/28/21
to NetBox
I was trying to do some upgrading and when we set back a backup from Vmware it suddenly gave this error, however as of speaking now doing a restart command suddenly fixed it :P

Op donderdag 28 oktober 2021 om 12:47:54 UTC+2 schreef Brian Candler:
Reply all
Reply to author
Forward
0 new messages