Re: [exim] How to be resilient to mysql server unreachable?

Góra strony
Delete this message
Reply to this message
Autor: Juan Bernhard
Data:  
Dla: exim-users
Temat: Re: [exim] How to be resilient to mysql server unreachable?

El 16/12/2014 a las 03:05 p.m., josh trier escibió:
>>
>> Hello
>>
>> This worked for me to make exim continue delivering messages when my MySQL
>> server was unreachable. I understand how having a second replicated DB is
>> not necessary in some cases. I used a simple ACL warn statement followed by
>> a connection test via a simple query. When the output value does not match
>> CONNTEST the ACL will not continue, but messages will still be sent.
>>
>> Here is a snippet:
>> --------------
>>      SPAMTRAP_CHECK     = SELECT 'CONNTEST';
>> --------------

>>
>> --------------
>> .ifdef SPAMTRAP_ENABLED
>> spamtrap_acl:
>>
>>   warn
>>          set acl_m1     = ${lookup mysql{SPAMTRAP_CHECK}{$value}}

>>
>> --------------
>>
>> Then in acl_check_content in my example I added the status of CONNTEST a
>> condition for the ACL
>>
>> --------------
>>   warn
>>        spam        = ${sender_address}/defer_ok
>>        acl = spamtrap_acl
>>        condition = ${if eq{$acl_m1} {CONNTEST}}
>>        condition = ${lookup mysql{SPAMTRAP_LOG_HIT}}
>>        condition = ${lookup mysql{SPAMTRAP_INC_HIT}}
>>        spam        = nobody
>> --------------

>>
>> I can provide more of code if necessary, but this should get you going.
>>
>> - Josh



Thank you, Josh! Ill study your implementation. It seems the kind of
solution I was needing.


>>
>> On Tue, Dec 16, 2014 at 11:47 AM, Todd Lyons <tlyons@???> wrote:
>> On Tue, Dec 16, 2014 at 8:31 AM, Juan Bernhard <juan@???> wrote:
>>>
>>> Hi list, im planning to implement a vacation message using a mysql
>>> server, and i would like that when the mysql server were down, the exim
>>> continues delivering messages and ignoring the vacation (failing the
>>> lookup). The mysql server only has the vacation info, the rest are done
>>> by local files and unix users.
>>
>> You're asking exim to control your fault tolerance, when I think it's
>> better done with other, more specific software. My suggestion is to
>> create one more virtual machine:
>> 1) Create a secondary db server, it can be less powerful than your
>> current db server.
>> 2) Make the current db server the primary, and configure the secondary
>> to replicate from it.
>> 3) Either on your Exim server or on that slave db server, also
>> configure and run a mysql proxy, such as MaxScale
>> (https://mariadb.com/products/mariadb-maxscale) running on port 3307.
>> 4) Configure your exim to use that MaxScale proxy. In normal
>> conditions, you'd have the MaxScale load balancing between the primary
>> and secondary db servers. When/If your primary goes down, the
>> MaxScale will detect it and send all traffic to the secondary. Once
>> the primary comes back up, MaxScale will once again load balance
>> between them.
>>
>> Use the right tool for the job. A proxy program is written to do
>> exactly the things you are trying to get Exim to do. It's better to
>> use that proxy instead of trying to Exim to do it.
>>
>> ...Todd
>> --
>> The total budget at all receivers for solving senders' problems is $0.
>> If you want them to accept your mail and manage it the way you want,
>> send it the way the spec says to. --John Levine
>>
>> --
>> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
>> ## Exim details at http://www.exim.org/
>> ## Please use the Wiki with this list - http://wiki.exim.org/
>>