JIRA の PostgreSQL への接続

These instructions will help you connect JIRA to a PostgreSQL database. A version of these instructions specific to Linux and JIRA is available.

はじめる前に

  • Check whether your version of PostgreSQL is supported. See Supported Platforms.
  • If you are Migrating JIRA to Another Server, create an export of your data as an XML backup. You will then be able to transfer data from your old database to your new database, as described in Switching databases.
  • セットアップ ウィザードを実行中でなければ、はじめる前に JIRA をシャットダウンしてください。

1. PostgreSQL データベースを作成・設定する

  1. Create a database user (login role) which JIRA will connect as (e.g. jiradbuser).
    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.
    Remember this database name, as it will be used to configure JIRA's connection to this database in subsequent steps.

    CREATE DATABASE jiradb WITH ENCODING 'UNICODE' LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0;

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

    $ createdb -E UNICODE -l C -T template0 jiradb
  3. ユーザーがデータベースに接続し、データベース中でテーブルを作成・追加できる権限を持っていることを確認します。

2. PostgreSQL JDBC ドライバをお使いのアプリケーション サーバーへコピーする(JIRA WAR 限定)

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

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

3. お使いの PostgreSQL データベースに接続するために JIRA サーバを設定する

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

  • Using the JIRA setup wizard (not applicable to JIRA WAR) — Use this method, if you have just installed JIRA and are setting it up for the first time. Your settings will be saved to the dbconfig.xml file in your JIRA Home Directory.
  • Using the JIRA configuration tool (not applicable to JIRA WAR) — Use this method, if you have an existing JIRA instance. Your settings will be saved to the dbconfig.xml file in your JIRA Home Directory.
  • Manually — Only use this method if you have a JIRA WAR instance or you have a console-only connection to your JIRA server. You will be required to manually update the dbconfig.xml file in your JIRA Home Directory.

各設定方法の手順説明:

JIRA セットアップ ウィザード

ブラウザから初めて JIRA にアクセスすると、JIRA setup wizard が表示されます。

  1. 最初の画面 の “Configure Language and Database” で、 “Database Connection” に My own database を選択します。
  2. Database Type” を “SQL Server” に設定します。
  3. 下記の データベース接続関連フィールド を参照し、フィールド入力を行います。
  4. 接続をテストし、保存します。

JIRA 設定ツール

  1. 次のように JIRA 設定ツールを実行します。
  2. データベース タブへ進み、データベースの種類 MySQL に設定します。
  3. 下記の データベース接続関連フィールド を参照し、フィールド入力を行います。
  4. 接続をテストし、保存します。
  5. Jira を再起動します。 

手動

  1. Locate the dbconfig.xml file at the root of your JIRA Home Directory.
    • If this file does not exist, create the file, copy and paste the example XML code (shown below) into this file.
  2. Update the file, as described in the Database connection fields section below. Escape any '&' characters by adding 'amp;' to the end of each one.
    • Note, the <database-type/> element must specify your type of database, e.g. postgres72 if you are using PostgreSQL 9.2. If you forget to do this and you start JIRA, your database tables may be created incorrectly. See Incorrect database type specified if this happens to you.

  3. ファイルを保存し、Jira を再起動します。

データベース接続フィールド

セットアップウィザード / 設定ツールdbconfig.xml説明
ホスト名

<url> タグに配置されます (下記の例の太字部分):
<url>jdbc:postgresql://dbserver:5432/jiradb</url>

PostgreSQL サーバーがインストールされている PC 名または IP アドレス。
ポート<url> タグに配置されます (下記の例の太字部分):
<url>jdbc:postgresql://dbserver:5432/jiradb</url>
PostgreSQL サーバがリッスンしている TCP/IP ポート。このフィールドが空の場合、デフォルト ポートが使用されます。
データベース<url> タグに配置されます (下記の例の太字部分):
<url>jdbc:postgresql://dbserver:5432/jiradb</url>
ご使用の PostgreSQL データベースの名前 (JIRA データの保存先)。上記 ステップ 1 で作成済みのはずです。
ユーザ名

<username> タグに配置されます (下記の例の太字部分):
<username>jiradbuser</username>

PostgreSQL サーバーに接続するために JIRA が使用するユーザー。上記 ステップ 1 で作成済みのはずです。
パスワード<password> タグに配置されます (下記の例の太字部分):
<password>jiradbuser</password>
PostgreSQL サーバーとの認証に利用するユーザーのパスワード。
スキーマ<schema-name> タグに配置されます (下記例の太字部分):
<schema-name> public </schema-name>

PostgreSQL データベースが使用するスキーマ名。

PostgreSQL 7.2 以降の場合は、<schema-name/> 要素で指定するスキーマが必要です。お使いの PostgreSQL データベースがデフォルトの “public” スキーマを使用している場合、それを以下のように <schema-name/> 要素内で指定する必要があります。お使いのデータベース スキーマ名が小文字であることを確認します。Jira では、スキーマ名に大文字が含まれる Postgfe SQL データベースは使用できません。

dbconfig.xml ファイルのサンプル

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

<?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>
 
    <validation-query>select version();</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-test-on-borrow>false</pool-test-on-borrow>
	<pool-test-while-idle>true</pool-test-while-idle>

  </jdbc-datasource>
</jira-database-config>

 

4. JIRA を起動する

PostgreSQL データベースに接続するための JIRA の設定が完了しました。これで、起動できます!

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

(tick) おめでとうございます。これで PostgreSQL データベースに JIRA が接続されました。

インストールに際して

Please see JIRA and PostgreSQL for topics related to JIRA and PostgreSQL.

最終更新日 2014 年 11 月 27 日

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

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