Documentation for JIRA 5.1.x. Documentation for other versions of JIRA is available too.
データベースサーバがリブートしたり、あるいはネットワーク障害が発生すると、データベースのコネクションプール内の全てのコネクションが切断され ます。通常、この問題を乗り越えるには、JIRA の再起動を行います(JIRA WAR ディストリビューションにおいては、JIRA を実行しているアプリケーションサーバを再起動する必要があります)。
しかし、単純な SQL クエリの実行によって、データベースのコネクションプール内のコネクションを有効にすることができます。プール内で切断されたデータベースコネクションが検出されると、新しいものが作成されてこれに置き替えられます。
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 database connection pool. See the following procedure for details.
JIRA がデータベースのコネクションプール内のデータベースコネクションを確実に有効にするには:
dbconfig.xml
file at the root of your JIRA Home Directory or use the Advanced tab of the JIRA Configuration Tool to configure the relevant settings.If editing the dbconfig.xml
file, 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 Query below 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> <jdbc-datasource> <url>jdbc:mysql://dbserver:3306/jiradb?useUnicode=true&characterEncoding=UTF8&sessionVariables=storage_engine=InnoDB</url> <driver-class>com.mysql.jdbc.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> <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-while-idle>true</pool-test-while-idle> <validation-query-timeout>3</validation-query-timeout> </jdbc-datasource> </jira-database-config>
dbconfig.xml
ファイルを編集する場合は、<validation-query-timeout/>
要素を適切な時間の長さ (秒単位) で追加します。上述のバリデーションクエリのオプションに関連する、以下のオプションを指定しても結構です(詳しくは データベース接続のチューニング - コネクションプールの設定 を参照して下さい):
JIRA 設定ツール 'Advanced' タブオプション |
|
---|---|
アイドル状態にテスト | pool-test-while-idle |
追い出し実行間の時間 | time-between-eviction-runs-millis |
追い出し可能な最小限のアイドル時間 | min-evictable-idle-time-millis |
Save your edited dbconfig.xml
file (or click the Save button if using the JIRA Configuration Tool).
Please Note: If you continue to have problems with connections closing, you may need to set the
time-between-eviction-runs-millis
parameter to a lower value or as a last resort, set test-on-borrow
to true
. For more information about test-on-borrow
, see Tuning Database Connections - Connection pool settings section.
各データベースの種類におけるバリデーションクエリは、それぞれ若干異なる SQL 構文の条件を有しています。バリデーションクエリは、プールからコネクションが回収される度に実行されるため、可能な限りシンプルなものが臨まれます。
各バリデーションクエリに推奨されるバリデーションクエリを以下に紹介します。:
データベースタイプ | バリデーションクエリ |
---|---|
MySQL |
|
Microsoft SQL Server |
|
Oracle |
|
PostgreSQL |
|
これで、データベースのコネクションプールにおける全てのコネクションが完全に失われても、JIRA 、あるいは JIRA を実行中のアプリケーションサーバを再起動させる事無くコネクションを回復できます。
パフォーマンス上の留意点: