Confluence unable to connect to PostgreSQL due to unconfigured pg_hba.conf file
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
症状
Unable to connect to PostgreSQL database upon the installation or startup. The following appears in the atlassian-confluence.log
:
ERROR [http-80-2] [confluence.setup.actions.AbstractSetupDatabaseAction] setupDatabase Unable to connect to database: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "10.90.8.29", user "confluenceuser", database "confluence", SSL off
-- referer: http://localhost/setup/setupstandarddb-start.action?database=postgresql | url: /setup/setupstandarddb.action | userName: anonymous | action: setupstandarddb
com.atlassian.config.bootstrap.BootstrapException: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "10.90.8.29", user "confluenceuser", database "confluence", SSL off
at com.atlassian.config.bootstrap.DefaultAtlassianBootstrapManager.getTestDatabaseConnection(DefaultAtlassianBootstrapManager.java:359)
at com.atlassian.confluence.setup.actions.SetupStandardDatabaseAction.setupDatabase(SetupStandardDatabaseAction.java:32)
at com.atlassian.confluence.setup.actions.AbstractDatabaseCreationAction.execute(AbstractDatabaseCreationAction.java:24)
...
原因
Client authentication is controlled by a configuration file, which traditionally is named pg_hba.conf and is stored in the database cluster's data directory. For more information on postgres configuration file details:
http://www.postgresql.org/docs/9.2/static/auth-pg-hba-conf.html
ソリューション
Add the IP address of the Confluence server to the pg_hba.conf
and make sure that the method is not set to reject
. You need to modify the xxx.xxx.xxx.xxx and put the IP address to allow connections.
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all xxx.xxx.xxx.xxx md5
# IPv6 local connections:
host all all ::1/128 md5
Another example, 192.168.132.17/24 where 24 is the mask which would be 255.255.255.0. If it was 255.255.0.0 then the number would be 16. For more information consult the pg_hba.conf documentation page.
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 192.168.132.17/24 trust
# IPv6 local connections:
host all all ::1/128 md5
For any changes made to the pg_hba file, please restart Postgres to pick up the change.