From 101e95d3d9c14d08c716466378a05af19e703c5d Mon Sep 17 00:00:00 2001 From: thompsa Date: Fri, 12 Feb 2010 17:51:40 +1300 Subject: Add backup option to the backend servers --- config/haproxy-dev/haproxy.inc | 7 ++++++- config/haproxy-dev/haproxy_pool_edit.php | 18 +++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'config/haproxy-dev') diff --git a/config/haproxy-dev/haproxy.inc b/config/haproxy-dev/haproxy.inc index e6365a7d..a799cd48 100644 --- a/config/haproxy-dev/haproxy.inc +++ b/config/haproxy-dev/haproxy.inc @@ -336,7 +336,12 @@ function haproxy_configure() { } if (!$be['name']) $be['name'] = $be['address']; - fwrite ($fd, "\tserver\t\t\t" . $be['name'] . " " . $be['address'].":" . $be['port'] . " $cookie " . " $checkinter weight " . $be['weight'] . "{$advanced_txt}\n"); + if($be['backup']) { + $isbackup = "backup"; + } else { + $isbackup = ""; + } + fwrite ($fd, "\tserver\t\t\t" . $be['name'] . " " . $be['address'].":" . $be['port'] . " $cookie " . " $checkinter $isbackup weight " . $be['weight'] . "{$advanced_txt}\n"); } } diff --git a/config/haproxy-dev/haproxy_pool_edit.php b/config/haproxy-dev/haproxy_pool_edit.php index 3d1d1844..6087e9d7 100755 --- a/config/haproxy-dev/haproxy_pool_edit.php +++ b/config/haproxy-dev/haproxy_pool_edit.php @@ -88,6 +88,7 @@ if ($_POST) { $server_address=$_POST['server_address'.$x]; $server_port=$_POST['server_port'.$x]; $server_weight=$_POST['server_weight'.$x]; + $server_backup=$_POST['server_backup'.$x]; if ($server_address) { @@ -96,6 +97,7 @@ if ($_POST) { $server['address']=$server_address; $server['port']=$server_port; $server['weight']=$server_weight; + $server['backup']=$server_backup; $a_servers[]=$server; if (preg_match("/[^a-zA-Z0-9\.\-_]/", $server_name)) @@ -208,6 +210,9 @@ function clearcombo(){ rowname[3] = "server_weight"; rowtype[3] = "textbox"; rowsize[3] = "5"; + rowname[4] = "server_backup"; + rowtype[4] = "checkbox"; + rowsize[4] = "5"; @@ -258,6 +263,7 @@ function clearcombo(){ Address Port Weight + Backup + +
@@ -294,6 +301,8 @@ function clearcombo(){ + />
@@ -351,7 +360,7 @@ function clearcombo(){