JIRA アプリケーションの PostgreSQL への接続
1. PostgreSQL データベースを作成・設定する
リモート TCP 接続を承認する (リモート PostgreSQL サーバーのみ)
If you are connecting JIRA to a remote PostgreSQL server (i.e. if your PostgreSQL server is not installed locally on your JIRA server host system), you will need to configure your data/postgresql.conf
and data/pg_hba.conf
files to accept remote TCP connections from your JIRA server's IP address.
次の PostgreSQL ドキュメントには、postgresql.conf
ファイルや pg_hba.conf
ファイルで利用できる listen_addresses
の値についての情報が含まれています。
- PostgreSQL 9.6 ドキュメント — 接続と認証
- PostgreSQL 9.5 ドキュメント — 接続と認証
- PostgreSQL 9.4 ドキュメント — 接続と認証
- PostgreSQL 9.3 ドキュメント — 接続と認証
data/postgresql.conf
および data/pg_hba.conf
ファイルを変更した後、PostgreSQL を再起動して変更を反映します。
お使いのバージョンの PostgreSQL 用にデータベースやデータベースを作成する
PostgreSQL のバージョンのユーザーやデータベースの作成に関する情報は、PostgreSQL の Web サイトに記載されています。
- 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. 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
ユーザーがデータベースに接続し、データベース中でテーブルを作成・追加できる権限を持っていることを確認します。
GRANT ALL PRIVILEGES ON DATABASE <Database Name> TO <Role Name>
権限が正常に付与されたことを検証するには、データベースに接続して「\z」コマンドを実行します。
2. PostgreSQL データベースに接続するために JIRA サーバを設定する
PostgreSQL データベースに接続するために JIRA サーバーを設定する方法は2つあります。
- Using the JIRA setup wizard — Use this method if you have just installed JIRA, and you 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 — 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.
各設定手法の手順説明
JIRA セットアップ ウィザード
ブラウザから初めて JIRA にアクセスすると、JIRA セットアップウィザード が表示されます。
- 最初の画面 の “Configure Language and Database” で、 “Database Connection” に My own database を選択します。
- “Database Type” を “SQL Server” に設定します。
- 下記の データベース接続関連フィールド を参照し、フィールド入力を行います。
- 接続をテストし、保存します。
JIRA 設定ツール
- 次のように JIRA 設定ツールを実行します。
- Windows: Open a command prompt and run
config.bat
in thebin
sub-directory of the JIRA installation directory. - Linux/Unix: Open a console and execute
config.sh
in thebin
sub-directory of the JIRA installation directory.
This may fail with the error as described in our Unable to Start JIRA applications Config Tool due to No X11 DISPLAY variable was set error KB article. Please refer to it for the workaround.
- Windows: Open a command prompt and run
- データベース タブへ進み、データベースの種類 を PostgreSQL に設定します。
- 下記の データベース接続関連フィールド を参照し、フィールド入力を行います。
- 接続をテストし、保存します。
- Jira を再起動します。
データベース接続フィールド
セットアップウィザード / 設定ツール | dbconfig.xml | 説明 |
---|---|---|
ホスト名 |
| 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 で作成済みのはずです。 |
ユーザ名 |
| PostgreSQL サーバーに接続するために JIRA が使用するユーザー。上記 ステップ 1 で作成済みのはずです。 |
パスワード | <password> タグに配置されます (下記の例の太字部分):<password> jiradbuser</password> | PostgreSQL サーバーとの認証に利用するユーザーのパスワード。 |
スキーマ | <schema-name> タグに配置されます (下記例の太字部分):<schema-name> public </schema-name> | PostgreSQL データベースが使用するスキーマ名。 PostgreSQL 7.2 以降の場合は、 |
dbconfig.xml ファイルのサンプル
上記の dbconfig.xml
ファイルに含まれる、pool
で始まる <jdbc-datasource/>
の子要素の詳細については、「データベース接続のチューニング」を参照してください。
<?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>
3. JIRA の起動
PostgreSQL データベースに接続するための JIRA の設定が完了しました。これで、起動できます!
おめでとうございます。これで PostgreSQL データベースに JIRA が接続されました。