Question

pgbouncer.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

userlist.txt

"postgres" "postgres1"

It can be connected by psql:

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

But try connect from application:

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>

When restart Jira, the database can't be connected again:

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.)

I am testing it in one server. Jira is installed at jira user. pgBouncer is running under postgres user.

Was it helpful?

Solution

This works:

<url>jdbc:postgresql://127.0.0.1:5432/jiradb</url>
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top