[exim] [PATCH]: ability to disable loadbalancing but still h…

Inizio della pagina
Delete this message
Reply to this message
Autore: Arkadiusz Miskiewicz
Data:  
To: Philip Hazel
CC: exim-users
Oggetto: [exim] [PATCH]: ability to disable loadbalancing but still having failover of spamd servers

Patch below allows to have few spamd servers in spamd_address variable
but without load balancing.

Usage case: I have quite busy mailserver with spamassassin installed
and second server with only spamassassin. First server is quite busy
with just handling emails so I wanted to just use seconds server but have
fallback to first one in case when second dies/spamd dies.

I get that with this patch + in config:
spamd_address = first 783 : second 783
spamd_loadbalance = no

Please apply to future versions of exim or... improve it and then apply :)

I guess that something like
spamd_address = 1.1.1.1 783 : 1.1.1.2 783 : 1.1.1.3 783/failover : 1.1.1.4 783/failover
would be even nicer. .1 and .2 would by used by default (loadbalancing) and in case
(and only such case) when both die then switch to failover hosts (with loadbalancing).

diff -urbB exim-4.54.org/src/globals.c exim-4.54/src/globals.c
--- exim-4.54.org/src/globals.c    2005-11-25 22:02:44.762799750 +0100
+++ exim-4.54/src/globals.c    2005-11-25 21:54:06.210392250 +0100
@@ -1058,6 +1058,7 @@


 #ifdef WITH_CONTENT_SCAN
 uschar *spamd_address          = US"127.0.0.1 783";
+BOOL    spamd_loadbalance      = TRUE;
 uschar *spam_bar               = NULL;
 uschar *spam_report            = NULL;
 uschar *spam_score             = NULL;
diff -urbB exim-4.54.org/src/globals.h exim-4.54/src/globals.h
--- exim-4.54.org/src/globals.h    2005-11-25 22:02:44.762799750 +0100
+++ exim-4.54/src/globals.h    2005-11-25 21:54:37.700360250 +0100
@@ -656,6 +656,7 @@


 #ifdef WITH_CONTENT_SCAN
 extern uschar *spamd_address;          /* address for the spamassassin daemon */
+extern BOOL   spamd_loadbalance;       /* load balance or try in order from config */
 extern uschar *spam_bar;               /* the spam "bar" (textual representation of spam_score) */
 extern uschar *spam_report;            /* the spamd report (multiline) */
 extern uschar *spam_score;             /* the spam score (float) */
diff -urbB exim-4.54.org/src/readconf.c exim-4.54/src/readconf.c
--- exim-4.54.org/src/readconf.c    2005-11-25 22:02:44.762799750 +0100
+++ exim-4.54/src/readconf.c    2005-11-25 21:55:01.061820250 +0100
@@ -339,6 +339,7 @@
   { "smtp_return_error_details",opt_bool,        &smtp_return_error_details },
 #ifdef WITH_CONTENT_SCAN
   { "spamd_address",            opt_stringptr,   &spamd_address },
+  { "spamd_loadbalance",    opt_bool,        &spamd_loadbalance },
 #endif
   { "split_spool_directory",    opt_bool,        &split_spool_directory },
   { "spool_directory",          opt_stringptr,   &spool_directory },
diff -urbB exim-4.54.org/src/spam.c exim-4.54/src/spam.c
--- exim-4.54.org/src/spam.c    2005-10-04 10:55:28.000000000 +0200
+++ exim-4.54/src/spam.c    2005-11-25 22:01:46.839179750 +0100
@@ -127,7 +127,10 @@
       return DEFER;
     };


+    if (spamd_loadbalance)
     current_server = start_server = (int)now % num_servers;
+    else
+        current_server = start_server = 0;


     while (1) {



-- 
Arkadiusz Miśkiewicz                    PLD/Linux Team
http://www.t17.ds.pwr.wroc.pl/~misiek/  http://ftp.pld-linux.org/