Confluence PostgreSQL JDBC direct connection refused

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

問題

The following appears in the atlassian-confluence.log file, indicating a connection refused when using Confluence with JDBC direct connection string:

org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

診断

環境

  • PostgreSQL database

Diagnostic Steps

Here are some quick and handy diagnostic scripts:

ps -f -u postgres 

This should list the PostgreSQL processes in your environment:

sudo lsof -n -u postgres |grep LISTEN or sudo netstat -ltnp | grep postgres

This will show the TCP/IP addresses and ports that your instance of PostgreSQL is listening upon.

原因

This is a configuration issue with PostgreSQL, not Confluence. The root cause is that the PostgreSQL pga_hba.conf file is not set to TRUST versus IDENT as usually found under:

/var/lib/pgsql/data/pg_hba.conf

and shown herein below:

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
 
# "local" is for Unix domain socket connections only
local   all         all                               ident
 
# IPv4 local connections:
host    all         all         127.0.0.1/32          ident
host    all         all         100.200.300.50/32       ident
 
# IPv6 local connections:
host    all         all         ::1/128               ident

IP address range 100.200.300.50/32 is only used herein for purposes of example, please do not use that address.

ソリューション

  • Open the file /var/lib/psql/pg_hba.conf in your favorite text editor of choice with appropriate permissions
  • You may have to use sudo to obtain the correct permissions to edit and save the file as needed
  • Edit the file, altering the values written as IDENT above to TRUST as shown below

    # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
     
    # "local" is for Unix domain socket connections only
    local   all         all                               trust
     
    # IPv4 local connections:
    host    all         all         127.0.0.1/32          trust
    host    all         all         100.200.300.50/32       trust
     
    # IPv6 local connections:
    host    all         all         ::1/128               ident
    

説明 The following appears in the atlassian-confluence.log file, indicating a connection refused when using Confluence with JDBC direct connection string: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
製品Confluence
プラットフォームServer
最終更新日: 2018 年 10 月 19 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.