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

データベースサーバがリブートしたり、あるいはネットワーク障害が発生すると、データベースのコネクションプール内の全てのコネクションが切断され ます。通常、この問題を乗り越えるには、JIRA の再起動を行います(JIRA WAR ディストリビューションにおいては、JIRA を実行しているアプリケーションサーバを再起動する必要があります)。

However, the Apache Commons DBCP (DataBase Connection Pool), which is used by JIRA, can validate connections in the connection pool by running a simple SQL query. If a broken connection is detected, a new one is created to replace it.

To do this, you need to specify an optional <validation-query/> element (in the dbconfig.xml file of your JIRA Home Directory), whose content is the query which validates connections in the connection pool. See the following procedure for details.

Setting the validation query for your JIRA database

To ensure JIRA validates connections in the connection pool:

  1. JIRA をシャットダウンします(もしくは JIRA を実行中の Tomcat インストレーション)
  2. Edit the dbconfig.xml file at the root of your JIRA Home Directory.
  3. Add the <validation-query/> element with the appropriate validation query for your type of database, as shown in the example below for MySQL. (See Determining the Validation Querybelow for details.)

    <?xml version="1.0" encoding="UTF-8"?>
    
    <jira-database-config>
      <name>defaultDS</name>
      <delegator-name>default</delegator-name>
      <database-type>mysql</database-type>
      <schema-name></schema-name>
      <jdbc-datasource>
        <url>jdbc:mysql://dbserver:3306/jiradb?characterEncoding=utf8&amp;useUnicode=true</url>
        <driver-class>com.mysql.jdbc.Driver</driver-class>
        <username>jiradbuser</username>
        <password>mydbpassword</password>
        <pool-size>20</pool-size>
    
        <validation-query>select 1</validation-query>
    
      </jdbc-datasource>
    </jira-database-config>
    
  4. 編集済みの dbconfig.xml ファイルを保存します。
  5. JIRA (もしくは、JIRA を実行している Tomcat) を再起動します。

Determining the validation query

各データベースの種類におけるバリデーションクエリは、それぞれ若干異なる SQL 構文の条件を有しています。バリデーションクエリは、プールからコネクションが回収される度に実行されるため、可能な限りシンプルなものが臨まれます。

各バリデーションクエリに推奨されるバリデーションクエリを以下に紹介します。:

データベースタイプ

バリデーションクエリ

MySQL

select 1

Microsoft SQL Server

select 1

Oracle

select 1 from dual

PostgreSQL

select version();

結果

これで、データベースのコネクションプールにおける全てのコネクションが完全に失われても、JIRA 、あるいは JIRA を実行中のアプリケーションサーバを再起動させる事無くコネクションを回復できます。

(warning) パフォーマンス上の留意点:

  • このオプションを設定すると、パフォーマンスに影響が及びますが、クエリそのものは素早く実行されるため、パフォーマンス上の全体的な影響は最低 限に保たれます。更に、このクエリが実行されるのは、コネクションが成立した場合においてのみとなります。よって、リクエストの間ずっとコネクションが保 たれると、クエリは一回のリクエストに対して一度のみしか発生しません。
  • 大きな JIRA インストレーションを実行している場合は、これがもたらすパフォーマンス上の影響を評価してから実装した方がよいかもしれません。
  • ラベルなし