I have received the following error when attempting to connect to an Arch Linux server:

PG::Error: could not connect to server: Connection refused Is the server running on host "" and accepting TCP/IP connections on port 5432?

but I have an entry in my pg_hba.conf file on that server:

hostssl replication replication md5

Actually... there are two lines like this. Is presence of the second line be expected to result in this error?

  • pg_hba.conf in your case it's TYPE DATABASE USER ADDRESS METHOD hostssl replcation replication md5 looks good... are You using Virtual machine? – Czachovic Mar 12 '15 at 15:10
  • 2
    Here you don't even get to the pg_hba.conf. The problem is stated in the message: the host either does not listen on that port, or the port is not available from host trying to connect. This latter can be a result of missing routing or firewalls or I don't know. – dezso Mar 12 '15 at 16:43

No. Duplicate entries are basically ignored.

The documentation of pg_hba.conf describes how the rules work pretty well:

The first record with a matching connection type, client address, requested database, and user name is used to perform authentication. There is no "fall-through" or "backup": if one record is chosen and the authentication fails, subsequent records are not considered. If no record matches, access is denied.

So the second and any subsequent duplicates will never be considered. So duplicate entires can not be the cause of your error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.