Postgresql

為什麼 Jira 無法使用 pgBouncer 連接數據庫?

  • April 12, 2021

彈跳器.ini

[databases]
jiradb = host=127.0.0.1 port=5432 dbname=jiradb

[pgbouncer]
listen_port = 6432
listen_addr = 127.0.0.1
auth_type = md5
auth_file = userlist.txt
logfile = pgbouncer.log
pidfile = pgbouncer.pid
admin_users = postgres

使用者列表.txt

"postgres" "postgres1"

它可以通過以下方式連接psql

psql -p 6432 -h 127.0.0.1 -U postgres jiradb
(Prompt password: postgres1)

但嘗試從應用程序連接:

Jira dbconfig.xml:

<?xml version="1.0" encoding="UTF-8"?>

<jira-database-config>
 <name>defaultDS</name>
 <delegator-name>default</delegator-name>
 <database-type>postgres72</database-type>
 <schema-name>public</schema-name>
 <jdbc-datasource>
   <url>jdbc:postgresql://127.0.0.1:6432/jiradb</url>
   <driver-class>org.postgresql.Driver</driver-class>
   <username>postgres</username>
   <password>postgres1</password>
   <pool-min-size>20</pool-min-size>
   <pool-max-size>20</pool-max-size>
   <pool-max-wait>30000</pool-max-wait>
   <validation-query>select 1</validation-query>
   <min-evictable-idle-time-millis>60000</min-evictable-idle-time-millis>
   <time-between-eviction-runs-millis>300000</time-between-eviction-runs-millis>
   <pool-max-idle>20</pool-max-idle>
   <pool-remove-abandoned>true</pool-remove-abandoned>
   <pool-remove-abandoned-timeout>300</pool-remove-abandoned-timeout>
   <pool-test-on-borrow>false</pool-test-on-borrow>
   <pool-test-while-idle>true</pool-test-while-idle>
 </jdbc-datasource>
</jira-database-config>

重啟jira後,無法再次連接數據庫:

Database: JIRA couldn't connect to your database

JIRA failed to establish a connection to your database.
This could be because:

   Your database isn't running
   The configuration of your dbconfig.xml file is incorrect (user, password, or database URL etc.)
   There is a network issue between JIRA and your database (e.g. firewall, database doesn't allow remote access etc.)

我正在一台伺服器上對其進行測試。Jira 安裝在jira使用者處。pgBouncer 在postgres使用者下執行。

這有效:

<url>jdbc:postgresql://127.0.0.1:5432/jiradb</url>

引用自:https://dba.stackexchange.com/questions/261271