From 03ce5dbc5b3436b2fef8f34cb13fc1e3e39c40b9 Mon Sep 17 00:00:00 2001 From: Nozomi Anzai Date: Fri, 17 May 2013 16:51:02 +0900 Subject: [PATCH] Adopt for pgpool-II 3.3. --- common.php | 11 +- definePgpoolConfParam.php | 110 ++++-- lang/en.lang.php | 9 + lang/ja.lang.php | 9 + pgconfig.php | 642 +++++++++++++++++++-------------- screen.css | 11 +- templates/help/en/pgconfig.tpl | 219 ++++++++--- templates/help/ja/pgconfig.tpl | 223 +++++++++--- templates/pgconfig.tpl | 315 +++++++++++----- 9 files changed, 1065 insertions(+), 484 deletions(-) diff --git a/common.php b/common.php index b149210..ea26b23 100644 --- a/common.php +++ b/common.php @@ -30,7 +30,7 @@ error_reporting(E_ALL); function versions() { - return array('3.2', '3.1', '3.0', + return array('3.3', '3.2', '3.1', '3.0', '2.3', '2.2', '2.1', '2.0'); } @@ -543,6 +543,15 @@ function paramExists($param) /* Add */ // params added in 3.3 + case 'clear_memqcache_on_escalation': + case 'heartbeat_device': + case 'heartbeat_destination': + case 'wd_authkey': + case 'wd_escalation_command': + case 'wd_lifecheck_method': + case 'wd_heartbeat_port': + case 'wd_heartbeat_keepalive': + case 'wd_heartbeat_deadtime': case 'wd_lifecheck_dbname': case 'wd_lifecheck_user': case 'wd_lifecheck_password': diff --git a/definePgpoolConfParam.php b/definePgpoolConfParam.php index 29145b1..7036e64 100644 --- a/definePgpoolConfParam.php +++ b/definePgpoolConfParam.php @@ -238,14 +238,14 @@ $pgpoolConfigParam[$key]['regexp'] = selectreg(array('always', 'if_over_threshol # - Syslog specific - $key = 'syslog_facility'; -$pgpoolConfigBackendParam[$key]['type'] = 'C'; -$pgpoolConfigBackendParam[$key]['default'] = 'LOCAL0'; -$pgpoolConfigBackendParam[$key]['regexp'] = $strreg; +$pgpoolConfigParam[$key]['type'] = 'C'; +$pgpoolConfigParam[$key]['default'] = 'LOCAL0'; +$pgpoolConfigParam[$key]['regexp'] = $strreg; $key = 'syslog_ident'; -$pgpoolConfigBackendParam[$key]['type'] = 'C'; -$pgpoolConfigBackendParam[$key]['default'] = 'pgpool'; -$pgpoolConfigBackendParam[$key]['regexp'] = $strreg; +$pgpoolConfigParam[$key]['type'] = 'C'; +$pgpoolConfigParam[$key]['default'] = 'pgpool'; +$pgpoolConfigParam[$key]['regexp'] = $strreg; # - Debug - @@ -524,20 +524,13 @@ $pgpoolConfigParam[$key]['max'] = NUM_MAX; # WATCHDOG #------------------------------------------------------------------------------ +# Enabling + $key = 'use_watchdog'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'off'; -$key = 'trusted_servers'; -$pgpoolConfigParam[$key]['type'] = 'C'; -$pgpoolConfigParam[$key]['default'] = ''; -$pgpoolConfigParam[$key]['regexp'] = $anyelse; - -$key = 'delegate_IP'; -$pgpoolConfigParam[$key]['type'] = 'C'; -$pgpoolConfigParam[$key]['default'] = ''; -$pgpoolConfigParam[$key]['regexp'] = $addressreg; -$pgpoolConfigParam[$key]['null_ok'] = TRUE; +# Watchdog communication $key = 'wd_hostname'; $pgpoolConfigParam[$key]['type'] = 'C'; @@ -551,17 +544,32 @@ $pgpoolConfigParam[$key]['default'] = 9000; $pgpoolConfigParam[$key]['max'] = NUM_MAX; $pgpoolConfigParam[$key]['min'] = 1024; -$key = 'wd_interval'; -$pgpoolConfigParam[$key]['type'] = 'N'; -$pgpoolConfigParam[$key]['default'] = 10; -$pgpoolConfigParam[$key]['max'] = NUM_MAX; -$pgpoolConfigParam[$key]['min'] = 0; +$key = 'wd_authkey'; +$pgpoolConfigParam[$key]['type'] = 'C'; +$pgpoolConfigParam[$key]['default'] = ''; +$pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['null_ok'] = TRUE; + +# Connection to up stream servers + +$key = 'trusted_servers'; +$pgpoolConfigParam[$key]['type'] = 'C'; +$pgpoolConfigParam[$key]['default'] = ''; +$pgpoolConfigParam[$key]['regexp'] = $anyelse; $key = 'ping_path'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +# Virtual IP control + +$key = 'delegate_IP'; +$pgpoolConfigParam[$key]['type'] = 'C'; +$pgpoolConfigParam[$key]['default'] = ''; +$pgpoolConfigParam[$key]['regexp'] = $addressreg; +$pgpoolConfigParam[$key]['null_ok'] = TRUE; + $key = 'ifconfig_path'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; @@ -587,6 +595,64 @@ $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +# Behaivor on escalation + +$key = 'clear_memqcache_on_escalation'; +$pgpoolConfigParam[$key]['type'] = 'B'; +$pgpoolConfigParam[$key]['default'] = 'on'; + +$key = 'wd_escalation_command'; +$pgpoolConfigParam[$key]['type'] = 'C'; +$pgpoolConfigParam[$key]['default'] = ''; +$pgpoolConfigParam[$key]['regexp'] = $anyelse; + +# Life checking pgpool-II + +# (Common) + +$key = 'wd_lifecheck_method'; +$pgpoolConfigParam[$key]['type'] = 'C'; +$pgpoolConfigParam[$key]['default'] = 'heartbeat'; +$pgpoolConfigParam[$key]['regexp'] = selectreg(array('heartbeat', 'query')); + +$key = 'wd_interval'; +$pgpoolConfigParam[$key]['type'] = 'N'; +$pgpoolConfigParam[$key]['default'] = 10; +$pgpoolConfigParam[$key]['max'] = NUM_MAX; +$pgpoolConfigParam[$key]['min'] = 0; + +# (Configuration of heartbeat mode) + +$key = 'wd_heartbeat_port'; +$pgpoolConfigParam[$key]['type'] = 'N'; +$pgpoolConfigParam[$key]['default'] = 9694; +$pgpoolConfigParam[$key]['max'] = NUM_MAX; +$pgpoolConfigParam[$key]['min'] = 0; + +$key = 'wd_heartbeat_keepalive'; +$pgpoolConfigParam[$key]['type'] = 'N'; +$pgpoolConfigParam[$key]['default'] = 2; +$pgpoolConfigParam[$key]['max'] = NUM_MAX; +$pgpoolConfigParam[$key]['min'] = 0; + +$key = 'wd_heartbeat_deadtime'; +$pgpoolConfigParam[$key]['type'] = 'N'; +$pgpoolConfigParam[$key]['default'] = 30; +$pgpoolConfigParam[$key]['max'] = NUM_MAX; +$pgpoolConfigParam[$key]['min'] = 0; + +$key = 'heartbeat_device'; +$pgpoolConfigHbDeviceParam[$key]['type'] = 'C'; +$pgpoolConfigHbDeviceParam[$key]['default'] = 'eth0'; +$pgpoolConfigHbDeviceParam[$key]['regexp'] = $anyelse; + +$key = 'heartbeat_destination'; +$pgpoolConfigHbDeviceParam[$key]['type'] = 'C'; +$pgpoolConfigHbDeviceParam[$key]['default'] = ''; +$pgpoolConfigHbDeviceParam[$key]['regexp'] = $anyelse; + +# (Configuration of query mode) + $key = 'wd_life_point'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 3; @@ -613,7 +679,7 @@ $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; -# Other pgpool Connection Settings +# Servers to monitor $key = 'other_pgpool_hostname'; $pgpoolConfigWdOtherParam[$key]['type'] = 'C'; diff --git a/lang/en.lang.php b/lang/en.lang.php index 38e1e01..fdb6b95 100644 --- a/lang/en.lang.php +++ b/lang/en.lang.php @@ -41,6 +41,7 @@ $message = array( 'descBlack_memqcache_table_list' => 'Comma separated list of table names not to be cached', 'descChild_life_time' => 'Life of an idle child process in seconds', 'descChild_max_connections' => 'If child_max_connections connections were received, child exits', + 'descClear_memqcache_on_escalation' => 'If on, watchdog clears all the query cache in the shared memory when pgpool-II escaltes to active', 'descClient_idle_limit' => 'Timeout in seconds while waiting for a query from a client', 'descClient_idle_limit_in_recovery' => 'Timeout in seconds while waiting for a query '. 'from a client in on line recovery', @@ -58,6 +59,8 @@ $message = array( 'in UPDATE/DELETE', '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 which is sent from the device. Specify by hostname or IP address.', + 'descHeartbeat_device' => 'The network device name for sending heartbeat signals', 'descHealth_check_period' => 'Specifies the interval for next health checking. 0 means no health checking, '. '-1 means no wait', 'descHealth_check_timeout' => 'Pgpool does "health check" periodically to detect PostgreSQL servers down, '. @@ -146,10 +149,16 @@ $message = array( 'descSystem_db_user' => 'The username when connection system database', 'descTrusted_servers' => 'The list of trusted servers to check the up stream connections', 'descUse_watchdog' => 'Enable watchdog', + 'descWd_authkey' => 'The authentication key used in watchdog communication', + 'descWd_escalation_command' => 'The command which will be executed on the new active when pgpool-II escaltes to active', + 'descWd_heartbeat_deadtime' => 'If there are no heartbeat signal for the period specified by this option, watchdog regards it as failure of the remote pgpool-II.', + 'descWd_heartbeat_keepalive' => 'The interval time of sending heartbeat signals in seconds', + 'descWd_heartbeat_port' => 'The port number to receive heartbeat signals', 'descWd_hostname' => 'The hostname or IP address in which pgpool-II works', 'descWd_interval' => 'The interval between life checks of pgpool-II in second', 'descWd_life_point' => 'The times to retry a failed life check of pgpool-II', 'descWd_lifecheck_dbname' => 'The database name connected for checking pgpool-II', + 'descWd_lifecheck_method' => 'The method of life check', 'descWd_lifecheck_query' => 'Actual query to check pgpool-II', 'descWd_lifecheck_password' => 'The user name to check pgpool-II', 'descWd_lifecheck_user' => 'The password of the user to check pgpool-II', diff --git a/lang/ja.lang.php b/lang/ja.lang.php index 6be05a0..e1ea239 100644 --- a/lang/ja.lang.php +++ b/lang/ja.lang.php @@ -41,6 +41,7 @@ $message = array( 'descCheck_temp_table' => '一時テーブルかどうかをチェック', 'descChild_life_time' => 'pgpoolの子プロセスの寿命', 'descChild_max_connections' => '各pgpool子プロセスが終了するまでの接続回数', + 'descClear_memqcache_on_escalation' => 'アクティブ昇格時に共有メモリ上のクエリキャッシュを削除するかどうか', 'descClient_idle_limit' => 'クライアントからのクエリの最大待ち時間(秒)', 'descClient_idle_limit_in_recovery' => 'リカバリ中のクライアントからのクエリの最大待ち時間(秒)', 'descConnection_cache' => 'コネクションキャッシュ機能の有無', @@ -55,6 +56,8 @@ $message = array( 'descFailover_if_affected_tuples_mismatch' => '更新行数が一致しないときにフェイルオーバ', 'descFail_over_on_backend_error' => 'DBノードへのソケット通信エラー時にフェイルオーバ', 'descFollow_master_command' => 'マスタのフェイルオーバ後に実行するコマンド', + 'descHeartbeat_destination' => 'ハートビート信号の送信先ホスト名または IP アドレス', + 'descHeartbeat_device' => 'ハートビートの送受信に用いるネットワークデバイス名', 'descHealth_check_period' => 'ヘルスチェックを行う間隔(秒)', 'descHealth_check_timeout' => 'ヘルスチェックが長時間待たされるのを防ぐためのタイムアウト値(秒)', 'descHealth_check_user' => 'ヘルスチェックを行うためのPostgreSQLユーザ名', @@ -137,10 +140,16 @@ $message = array( 'descSystem_db_user' => 'System DBに接続するときのユーザ名', 'descTrusted_servers' => '上位サーバのコンマ区切りのリスト', 'descUse_watchdog' => 'watchdog 機能の有無', + 'descWd_authkey' => 'wachdog 間通信で用いられる認証キー', + 'descWd_escalation_command' => 'アクティブ昇格時に実行するコマンド', + 'descWd_heartbeat_deadtime' => '障害発生とみなすまでの猶予(秒)', + 'descWd_heartbeat_keepalive' => 'ハートビート信号を送信する間隔(秒)', + 'descWd_heartbeat_port' => 'ハートビート信号を受信するポート番号', 'descWd_hostname' => 'watchdog プロセスが相互監視を受信するためのホスト名', 'descWd_interval' => '死活監視の間隔(秒)', 'descWd_life_point' => '死活監視のリトライ回数', 'descWd_lifecheck_dbname' => '死活監視を行なうために接続するデータベース', + 'descWd_lifecheck_method' => '死活監視の方法', 'descWd_lifecheck_query' => '死活監視で実行するクエリ', 'descWd_lifecheck_password' => '死活監視を行なうユーザのパスワード', 'descWd_lifecheck_user' => '死活監視を行なうユーザ', diff --git a/pgconfig.php b/pgconfig.php index 6aed56a..93b9844 100644 --- a/pgconfig.php +++ b/pgconfig.php @@ -27,7 +27,6 @@ require_once('common.php'); require('definePgpoolConfParam.php'); $tpl->assign('help', basename( __FILE__, '.php')); - if (!isset($_SESSION[SESSION_LOGIN_USER])) { header('Location: login.php'); exit(); @@ -49,135 +48,28 @@ if (isset($_POST['action'])) { switch ($action) { case 'add': case 'add_wd': - - // Boolean value - foreach ($pgpoolConfigParam as $key => $value) { - if ($pgpoolConfigParam[$key]['type'] == 'B') { - if (isset($_POST[$key])) { - $configValue[$key] = 'on'; - } else { - $configValue[$key] = 'off'; - } - } elseif (isset($_POST[$key])) { - $configValue[$key] = trim($_POST[$key]); - } - } - - // Backend settings - if (isset($_POST['backend_hostname'])) { - $configValue['backend_hostname'] = $_POST['backend_hostname']; - } else { - $configValue['backend_hostname'][0] = NULL; - - } - if (isset($_POST['backend_port'])) { - $configValue['backend_port'] = $_POST['backend_port']; - } else { - $configValue['backend_port'][0] = NULL; - } - - if (isset($_POST['backend_weight'])) { - $configValue['backend_weight'] = $_POST['backend_weight']; - } else { - $configValue['backend_weight'][0] = NULL; - } - - if (isset($_POST['backend_data_directory'])) { - $configValue['backend_data_directory'] = $_POST['backend_data_directory']; - } else { - $configValue['backend_data_directory'][0] = NULL; - } - - if (paramExists('backend_flag')) { - if (isset($_POST['backend_flag'])) { - $configValue['backend_flag'] = $_POST['backend_flag']; - } else { - $configValue['backend_flag'][0] = NULL; - } - } - - // watchdog settings - if (isset($_POST['other_pgpool_hostname'])) { - $configValue['other_pgpool_hostname'] = $_POST['other_pgpool_hostname']; - } else { - $configValue['other_pgpool_hostname'][0] = NULL; - - } - - if (isset($_POST['other_pgpool_port'])) { - $configValue['other_pgpool_port'] = $_POST['other_pgpool_port']; - } else { - $configValue['other_pgpool_port'][0] = NULL; - } - - if (isset($_POST['other_wd_port'])) { - $configValue['other_wd_port'] = $_POST['other_wd_port']; - } else { - $configValue['other_wd_port'][0] = NULL; - } + case 'add_heartbeat_device': + $configValue = arrangePostData(); + $configValue = doAdd($configValue); $tpl->assign('params', $configValue); - $tpl->assign('isAdd', ($action == 'add')); + $tpl->assign('isAdd', ($action == 'add')); $tpl->assign('isAddWd', ($action == 'add_wd')); + $tpl->assign('isAddHeartbeatDevice', ($action == 'add_heartbeat_device')); $tpl->display('pgconfig.tpl'); return; case 'cancel': case 'cancel_wd': - - // Boolean value - foreach ($pgpoolConfigParam as $key => $value) { - if ($pgpoolConfigParam[$key]['type'] == 'B') { - if (isset($_POST[$key])) { - $configValue[$key] = 'on'; - } else { - $configValue[$key] = 'off'; - } - } elseif (isset($_POST[$key])) { - $configValue[$key] = trim($_POST[$key]); - } - } - - // Backend settings - if (isset($_POST['backend_hostname'])) { - $configValue['backend_hostname'] = $_POST['backend_hostname']; - } - if (isset($_POST['backend_port'])) { - $configValue['backend_port'] = $_POST['backend_port']; - } - if (isset($_POST['backend_weight'])) { - $configValue['backend_weight'] = $_POST['backend_weight']; - } - if (isset($_POST['backend_data_directory'])) { - $configValue['backend_data_directory'] = $_POST['backend_data_directory']; - } - if (paramExists('backend_flag') && isset($_POST['backend_flag'])) { - $configValue['backend_flag'] = $_POST['backend_flag']; - } - array_pop($configValue['backend_hostname']); - array_pop($configValue['backend_port']); - array_pop($configValue['backend_weight']); - array_pop($configValue['backend_data_directory']); - array_pop($configValue['backend_flag']); - - // watchdog settings - if (isset($_POST['other_pgpool_hostname'])) { - $configValue['other_pgpool_hostname'] = $_POST['other_pgpool_hostname']; - } - if (isset($_POST['other_pgpool_port'])) { - $configValue['other_pgpool_port'] = $_POST['other_pgpool_port']; - } - if (isset($_POST['other_wd_port'])) { - $configValue['other_wd_port'] = $_POST['other_wd_port']; - } - array_pop($configValue['other_pgpool_hostname']); - array_pop($configValue['other_pgpool_port']); - array_pop($configValue['other_wd_port']); + case 'cancel_heartbeat_device': + $configValue = arrangePostData(); + $configValue = doCancel($configValue, $action); $tpl->assign('params', $configValue); - $tpl->assign('isAdd', !($action == 'cancel')); - $tpl->assign('isAddWd', !($action == 'cancel_wd')); + $tpl->assign('isAdd', FALSE); + $tpl->assign('isAddWd', FALSE); + $tpl->assign('isAddHeartbeatDevice', FALSE); $tpl->display('pgconfig.tpl'); return; @@ -199,171 +91,15 @@ foreach ($pgpoolConfigParam as $key => $value) { switch ($action) { case 'update': + $configValue = arrangePostData(); + $error = doCheck(); - /** - * copy from POST data to $configValue except backend value - */ - foreach ($pgpoolConfigParam as $key => $value) { - if ($pgpoolConfigParam[$key]['type'] == 'B') { - if (isset($_POST[$key])) { - $configValue[$key] = 'true'; - } else { - $configValue[$key] = 'false'; - } - } elseif (isset($_POST[$key])) { - $configValue[$key] = trim($_POST[$key]); - } - } - - /** - * Confirmations of value except backend host - */ - foreach ($pgpoolConfigParam as $key => $value) { - check($key, $value, $configValue, $error); - } - - /** - * copy backend value from POST data to $configValue - */ - foreach ($pgpoolConfigBackendParam as $key => $value) { - if (isset($_POST[$key])) { - $configValue[$key] = $_POST[$key]; - } - } - - /** - * check backend value - */ - if (isset($configValue['backend_hostname'])) { - for ($i = 0; $i < count($configValue['backend_hostname']); $i++) { - $result = FALSE; - - // backend_hostname - $result = checkString($configValue['backend_hostname'][$i], - $pgpoolConfigBackendParam['backend_hostname']['regexp']); - if (!$result) { - $error['backend_hostname'][$i] = TRUE; - } - - // backend_port - $result = checkInteger($configValue['backend_port'][$i], - $pgpoolConfigBackendParam['backend_port']['min'], - $pgpoolConfigBackendParam['backend_port']['max']); - if (!$result) { - $error['backend_port'][$i] = TRUE; - } - - // backend_weight - $result = checkFloat($configValue['backend_weight'][$i], - $pgpoolConfigBackendParam['backend_weight']['min'], - $pgpoolConfigBackendParam['backend_weight']['max']); - if (!$result) { - $error['backend_weight'][$i] = TRUE; - } - - // backend_data_directory - $result = checkString($configValue['backend_data_directory'][$i], - $pgpoolConfigBackendParam['backend_data_directory']['regexp']); - if (!$result) { - $error['backend_data_directory'][$i] = TRUE; - } - - // backend_flag - if (paramExists('backend_flag')) { - $result = checkString($configValue['backend_flag'][$i], - $pgpoolConfigBackendParam['backend_flag']['regexp']); - if (!$result) { - $error['backend_flag'][$i] = TRUE; - } - } - } - } - - /** - * copy backend value from POST data to $configValue - */ - foreach ($pgpoolConfigWdOtherParam as $key => $value) { - if (isset($_POST[$key])) { - $configValue[$key] = $_POST[$key]; - } - } - - /** - * check other watchdog value - */ - if (isset($configValue['other_pgpool_hostname'])) { - for ($i = 0; $i < count($configValue['other_pgpool_hostname']); $i++) { - $result = FALSE; - - // other_pgpool_hostname - $result = checkString($configValue['other_pgpool_hostname'][$i], - $pgpoolConfigWdOtherParam['other_pgpool_hostname']['regexp']); - if (!$result) { - $error['other_pgpool_hostname'][$i] = TRUE; - } - - // other_pgpool_port - $result = checkInteger($configValue['other_pgpool_port'][$i], - $pgpoolConfigWdOtherParam['other_pgpool_port']['min'], - $pgpoolConfigWdOtherParam['other_pgpool_port']['max']); - - // other_wd_port - $result = checkInteger($configValue['other_wd_port'][$i], - $pgpoolConfigWdOtherParam['other_wd_port']['min'], - $pgpoolConfigWdOtherParam['other_wd_port']['max']); - } - } - - /* - * Chek if there are some errors - */ - $isError = FALSE; - foreach ($error as $key => $value) { - if (preg_match("/^backend_hostname/", $key) || - preg_match("/^backend_port/", $key) || - preg_match("/^backend_weight/", $key) || - preg_match("/^backend_data_directory/", $key) || - preg_match("/^backend_flag/", $key)) - { - for ($i = 0; $i < count($value); $i++) { - if ($value[$i] == TRUE) { - $isError = TRUE; - } - } - - } elseif ( - preg_match("/^other_pgpool_hostname/", $key) || - preg_match("/^other_pgpool_port/", $key) || - preg_match("/^other_wd_port/", $key)) - { - for ($i = 0; $i < count($value); $i++) { - if ($value[$i] == TRUE) { - $isError = TRUE; - } - } - - } elseif ($value == TRUE) { - $isError = TRUE; - } - - if ($isError) { break; } - } - - /* check logically */ - $logical_errors = checkLogical($configValue); - if ($logical_errors) { - $isError = TRUE; - $error += $logical_errors; - } - - /** - * Display - */ - if (!$isError) { + if (! $error) { if (is_writable(_PGPOOL2_CONFIG_FILE)) { writeConfigFile($configValue, $pgpoolConfigParam); $configValue = readConfigParams(); $tpl->assign('status', 'success'); + } else { $errorCode = 'e4003'; $tpl->assign('errorCode', $errorCode); @@ -379,6 +115,7 @@ switch ($action) { case 'delete': case 'delete_wd': + case 'delete_heartbeat_device': $num = $_POST['num']; switch ($action) { @@ -386,6 +123,8 @@ switch ($action) { deleteBackendHost($num, $configValue); break; case 'delete_wd': deleteWdOther($num, $configValue); break; + case 'cancel_heartbeat_device': + deleteHeartbeatDevice($num, $configValue); break; } if (is_writable(_PGPOOL2_CONFIG_FILE)) { @@ -405,6 +144,7 @@ switch ($action) { default: } +/* Set each empty object if null */ if (!isset($configValue['backend_hostname'])) { $configValue['backend_hostname'][0] = NULL; $configValue['backend_port'][0] = NULL; @@ -413,6 +153,11 @@ if (!isset($configValue['backend_hostname'])) { $configValue['backend_flag'][0] = NULL; } +if (!isset($configValue['heartbeat_device'])) { + $configValue['heartbeat_device'][0] = NULL; + $configValue['heartbeat_destination'][0] = NULL; +} + if (!isset($configValue['other_pgpool_hostname'])) { $configValue['other_pgpool_hostname'][0] = NULL; $configValue['other_pgpool_port'][0] = NULL; @@ -552,6 +297,9 @@ function checkBoolean($str) } } +/** + * Check if there is no paradoxes in settings + */ function checkLogical($configValue) { $errors = array(); @@ -646,7 +394,9 @@ function writeConfigFile($configValue, $pgpoolConfigParam) !preg_match("/^backend_flag/", $key) && !preg_match("/^other_pgpool_hostname/", $key) && !preg_match("/^other_pgpool_port/", $key) && - !preg_match("/^other_wd_port/", $key) + !preg_match("/^other_wd_port/", $key) && + !preg_match("/^heartbeat_device/", $key) && + !preg_match("/^heartbeat_destination/", $key) ) { $tmpConfigFile[] = $line; @@ -706,6 +456,13 @@ function writeConfigFile($configValue, $pgpoolConfigParam) } } + if (isset($configValue['heartbeat_device'])) { + for ($i = 0; $i < count($configValue['heartbeat_device']); $i++) { + $configFile[] = "heartbeat_device$i = '" . $configValue['heartbeat_device'][$i] . "'\n"; + $configFile[] = "heartbeat_destination$i = " . $configValue['heartbeat_destination'][$i] . "\n"; + } + } + $outfp = fopen(_PGPOOL2_CONFIG_FILE, 'w'); foreach ($configFile as $line) { fputs($outfp, $line); @@ -757,3 +514,328 @@ function deleteWdOther($num, &$configValue) unset($configValue['other_wd_port'][$num]); $configValue['other_wd_port'] = array_values($configValue['other_wd_port']); } + +/** + * Delete an heartbeat device + */ +function deleteHeartbeatDevice($num, &$configValue) +{ + if (!isset($configValue['heartbeat_device'])) { return; } + + unset($configValue['heartbeat_device'][$num]); + $configValue['heartbeat_device'] = array_values($configValue['heartbeat_device']); + + unset($configValue['heartbeat_destination'][$num]); + $configValue['heartbeat_destination'] = array_values($configValue['heartbeat_destination']); +} + +/** + * Arrange post data + */ +function arrangePostData() +{ + global $pgpoolConfigParam; + global $_POST; + + $configValue = array(); + foreach ($pgpoolConfigParam as $key => $value) { + if ($pgpoolConfigParam[$key]['type'] == 'B') { + $configValue[$key] = (isset($_POST[$key])) ? 'on' : 'off'; + + } elseif (isset($_POST[$key])) { + $configValue[$key] = trim($_POST[$key]); + } + } + + return $configValue; +} + +/** + * Add action + */ +function doAdd($configValue) +{ + global $_POST; + + // Backend settings + if (isset($_POST['backend_hostname'])) { + $configValue['backend_hostname'] = $_POST['backend_hostname']; + } else { + $configValue['backend_hostname'][0] = NULL; + + } + if (isset($_POST['backend_port'])) { + $configValue['backend_port'] = $_POST['backend_port']; + } else { + $configValue['backend_port'][0] = NULL; + } + + if (isset($_POST['backend_weight'])) { + $configValue['backend_weight'] = $_POST['backend_weight']; + } else { + $configValue['backend_weight'][0] = NULL; + } + + if (isset($_POST['backend_data_directory'])) { + $configValue['backend_data_directory'] = $_POST['backend_data_directory']; + } else { + $configValue['backend_data_directory'][0] = NULL; + } + + if (paramExists('backend_flag')) { + if (isset($_POST['backend_flag'])) { + $configValue['backend_flag'] = $_POST['backend_flag']; + } else { + $configValue['backend_flag'][0] = NULL; + } + } + + // watchdog's device settings + if (isset($_POST['heartbeat_device'])) { + $configValue['heartbeat_device'] = $_POST['heartbeat_device']; + } else { + $configValue['heartbeat_device'][0] = NULL; + } + + if (isset($_POST['heartbeat_destination'])) { + $configValue['heartbeat_destination'] = $_POST['heartbeat_destination']; + } else { + $configValue['heartbeat_destination'][0] = NULL; + } + + // watchdog's other pgpool settings + if (isset($_POST['other_pgpool_hostname'])) { + $configValue['other_pgpool_hostname'] = $_POST['other_pgpool_hostname']; + } else { + $configValue['other_pgpool_hostname'][0] = NULL; + } + + if (isset($_POST['other_pgpool_port'])) { + $configValue['other_pgpool_port'] = $_POST['other_pgpool_port']; + } else { + $configValue['other_pgpool_port'][0] = NULL; + } + + if (isset($_POST['other_wd_port'])) { + $configValue['other_wd_port'] = $_POST['other_wd_port']; + } else { + $configValue['other_wd_port'][0] = NULL; + } + + return $configValue; +} + +/** + * Cancel action + */ +function doCancel($configValue, $action) +{ + global $_POST; + + // Backend settings + if (isset($_POST['backend_hostname'])) { + $configValue['backend_hostname'] = $_POST['backend_hostname']; + } + if (isset($_POST['backend_port'])) { + $configValue['backend_port'] = $_POST['backend_port']; + } + if (isset($_POST['backend_weight'])) { + $configValue['backend_weight'] = $_POST['backend_weight']; + } + if (isset($_POST['backend_data_directory'])) { + $configValue['backend_data_directory'] = $_POST['backend_data_directory']; + } + if (paramExists('backend_flag') && isset($_POST['backend_flag'])) { + $configValue['backend_flag'] = $_POST['backend_flag']; + } + + if ($action == 'cancel') { + array_pop($configValue['backend_hostname']); + array_pop($configValue['backend_port']); + array_pop($configValue['backend_weight']); + array_pop($configValue['backend_data_directory']); + array_pop($configValue['backend_flag']); + } + + // watchdog's device settings + if (isset($_POST['heartbeat_device'])) { + $configValue['heartbeat_device'] = $_POST['heartbeat_device']; + } + if (isset($_POST['heartbeat_destination'])) { + $configValue['heartbeat_destination'] = $_POST['heartbeat_destination']; + } + if ($action == 'cancel_heartbeat_device') { + array_pop($configValue['heartbeat_device']); + array_pop($configValue['heartbeat_destination']); + } + + // watchdog's other pgpool settings + if (isset($_POST['other_pgpool_hostname'])) { + $configValue['other_pgpool_hostname'] = $_POST['other_pgpool_hostname']; + } + if (isset($_POST['other_pgpool_port'])) { + $configValue['other_pgpool_port'] = $_POST['other_pgpool_port']; + } + if (isset($_POST['other_wd_port'])) { + $configValue['other_wd_port'] = $_POST['other_wd_port']; + } + if ($action == 'cancel_wd') { + array_pop($configValue['other_pgpool_hostname']); + array_pop($configValue['other_pgpool_port']); + array_pop($configValue['other_wd_port']); + } + + return $configValue; +} + +/** + * Check all params + */ +function doCheck() +{ + global $pgpoolConfigParam; + global $configValue; + global $pgpoolConfigBackendParam; + global $pgpoolConfigWdOtherParam; + global $_POST; + + $error = array(); + + /* + * Confirmations of value except backend host + */ + foreach ($pgpoolConfigParam as $key => $value) { + check($key, $value, $configValue, $error); + } + + /* + * copy backend value from POST data to $configValue + */ + foreach ($pgpoolConfigBackendParam as $key => $value) { + if (isset($_POST[$key])) { + $configValue[$key] = $_POST[$key]; + } + } + + /* + * check backend value + */ + if (isset($configValue['backend_hostname'])) { + for ($i = 0; $i < count($configValue['backend_hostname']); $i++) { + $result = FALSE; + + // backend_hostname + $result = checkString($configValue['backend_hostname'][$i], + $pgpoolConfigBackendParam['backend_hostname']['regexp']); + if (!$result) { + $error['backend_hostname'][$i] = TRUE; + } + + // backend_port + $result = checkInteger($configValue['backend_port'][$i], + $pgpoolConfigBackendParam['backend_port']['min'], + $pgpoolConfigBackendParam['backend_port']['max']); + if (!$result) { + $error['backend_port'][$i] = TRUE; + } + + // backend_weight + $result = checkFloat($configValue['backend_weight'][$i], + $pgpoolConfigBackendParam['backend_weight']['min'], + $pgpoolConfigBackendParam['backend_weight']['max']); + if (!$result) { + $error['backend_weight'][$i] = TRUE; + } + + // backend_data_directory + $result = checkString($configValue['backend_data_directory'][$i], + $pgpoolConfigBackendParam['backend_data_directory']['regexp']); + if (!$result) { + $error['backend_data_directory'][$i] = TRUE; + } + + // backend_flag + if (paramExists('backend_flag')) { + $result = checkString($configValue['backend_flag'][$i], + $pgpoolConfigBackendParam['backend_flag']['regexp']); + if (!$result) { + $error['backend_flag'][$i] = TRUE; + } + } + } + } + + /* + * check watchdof's device value + */ + if (isset($configValue['heartbeat_device'])) { + for ($i = 0; $i < count($configValue['heartbeat_device']); $i++) { + $result = FALSE; + + // heartbeat_device + $result = checkString($configValue['heartbeat_device'][$i], + $pgpoolConfigWdOtherParam['heartbeat_device']['regexp']); + if (!$result) { + $error['heartbeat_device'][$i] = TRUE; + } + + // heartbeat_destination + $result = checkString($configValue['heartbeat_destination'][$i], + $pgpoolConfigWdOtherParam['heartbeat_destination']['regexp']); + if (!$result) { + $error['heartbeat_destination'][$i] = TRUE; + } + } + } + + /* + * check watchdog's other pgpool value + */ + foreach ($pgpoolConfigWdOtherParam as $key => $value) { + if (isset($_POST[$key])) { + $configValue[$key] = $_POST[$key]; + } + } + if (isset($configValue['other_pgpool_hostname'])) { + for ($i = 0; $i < count($configValue['other_pgpool_hostname']); $i++) { + $result = FALSE; + + // other_pgpool_hostname + $result = checkString($configValue['other_pgpool_hostname'][$i], + $pgpoolConfigWdOtherParam['other_pgpool_hostname']['regexp']); + if (!$result) { + $error['other_pgpool_hostname'][$i] = TRUE; + } + + // other_pgpool_port + $result = checkInteger($configValue['other_pgpool_port'][$i], + $pgpoolConfigWdOtherParam['other_pgpool_port']['min'], + $pgpoolConfigWdOtherParam['other_pgpool_port']['max']); + if (!$result) { + $error['other_pgpool_port'][$i] = TRUE; + } + + // other_wd_port + $result = checkInteger($configValue['other_wd_port'][$i], + $pgpoolConfigWdOtherParam['other_wd_port']['min'], + $pgpoolConfigWdOtherParam['other_wd_port']['max']); + if (!$result) { + $error['other_wd_port'][$i] = TRUE; + } + } + } + + /* + * check logically + */ + $logical_errors = checkLogical($configValue); + if ($logical_errors) { + $isError = TRUE; + $error += $logical_errors; + } + + /** + * return params which has errors + */ + return $error; +} diff --git a/screen.css b/screen.css index a965823..689506f 100644 --- a/screen.css +++ b/screen.css @@ -35,7 +35,10 @@ th, td { padding: 4px 8px; border-bottom: 1px solid lightsteelblue; } -thead th, thead td, tfoot th, tfoot td { +thead th, thead td, +tfoot th, tfoot td, +tr.tr_add_button th, +tr.tr_add_button td { background: ghostwhite; } tbody th { @@ -300,6 +303,12 @@ ul { font-family: monospace; border-bottom: 1px dotted #cccccc; } +.param_group { + background-color: #78A1D3; + padding: 3px 5px; + border-radius: 3px; + color: white; +} /* --------------------------------------------------------------------- */ /* Refresh info */ diff --git a/templates/help/en/pgconfig.tpl b/templates/help/en/pgconfig.tpl index 916ddaf..2449653 100644 --- a/templates/help/en/pgconfig.tpl +++ b/templates/help/en/pgconfig.tpl @@ -44,7 +44,7 @@

{$message.strSummary|escape}

-The content of pgpool.conf that is the configuration file of pgpool set can be displayed and be changed. +The content of pgpool.conf that is the configuration file of pgpool set can be displayed and be changed.

{$message.strFeature|escape}

Please input the value that wants to change and push the update button. @@ -1604,6 +1604,10 @@ black_function_list = 'nextval,setval,lastval,currval' + + {* --------------------------------------------------------------------- *} + Enabling +

use_watchdog (bool) * @@ -1612,6 +1616,7 @@ black_function_list = 'nextval,setval,lastval,currval' + {* --------------------------------------------------------------------- *} Connection to up stream servers @@ -1635,58 +1640,39 @@ black_function_list = 'nextval,setval,lastval,currval' - Lifecheck of pgpol-II - - - -

wd_interval (integer) * - -

This parameter specifies the interval between life checks of pgpool-II in second. - (A number greater than or equal to 1)

- - + {* --------------------------------------------------------------------- *} + Watchdog communication Settings - -

wd_life_point (string) * - -

The times to retry a failed life check of pgpool-II. (A number greater than or equal to 1)

- - - - - -

wd_lifecheck_query (string) * - -

Actual query to check pgpool-II. Default is "SELECT 1".

- - - - - -

wd_lifecheck_dbnam(string) * + +

wd_hostname (string) * -

The database name connected for checking pgpool-II. Default is "template1"

+

Specifies the hostname or IP address for mutual monitoring of watchdog processes.

- -

wd_lifecheck_user(string) * + +

wd_port (integer) * -

The user name to check pgpool-II. This user must exist in all the PostgreSQL backends. - Default is "nobody" .

+

Specifies the port number for mutual monitoring of watchdog processes.

+ {if paramExists('wd_authkey')} - -

wd_lifecheck_query (string) * + +

wd_authkey (string) * -

The password of the user to check pgpool-II. Default is "".

+

Specifies the authentication key used in watchdog communication. + All the pgpool-II must have the same key. Packets from watchdog of wrong key will be rejects. + This authentication is applied also for heatrbeat singals if lifecheck method is heartbeat mode.

+

If this is empty (default), watchdog doesn't conduct authenticate.

+ {/if} + {* --------------------------------------------------------------------- *} Virtual IP address @@ -1713,7 +1699,7 @@ black_function_list = 'nextval,setval,lastval,currval'

if_up_cmd (string) *

This parameter specifies a command to bring up the virtual IP. - Set the command and parameters such as "ifconfig eth0:0 inet $_IP_$ netmask 255.255.255.0". + Set the command and parameters such as "ifconfig eth0:0 inet $_IP_$ netmask 255.255.255.0". $_IP_$ is replaced by the IP address specified in delegate_IP.

@@ -1723,7 +1709,7 @@ black_function_list = 'nextval,setval,lastval,currval'

if_down_cmd (string) *

This parameter specifies a command to bring down the virtual IP. - Set the command and parameters such as "ifconfig eth0:0 down".

+ Set the command and parameters such as "ifconfig eth0:0 down".

@@ -1741,29 +1727,168 @@ black_function_list = 'nextval,setval,lastval,currval'

arping_cmd (string) *

This parameter specifies a command to send an ARP request after the virtual IP is switched. - Set the command and parameters such as "arping -U $_IP_$ -w 1". + Set the command and parameters such as "arping -U $_IP_$ -w 1". $_IP_$ is replaced by the IP address specified in delegate_IP.

- Server itself to be monitored + {* --------------------------------------------------------------------- *} + {if paramExists('clear_memqcache_on_escalation')} + Behaivor on escalation Setting - -

wd_hostname (string) * + +

clear_memqcache_on_escalation (bool) * -

Specifies the hostname or IP address for mutual monitoring of watchdog processes.

+

If this is on, watchdog clears all the query cache in the shared memory + when pgpool-II escaltes to active. + This prevents the new active pgpool-II from using old query caches inconsistence to the old active. + Default is on.

- -

wd_port (integer) * + +

wd_escalation_command (string) * -

Specifies the port number for mutual monitoring of watchdog processes.

+

pgpool-II がアクティブに昇格した時に、ここで指定したコマンドが実行されます。 + コマンドは、仮想 IP が立ち上がる直前のタイミングで実行されます。

+ + + {/if} + + {* --------------------------------------------------------------------- *} + Lifecheck Setting (common) + + {if paramExists('wd_lifecheck_method')} + + +

wd_lifecheck_method (string) * + +

Specifies the method of life check. This is either of 'heartbeat' (default) or 'query'.

+
+
heartbeat
+
+ Watchdog sends heartbeat singals (UDP packets) periodically to other pgpool-II. + Watchdog also receives the signals from other pgpool-II. + If there are no signal for a certain period, watchdog regards is as failure of the pgpool-II. +
+
query
+
watchdog sends monitoring queries to other pgpool-II and checks the response.
+
+ {/if} + + + +

wd_interval (integer) * + +

This parameter specifies the interval between life checks of pgpool-II in second. + (A number greater than or equal to 1)

+ + + + {* --------------------------------------------------------------------- *} + {if paramExists('wd_lifecheck_method')} + Lifecheck Setting (heartbeat mode) + + + +

wd_heartbeat_port (integer) * + +

Specifies the port number to receive heartbeat signals.

+ + + + + +

wd_heartbeat_keepalive (integer) * + +

Specifies the interval time in seconds of sending heartbeat signals. Default is 2.

+ + + + + +

wd_heartbeat_deadtime (integer) * + +

If there are no heartbeat signal for the period specified by this option, + watchdog regards it as failure of the remote pgpool-II.

+ + + + + +

heartbeat_device (string) * + +

Specifies the network device name for sending heartbeat signals. + You can use multiple devices. + The number at the end of the parameter name is referred as "device number", and it starts from 0. + If you want to set mutiple destination (heartbeat_destiationN) for one device, + specify the device name repeatedly using different numbers.

+ + + + + +

heartbeat_destination (string) * + +

Specifies the destination of heartbeat signals which is sent from the device + specified by heartbeat_deviceX. + Use IP address or hostname. The number at the end of the parameter name is referred as "device number", + and it starts from 0. This works only heartbeat mode.

+ + + {/if} + + {* --------------------------------------------------------------------- *} + Lifecheck Setting (query mode) + + + +

wd_life_point (string) * + +

The times to retry a failed life check of pgpool-II. (A number greater than or equal to 1)

+ + + + + +

wd_lifecheck_query (string) * + +

Actual query to check pgpool-II. Default is "SELECT 1".

+ + + + {if paramExists('wd_lifecheck_dbname')} + + +

wd_lifecheck_dbnam(string) * + +

The database name connected for checking pgpool-II. Default is "template1"

+ + + + + +

wd_lifecheck_user(string) * + +

The user name to check pgpool-II. This user must exist in all the PostgreSQL backends. + Default is "nobody" .

+ + + + + +

wd_lifecheck_query (string) * + +

The password of the user to check pgpool-II. Default is "".

+ + + {/if} + {* --------------------------------------------------------------------- *} Servers to monitor diff --git a/templates/help/ja/pgconfig.tpl b/templates/help/ja/pgconfig.tpl index 28ed2a4..2c21a0c 100644 --- a/templates/help/ja/pgconfig.tpl +++ b/templates/help/ja/pgconfig.tpl @@ -1421,7 +1421,7 @@ black_function_list = 'nextval,setval,lastval,currval'

ヘルスチェックのリトライの間の秒数を指定します - (health_check_max_retries > 0でなければ有効になりません)。 + (health_check_max_retries > 0でなければ有効になりません)。 0を指定すると、待ちなしに直ちにリトライします。

@@ -1680,6 +1680,10 @@ black_function_list = 'nextval,setval,lastval,currval' + + {* --------------------------------------------------------------------- *} + Enabling +

use_watchdog (bool) * @@ -1688,6 +1692,7 @@ black_function_list = 'nextval,setval,lastval,currval' + {* --------------------------------------------------------------------- *} Connection to up stream servers @@ -1708,56 +1713,39 @@ black_function_list = 'nextval,setval,lastval,currval' - Lifecheck of pgpol-II + {* --------------------------------------------------------------------- *} + Watchdog communication Settings - -

wd_interval (integer) * - -

pgpool-II への生存監視の間隔(秒)です。 (1 以上の数値)

- - - - - -

wd_life_point (string) * - -

pgpool-II の死活監視で応答が得られなかった場合のリトライ回数です。 (1 以上の数値)

- - - - - -

wd_lifecheck_query (string) * - -

pgpool-II の死活監視のために発行されるクエリです。 デフォルトは "SELECT 1" です。

- - - - - -

wd_lifecheck_dbnam(string) * + +

wd_hostname (string) * -

pgpool-II の死活監視を行なうのに接続するデータベースです。 デフォルトは "template1" です。

+

watchdog プロセスが相互監視を受信する為のホスト名または IP アドレスです。

- -

wd_lifecheck_user(string) * + +

wd_port (integer) * -

pgpool-II の死活監視を行なうユーザです。 デフォルトは "nobody" です。

+

watchdog プロセスが相互監視を受信する為のポート番号です。

+ {if paramExists('wd_authkey')} - -

wd_lifecheck_query (string) * + +

wd_authkey (string) * -

pgpool-II の死活監視を行なうユーザのパスワードです。

+

wachdog 間通信で用いられる認証キーです。 全ての pgpool-II で同じキーを指定する必要があります。 + 認証キーが異なる watchdog からの通信は拒絶されます。 + 死活監視をハートビートモードで行う場合には、この認証はハートビート信号にも適用されます。

+

指定が無い場合には認証は行われず、これがデフォルトです。

+ {/if} + {* --------------------------------------------------------------------- *} Virtual IP address @@ -1782,7 +1770,7 @@ black_function_list = 'nextval,setval,lastval,currval'

if_up_cmd (string) *

仮想 IP を起動するために実行するコマンドです。 - "ifconfig eth0:0 inet $_IP_$ netmask 255.255.255.0" のようにコマンドとパラメータを指定します。 + "ifconfig eth0:0 inet $_IP_$ netmask 255.255.255.0" のようにコマンドとパラメータを指定します。 $_IP_$ は delegate_IP で指定された IP アドレスに置換されます。

@@ -1792,7 +1780,7 @@ black_function_list = 'nextval,setval,lastval,currval'

if_down_cmd (string) *

仮想IPを停止するために実行するコマンドです。 - "ifconfig eth0:0 down" のようにコマンドとパラメータを指定します。

+ "ifconfig eth0:0 down" のようにコマンドとパラメータを指定します。

@@ -1809,29 +1797,168 @@ black_function_list = 'nextval,setval,lastval,currval'

arping_cmd (string) * -

IPアドレス切り替え後にARPリクエストを送信するコマンドです。 - "arping -U $_IP_$ -w 1" のようにコマンドとパラメータを指定します。 +

IPアドレス切り替え後に ARP リクエストを送信するコマンドです。 + "arping -U $_IP_$ -w 1" のようにコマンドとパラメータを指定します。 $_IP_$ は delegate_IP で指定された IP アドレスに置換されます。

- Server itself to be monitored + {* --------------------------------------------------------------------- *} + {if paramExists('clear_memqcache_on_escalation')} + Behaivor on escalation Setting - -

wd_hostname (string) * + +

clear_memqcache_on_escalation (bool) * -

watchdog プロセスが相互監視を受信する為のホスト名または IP アドレスです。

+

このオプションが on の場合、pgpool-II がアクティブに昇格した時に、 + 共有メモリ上のクエリキャッシュを全て削除します。 + これにより、旧アクティブと非整合な古いクエリキャッシュが使われることを防止します。

+

memqcache_method が 'shmem' の場合のみ有効です。 デフォルトは on です。

- -

wd_port (integer) * + +

wd_escalation_command (string) * -

watchdog プロセスが相互監視を受信する為のポート番号です。

+

pgpool-II がアクティブに昇格した時に、ここで指定したコマンドが実行されます。 + コマンドは、仮想 IP が立ち上がる直前のタイミングで実行されます。

+ {/if} + + {* --------------------------------------------------------------------- *} + Lifecheck Setting (common) + + {if paramExists('wd_lifecheck_method')} + + +

wd_lifecheck_method (string) * + +

死活監視の方法を指定します。指定できる値は 'heartbeat' (デフォルト)か 'query' です。

+
+
heartbeat
+
+ 監視は「ハートビートモード」で行われます。 + watchdog は一定間隔でハートビート信号(UDP パケット)を他の pgpool-II へ送信します。 + また watchdog は他の pgpool-II から送られてくる信号を受信し、これが一定時間以上途絶えた場合には + その pgpool-II に障害が発生したと判断します。 +
+
query
+
+ 監視は「クエリモード」で行われます。 + watchdog は監視用のクエリを pgpool-II に発行し、それが成功するかどうかで + pgpool-II が生きているかどうかを判断します。

+
+
+ + + {/if} + + + +

wd_interval (integer) * + +

pgpool-II への生存監視の間隔(秒)です。 (1 以上の数値)

+ + + + {* --------------------------------------------------------------------- *} + {if paramExists('wd_lifecheck_method')} + Lifecheck Setting (heartbeat mode) + + + +

wd_heartbeat_port (integer) * + +

ハートビート信号を受信するポート番号を指定します。

+ + + + + +

wd_heartbeat_keepalive (integer) * + +

ハートビート信号を送信する間隔(秒)を指定します。 デフォルトは 2 です。

+ + + + + +

wd_heartbeat_deadtime (integer) * + +

このオプションで指定された間隔(秒)の間ハートビート信号が途絶えた場合、 + その pgpool-II に障害が発生したとみなされます。

+ + + + + +

heartbeat_device (string) * + +

ハートビートの送受信に用いるネットワークデバイス名を指定します。 複数のデバイスが設定可能です。 + 数値の部分はデバイスの番号です。 デバイス毎に 0 からの連番にします。 + 1つのデバイスに複数のハートビート送信先(heartbeat_destiationN)を設定する場合は、 + 重複するデバイス名を異なる番号で指定してください。

+ + + + + +

heartbeat_destination (string) * + +

heartbeat_deviceX に指定したデバイスから送るハートビート信号の宛先を、 + ホスト名か IP で指定します。 + 数値の部分はデバイスの番号です。 デバイス毎に 0 からの連番にします。

+ + + {/if} + + {* --------------------------------------------------------------------- *} + Lifecheck Setting (query mode) + + + +

wd_life_point (string) * + +

pgpool-II の死活監視で応答が得られなかった場合のリトライ回数です。 (1 以上の数値)

+ + + + + +

wd_lifecheck_query (string) * + +

pgpool-II の死活監視のために発行されるクエリです。 デフォルトは "SELECT 1" です。

+ + + + {if paramExists('wd_lifecheck_dbname')} + + +

wd_lifecheck_dbname(string) * + +

pgpool-II の死活監視を行なうのに接続するデータベースです。 デフォルトは "template1" です。

+ + + + + +

wd_lifecheck_user(string) * + +

pgpool-II の死活監視を行なうユーザです。 デフォルトは "nobody" です。

+ + + + + +

wd_lifecheck_query (string) * + +

pgpool-II の死活監視を行なうユーザのパスワードです。

+ + + {/if} Servers to monitor @@ -1970,10 +2097,10 @@ black_function_list = 'nextval,setval,lastval,currval' memqcache_cache_block_size のブロックに分けて利用します。 検索結果のキャッシュはこのブロックに入るだけ詰め込まれます。 ただし、キャッシュは複数のブロックにまたがって格納されないので、 - memqcache_cache_block_sizeを検索結果が超えると、キャッシュに格納できなくなります。 + memqcache_cache_block_size を検索結果が超えると、キャッシュに格納できなくなります。

- memqcache_cache_block_sizeは、512 以上の値でなければなりません。 + memqcache_cache_block_size は、512 以上の値でなければなりません。

diff --git a/templates/pgconfig.tpl b/templates/pgconfig.tpl index 0d79bfc..8422b60 100644 --- a/templates/pgconfig.tpl +++ b/templates/pgconfig.tpl @@ -18,33 +18,40 @@ function resetData(){ document.pgconfig.submit(); } -function del(num){ - if(window.confirm(msgDeleteConfirm)){ - document.pgconfig.action.value= "delete"; - document.pgconfig.num.value = num; - document.pgconfig.submit(); - } -} function addNode() { document.pgconfig.action.value= "add"; document.pgconfig.submit(); } - -function cancelNode() { - document.pgconfig.action.value= "cancel"; - document.pgconfig.submit(); -} - function addOtherWatchdog() { document.pgconfig.action.value= "add_wd"; document.pgconfig.submit(); } +function addHeartbeatDevice() { + document.pgconfig.action.value= "add_heartbeat_device"; + document.pgconfig.submit(); +} +function cancelNode() { + document.pgconfig.action.value= "cancel"; + document.pgconfig.submit(); +} function cancelOtherWatchdog() { document.pgconfig.action.value= "cancel_wd"; document.pgconfig.submit(); } +function cancelHeartbeatDevice() { + document.pgconfig.action.value= "cancel_heartbeat_device"; + document.pgconfig.submit(); +} + +function deleteNode(num){ + if(window.confirm(msgDeleteConfirm)){ + document.pgconfig.action.value= "delete"; + document.pgconfig.num.value = num; + document.pgconfig.submit(); + } +} function delOtherWatchdog(num){ if(window.confirm(msgDeleteConfirm)){ document.pgconfig.action.value= "delete_wd"; @@ -52,7 +59,13 @@ function delOtherWatchdog(num){ document.pgconfig.submit(); } } - +function delHeartbeatDevice(num){ + if(window.confirm(msgDeleteConfirm)){ + document.pgconfig.action.value= "delete_heartbeat_device"; + document.pgconfig.num.value = num; + document.pgconfig.submit(); + } +} // --> @@ -363,15 +376,15 @@ function delOtherWatchdog(num){ {if isset($isAdd) && $isAdd == true} - - + + {else} - - + + {/if} @@ -379,14 +392,15 @@ function delOtherWatchdog(num){ {foreach from=$params.backend_hostname key=node_num item=v} - node {$node_num} + + node {$node_num}
backend_hostname{$node_num} (string) + onclick="deleteNode({$node_num})" /> @@ -428,7 +442,8 @@ function delOtherWatchdog(num){ {if isset($isAdd) && $isAdd == true} - node [new] + + node {$node_num + 1}
backend_hostname{$smarty.section.num.index} (string) @@ -1229,141 +1244,269 @@ function delOtherWatchdog(num){ + {* --------------------------------------------------------------------- *} + Enabling - +
use_watchdog (bool) * - Connection to up stream servers + {* --------------------------------------------------------------------- *} + Connection to up stream servers - +
trusted_servers (string) * - +
ping_path (string) * - Lifecheck of pgpol-II - - - - -
wd_interval (integer) * - - - - - - -
wd_life_point(integer) * - - - - - - -
wd_lifecheck_query (string) * - - + {* --------------------------------------------------------------------- *} + Watchdog communication Settings - {if paramExists('wd_lifecheck_dbname')} - - -
wd_lifecheck_dbname (string) * - + + +
wd_hostname (string) * + - - -
wd_lifecheck_user (string) * - + + +
wd_port (integer) * + - - -
wd_lifecheck_password (string) * - + + +
wd_authkey (string) * + - {/if} - Virtual IP address + {* --------------------------------------------------------------------- *} + Virtual IP control Setting - +
delegate_IP (string) * - +
ifconfig_path (string) * - +
if_up_cmd (string) * - +
if_down_cmd (string) * - +
arping_path (string) * - +
arping_cmd (string) * - Server itself to be monitored + {* --------------------------------------------------------------------- *} + Behaivor on escalation Setting - - -
wd_hostname (string) * - + + +
clear_memqcache_on_escalation (bool) + - - -
wd_port (integer) * - + + +
wd_escalation_command (string) * + + + + {* --------------------------------------------------------------------- *} + Lifecheck Setting (common) + + {if paramExists('heartbeat_device')} + + + +
wd_lifecheck_method (string) * + + + + {/if} + + + + +
wd_interval (integer) * + - Servers to monitor + {* --------------------------------------------------------------------- *} + {if paramExists('heartbeat_device')} + Lifecheck Setting (heartbeat mode) + + + + +
wd_heartbeat_port (integer) * + + + + + + + +
wd_heartbeat_keepalive (integer) * + + + + + + + +
wd_heartbeat_deadtime (integer) * + + + + + {if paramExists('heartbeat_device')} + {foreach from=$params.heartbeat_device key=device_num item=v} + + device {$device_num} + + +
heartbeat_device{$device_num} (string) + + + + + + + + +
heartbeat_destination{$device_num|escape} (integer) + + + {/foreach} + + {if isset($isAddHeartbeatDevice) && $isAddHeartbeatDevice == true} + + device {$device_num + 1} + +
heartbeat_device{$smarty.section.device_num.index} (string) + + + + + +
heartbeat_destination{$smarty.section.device_num.index|escape} (integer) + + + + + + + + {else} + + + + + {/if} + {/if} + {/if} + + {* --------------------------------------------------------------------- *} + Lifecheck Setting (query mode) + + + + +
wd_life_point(integer) * + + + + + + +
wd_lifecheck_query (string) * + + + + + {if paramExists('wd_lifecheck_dbname')} + + + +
wd_lifecheck_dbname (string) * + + + + + + +
wd_lifecheck_user (string) * + + + + + + +
wd_lifecheck_password (string) * + + + {/if} + + {* --------------------------------------------------------------------- *} + Other pgpool Connection Settings {foreach from=$params.other_pgpool_hostname key=host_num item=v} + other {$host_num}
other_pgpool_hostname{$host_num} (string) @@ -1391,6 +1534,7 @@ function delOtherWatchdog(num){ {if isset($isAddWd) && $isAddWd == true} + other {$host_num + 1}
other_pgpool_hostname{$smarty.section.num.index} (string) @@ -1413,15 +1557,15 @@ function delOtherWatchdog(num){ {if isset($isAddWd) && $isAddWd == true} - - + + {else} - - + + {/if} @@ -1607,9 +1751,10 @@ function delOtherWatchdog(num){ {* --------------------------------------------------------------------- * * Form End * * --------------------------------------------------------------------- *} -

- - +


+

+ +

-- 2.39.5