diff options
author | pengbo | 2017-11-12 04:52:00 +0000 |
---|---|---|
committer | pengbo | 2017-11-12 04:52:00 +0000 |
commit | 36e90d65c218e9ee3ce9061784305c7c9d287e6c (patch) | |
tree | 02b5c4f99581f2330808b9ff67cc9290c0b00e96 | |
parent | 694502da1929a643875c661fe34b278e6efaa142 (diff) |
Fix support for Pgpool-II 3.7.
Added parameters are:
- failover_when_quorum_exists
- failover_require_consensus
- enable_multiple_failover_requests_from_node
- health_check_period0
- health_check_timeout0
- health_check_user0
- health_check_password0
- health_check_database0
- health_check_max_retries0
- health_check_retry_delay0
- connect_timeout0
Deleted parameters are:
- debug_level
-rw-r--r-- | common.php | 10 | ||||
-rw-r--r-- | definePgpoolConfParam.php | 12 | ||||
-rw-r--r-- | js/pgconfig.js | 19 | ||||
-rw-r--r-- | lang/en.lang.php | 3 | ||||
-rw-r--r-- | lang/ja.lang.php | 11 | ||||
-rw-r--r-- | lang/zh_cn.lang.php | 3 | ||||
-rw-r--r-- | templates/pgconfig.tpl | 25 |
7 files changed, 57 insertions, 26 deletions
@@ -512,7 +512,7 @@ function paramExists($param) // params added in 3.7 case 'failover_when_quorum_exists': case 'failover_require_consensus': - case 'enable_multiple_failover_requests_from_node': + case 'allow_multiple_failover_requests_from_node': case 'health_check_period0': case 'health_check_timeout0': case 'health_check_user0': @@ -825,6 +825,14 @@ function getMultiParams() return $rtn; } +/** + * Return if show per node health check parameters + */ +function showPerNodeHC() +{ + return (3.7 <= _PGPOOL2_VERSION); +} + /* * Return per node health check parameters */ diff --git a/definePgpoolConfParam.php b/definePgpoolConfParam.php index a8a9927..049b388 100644 --- a/definePgpoolConfParam.php +++ b/definePgpoolConfParam.php @@ -134,7 +134,11 @@ $pgpoolConfigBackendParam[$key]['multiple'] = TRUE; $key = 'backend_flag'; $pgpoolConfigBackendParam[$key]['type'] = 'C'; $pgpoolConfigBackendParam[$key]['default'] = 'ALLOW_TO_FAILOVER'; -$pgpoolConfigBackendParam[$key]['select'] = array('ALLOW_TO_FAILOVER', 'DISALLOW_TO_FAILOVER', 'ALWAYS_MASTER'); +if (_PGPOOL2_VERSION >= 3.7) { + $pgpoolConfigBackendParam[$key]['select'] = array('ALLOW_TO_FAILOVER', 'DISALLOW_TO_FAILOVER', 'ALWAYS_MASTER'); +} else { + $pgpoolConfigBackendParam[$key]['select'] = array('ALLOW_TO_FAILOVER', 'DISALLOW_TO_FAILOVER'); +} $pgpoolConfigBackendParam[$key]['regexp'] = selectreg($pgpoolConfigBackendParam[$key]['select']); $pgpoolConfigBackendParam[$key]['multiple'] = TRUE; @@ -298,6 +302,12 @@ $pgpoolConfigParam[$key]['parent'] = array('log_destination' => 'syslog'); # - Debug - +$key = 'debug_level'; +$pgpoolConfigParam[$key]['type'] = 'N'; +$pgpoolConfigParam[$key]['default'] = '0'; +$pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['max'] = NUM_MAX; + $key = 'log_error_verbosity'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'DEFAULT'; diff --git a/js/pgconfig.js b/js/pgconfig.js index 218ce6c..4a19edc 100644 --- a/js/pgconfig.js +++ b/js/pgconfig.js @@ -42,12 +42,21 @@ $(window).load(function() $('#add_backends_node').click(function() { var next_node_num = $('[id^=tb_backends_node_]').length; + var pgpool_ver = $('#pgpool_ver').val(); + addBackendForm(next_node_num); - addPerNodeHealthCheck(next_node_num); + + /* Only show per node health check form when pgpool version >= 3.7.*/ + if (pgpool_ver >= 3.7) { + addPerNodeHealthCheck(next_node_num); + } }); /* Click "add" button to add per node health_check. */ - $('[id^=add_per_node_health_check_]').on({'click': addPerNodeHealthCheckForm}); + $('[id^=add_per_node_health_check_]').click(function() + { + addPerNodeHealthCheckForm($(this)); + }); /* ========================================================================= */ /* Click "delete" button */ @@ -161,11 +170,11 @@ function addPerNodeHealthCheck(next_node_num) /* * Add per node health check form by using "add" button of health check table. */ -var addPerNodeHealthCheckForm = function() +function addPerNodeHealthCheckForm(obj) { - var node_num = $(this).parents('tbody').attr('id').split('_')[4]; + var node_num = obj.parents('tbody').attr('id').split('_')[4]; - $(this).parents('tbody').find('tr').show(); + obj.parents('tbody').find('tr').show(); $('#tr_hc_node_num_' + node_num).nextAll('tr').find('input').val(''); } diff --git a/lang/en.lang.php b/lang/en.lang.php index 4ac5f52..7edbff7 100644 --- a/lang/en.lang.php +++ b/lang/en.lang.php @@ -27,6 +27,7 @@ $message = array( 'lang' => 'en', 'strLang' => 'English', + 'descAllow_multiple_failover_requests_from_node' => 'If on, a single Pgpool-II node can cast multiple votes for the failover', 'descAllow_sql_comments' => 'If on, ignore SQL comments when judging if load balance or query cache is possible', 'descApp_name_redirect_preference_list' => '"application name:node id" pairs to specify the node id when the application is used', 'descArping_path' => 'The path of a command to send an ARP request after the virtual IP is switched', @@ -63,6 +64,8 @@ $message = array( 'descFailback_command' => 'Command to execute when attaching a node', 'descFailover_if_affected_tuples_mismatch' => 'Fail over due to disagreement with the number of affected tuples '. 'in UPDATE/DELETE', + 'descFailover_require_consensus' => 'If on, Pgpool-II will perform the degenerate/failover on a backend node if the watchdog quorum exists', + 'descFailover_when_quorum_exists' => 'If on, Pgpool-II will perform the degenerate/failover on backend node if the quorum exists', 'descFail_over_on_backend_error' => 'Fail over when socket communication error to backend occurs', 'descFollow_master_command' => 'Command to run only after a master failover', 'descHeartbeat_destination' => 'The destination of heartbeat signals. Specify by hostname or IP address.', diff --git a/lang/ja.lang.php b/lang/ja.lang.php index f1da802..9626c0e 100644 --- a/lang/ja.lang.php +++ b/lang/ja.lang.php @@ -52,7 +52,6 @@ $message = array( 'descConnection_cache' => 'コネクションキャッシュ機能の有無', 'descConnection_life_time' => 'コネクションプール中のコネクションの有効期間(秒)', 'descConnect_timeout' => 'connect()システムコールを使ってバックエンドに接続する際のタイムアウト値を指定(ミリ秒)', - 'descConnect_timeout0' => 'connect()システムコールを使ってバックエンドに接続する際のタイムアウト値を指定(ミリ秒)', 'descDatabase_redirect_preference_list' => 'データベース名によって負荷分散をしたいノード番号を、"データベース名:ノード番号"で指定', 'descDebug_level' => 'デバッグメッセージの詳細レベル(0は無効)', 'descDelay_threshold' => '許容するスタンバイサーバの遅延(バイト)', @@ -67,25 +66,15 @@ $message = array( 'descFail_over_on_backend_error' => 'DBノードへのソケット通信エラー時にフェイルオーバ', 'descFollow_master_command' => 'マスタのフェイルオーバ後に実行するコマンド', 'descHeartbeat_destination' => 'ハートビート信号の送信先ホスト名または IP アドレス', - 'descHeartbeat_destination0' => 'ハートビート信号の送信先ホスト名または IP アドレス', 'descHeartbeat_destination_port' => 'ハートビート信号の送信先ポート番号', - 'descHeartbeat_destination_port0' => 'ハートビート信号の送信先ポート番号', 'descHeartbeat_device' => 'ハートビートの送受信に用いるネットワークデバイス名', - 'descHeartbeat_device0' => 'ハートビートの送受信に用いるネットワークデバイス名', 'descHealth_check_database' => 'ヘルスチェックを行う対象のデータベース名', - 'descHealth_check_database0' => 'ヘルスチェックを行う対象のデータベース名', 'descHealth_check_period' => 'ヘルスチェックを行なう間隔(秒)', - 'descHealth_check_period0' => 'ヘルスチェックを行なう間隔(秒)', 'descHealth_check_timeout' => 'ヘルスチェックが長時間待たされるのを防ぐためのタイムアウト値(秒)', - 'descHealth_check_timeout0' => 'ヘルスチェックが長時間待たされるのを防ぐためのタイムアウト値(秒)', 'descHealth_check_user' => 'ヘルスチェックを行うためのPostgreSQLユーザ名', - 'descHealth_check_user0' => 'ヘルスチェックを行うためのPostgreSQLユーザ名', 'descHealth_check_password' => 'ヘルスチェックを行うためのPostgreSQLパスワード', - 'descHealth_check_password0' => 'ヘルスチェックを行うためのPostgreSQLパスワード', 'descHealth_check_max_retries' => 'ヘルスチェックに失敗した後にリトライする回数', - 'descHealth_check_max_retries0' => 'ヘルスチェックに失敗した後にリトライする回数', 'descHealth_check_retry_delay' => 'ヘルスチェックのリトライの間の間隔(秒)', - 'descHealth_check_retry_delay0' => 'ヘルスチェックのリトライの間の間隔(秒)', 'descIfconfig_path' => 'ifconfig コマンドのパス', 'descIf_cmd_path' => 'if コマンドのパス', 'descIf_down_cmd' => '仮想 IP を停止するために実行するコマンド', diff --git a/lang/zh_cn.lang.php b/lang/zh_cn.lang.php index cc824af..c06413d 100644 --- a/lang/zh_cn.lang.php +++ b/lang/zh_cn.lang.php @@ -27,6 +27,7 @@ $message = array( 'lang' => 'zh_cn', 'strLang' => '简体中文', + 'descAllow_multiple_failover_requests_from_node' => '一个 Pgpool-II 节点是否能够投多个票', 'descAllow_sql_comments' => '在判断能否负载均衡和查询缓存时,是否忽略SQL注释', 'descApp_name_redirect_preference_list' => '对于想使用负载均衡功能的节点,用"数据库名:节点号"的形式指定', 'descArping_path' => '该命令的路径来发送所述 IP 地址切换后的ARP请求', @@ -60,6 +61,8 @@ $message = array( 'descFailover_command' => '断开一个节点时执行的命令', 'descFailback_command' => '连接到一个节点时执行的命令', 'descFailover_if_affected_tuples_mismatch' => '由于不认可 UPDATE/DELETE 生效的行数不同而进行故障切换', + 'descFailover_require_consensus' => '是否使用 quorum 投票来进行故障切换', + 'descFailover_when_quorum_exists' => '是否使用 quorum 机制来进行故障切换', 'descFail_over_on_backend_error' => '与服务器发生套接字错误时进行故障切换', 'descFollow_master_command' => '在主节点发送故障切换后运行的命令', 'descHeartbeat_destination' => '心跳信号发送目标的 IP 地址或主机名', diff --git a/templates/pgconfig.tpl b/templates/pgconfig.tpl index abbc86f..6f23ac7 100644 --- a/templates/pgconfig.tpl +++ b/templates/pgconfig.tpl @@ -51,6 +51,7 @@ <form id="form_pgconfig" name="pgconfig" method="post" action="pgconfig.php" class="pgconfig"> <input type="hidden" id="pgconfig_action" name="action" value="" /> <input type="hidden" id="pgconfig_num" name="num" value="" /> + <input type="hidden" id="pgpool_ver" name="pgpool_ver" value="{$smarty.const._PGPOOL2_VERSION}" /> {* ===================================================================== *} <h3 id="connections">Connections</h3> @@ -457,6 +458,11 @@ </tbody> + {* ===================================================================== *} + {* If version <= 3.6, don't show per node health check parameters form. *} + {* ===================================================================== *} + + {if showPerNodeHC(_PGPOOL2_VERSION)} <tr><th class="category" colspan="2">Per Node Parameters</th></tr> {foreach from=$params.backend_hostname key=node_num item=v} @@ -492,6 +498,7 @@ </tbody> {/foreach} + {/if} </table> {* ===================================================================== *} @@ -603,16 +610,18 @@ {/if} </tbody> - <tbody id="tb_watchdog_use_watchdog_on_failover"> + {if paramExists('failover_when_quorum_exists')} + <tbody id="tb_watchdog_use_watchdog_on_failover"> - {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="4">Quorum failover behavior Setting</th></tr> - {* --------------------------------------------------------------------- *} + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="4">Quorum failover behavior Setting</th></tr> + {* --------------------------------------------------------------------- *} - {custom_tr_pgconfig param='failover_when_quorum_exists'} - {custom_tr_pgconfig param='failover_require_consensus'} - {custom_tr_pgconfig param='allow_multiple_failover_requests_from_node'} - </tbody> + {custom_tr_pgconfig param='failover_when_quorum_exists'} + {custom_tr_pgconfig param='failover_require_consensus'} + {custom_tr_pgconfig param='allow_multiple_failover_requests_from_node'} + </tbody> + {/if} <tbody id="tb_watchdog_use_watchdog_on_lifecheck_common"> {* --------------------------------------------------------------------- *} |