Documentation for JIRA 5.2. Documentation for other versions of JIRA is available too.

These instructions will help you connect JIRA to a PostgreSQL 8.2+ database.

(info) 注意:

1. Before You Begin

1.1 Are You Migrating JIRA to Another Server?

他のサーバーへの JIRA の移行 を実行する場合は、XML backup としてデータをエクスポートしてください。その後、 Switching databases で説明されているように、元のデータベースから新しいデータベースへデータを移行できます。

1.2 Shut Down JIRA

On this page:

2. Create and Configure the PostgreSQL Database

  1. Create a database user which JIRA will connect as (e.g. jiradbuser). (tick) Remember this database user name, as it will be used to configure JIRA's connection to this database in subsequent steps.
  2. Create a database for JIRA to store issues in (e.g. jiradb) with Unicode collation.

    CREATE DATABASE jiradb WITH ENCODING 'UNICODE';

    またはコマンドラインから

    $ createdb -E UNICODE jiradb
  3. Ensure that the user has permissions to connect to the database, and to create and write to tables in the database.
    (tick) Remember this database name, as it will be used to configure JIRA's connection to this database in subsequent steps.

3. Copy the PostgreSQL JDBC Driver to Your Application Server (JIRA WAR Only)

(warning) Skip this step if you installed a 'Recommended' distribution of JIRA, which (unlike JIRA WAR) includes the PostgreSQL JDBC driver.

  1. Download the PostgreSQL JDBC driver from http://jdbc.postgresql.org/download.html. (Obtain version 8.4 of the JDBC 4 driver.)
  2. Add the PostgreSQL JDBC driver jar to the lib/ directory of your application server.

4. Configure Your JIRA Server to Connect to Your PostgreSQL Database

PostgreSQL データベースに接続するために JIRA サーバーを設定する方法は2つあります。

(info) 注意:

4.1 Connecting JIRA to PostgreSQL Using the JIRA Configuration Tool

(warning) The JIRA Configuration Tool is not available with JIRA WAR distributions.

(info) Please Note: You may need to set the JAVA_HOME environment variable to run the JIRA Configuration Tool. See Installing Java for details.

To connect JIRA to PostgreSQL using the JIRA Configuration Tool:

  1. Click the Database tab.
  2. From the Database type drop-down choose PostgreSQL.
    (info) The JIRA Configuration Tool will display your current database configuration settings if any are already set.
  3. Fill in the connection details for your PostgreSQL database.
    • Hostname — The name or IP address of the machine that the PostgreSQL server is installed on.
    • Port — The TCP/IP port that the PostgreSQL server is listening on. You can leave this blank to use the default port.
    • Database — The name of your PostgreSQL database (into which JIRA will save its data).
    • Username — The user that JIRA uses to connect to the PostgreSQL server.
    • Password — The user's password to authenticate with the PostgreSQL server.
    • Schema — The name of the schema that your PostgreSQL database uses.
      (warning) Please ensure your database's schema name is lower-case as JIRA cannot work with PostgreSQL databases whose schema names contain upper-case characters.
  4. After typing in your settings, click the Test Connection button to test the connection settings. The tool will attempt to connect to the database, and give a message with the results.
  5. Click Save to save your settings when you are done.
    (info) Please Note:
    • The JIRA Configuration Tool will save your database configuration to a dbconfig.xml file in your JIRA Home Directory.
    • JIRA must be restarted for your new settings to take effect.

Congratulations — you have finished! Proceed to 'Next Steps' below.

4.2 Connecting JIRA to PostgreSQL Manually

  1. Edit the dbconfig.xml file at the root of your JIRA Home Directory.
    (info) If this file does not exist, create the file, copy and paste the example XML code below into this file and edit the pasted XML as required.

    注意:

    Ensure that the <database-type/> element's content specifies your type of database, as shown below. If you forget to do this and you start JIRA, your database tables may be created incorrectly. Refer to our Incorrect database type specified documentation if this happens to you.
    PostgreSQL 7.2 and later requires a schema to be specified in the <schema-name/> element. If your PostgreSQL database uses the default 'public' schema, this should be specified in the <schema-name/> element as shown below. Please ensure your database's schema name is lower-case as JIRA cannot work with PostgreSQL databases whose schema names contain upper-case characters.

    (warning) When editing your dbconfig.xml file, escape any '&' characters by adding 'amp;' to the end of each one.

    <?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://dbserver:5432/jiradb</url>
        <driver-class>org.postgresql.Driver</driver-class>
        <username>jiradbuser</username>
        <password>password</password>
        <pool-min-size>20</pool-min-size>
        <pool-max-size>20</pool-max-size>
        <pool-max-wait>30000</pool-max-wait>
        <pool-max-idle>20</pool-max-idle>
        <pool-remove-abandoned>true</pool-remove-abandoned>
        <pool-remove-abandoned-timeout>300</pool-remove-abandoned-timeout>
      </jdbc-datasource>
    </jira-database-config>
    

    (info) For more information about the child elements of <jdbc-datasource/> beginning with pool in the dbconfig.xml file above, see Tuning Database Connections.

  2. Save your edited dbconfig.xml file (at the root of your JIRA Home Directory).
    (info) JIRA must be restarted for your new settings to take effect.

5. 次のステップ

You should now have JIRA configured to connect to your PostgreSQL database.

  • JIRA の『推奨』ディストリビューションを使用している場合は、起動後、エラーがないかどうかログを観察します。
  • JIRA WAR ディストリビューションを使用している場合は、アプリケーションサーバーでウェブアプリケーションを再構築・再展開します。

インストールに際して

Please see JIRA and PostgreSQL.

3 Comments

  1. Whit Blauvelt

    The JIRA Configuration Tool does not work in a standard installation because the included Java does not have the appropriate variables set in the environment. So this page needs advice on setting those - and preferably not links to yet some other page with that information. The number of referrals between one page and another here to get references for basic sequential steps in an installation/upgrade makes this documentation nearly unreadable. For what's to be done in sequence, a single documentation page should present that full sequence. If sections of that sequence are used in different tasks, modularize those sections and include them on single pages pertinent to each task.

    Also, this page could use complete instructions including all configuration steps within PostgreSQL. Assume it's a fresh system being used for the installation. Assume the user doesn't want to go off and cross reference the PostgreSQL docs with the steps sketchily described here.

  2. Anonymous

    Not having per-platform and per-installation method docs in separate pages is disastrous and leads to doc-spaghetti. Seconded.

    The Configuration Tool is disappointing in that it doesn't create the all important (and by default missing) config files it seeks to output it's tunables to! Why is it left to starting Catalina to report if all the home directories are set appropriately? Perhaps Configuration Tool is intended for use in an existing environment but for greenfield it's not helpful.

    The Configuration Tool could be useful but desperately needs to be redesigned to gain it's own understanding from the user inputs to where the Net (in accounting speak) JAVA_HOME, JIRA_HOME and JIRA installation directory will be (is!). The rest can fall into place after that. It needs to present the important config files names and locations before bothering to offer anything else because be it a new install or a reconfig knowing where the config is read from or written to is not an unreasonable ask.

  3. Nabil Sayegh

    Where can I find example configurations for PostgreSQL tweaked for optimal performance? i.e. settings for these parameters: http://www.postgresql.org/docs/8.4/static/runtime-config-resource.html