Multiple Amavis Instances on reliable Redis

Mark Martinec Mark.Martinec+amavis at ijs.si
Tue Apr 26 19:24:57 CEST 2016


Marc Patermann wrote:
> the current setup is two Postfix MX servers for in- and outgoing mail.
> amavis and SpamAssassin use a single MySQL database (SPOF).
> 
> While updating hard- and software we want to change to Redis instead of 
> MySQL.
> 
> The Redis data should be the same for both MX servers. To avoid the 
> SPOF
> there have to be more than one Redis instances.
> 
> So we tried Redis Sentinel. But amavis seems not to work with that, it
> does not connect to Redis on the Sentinel port, there is a SELECT 
> error.
> 
> (!)_DIE: [select] ERR unknown command 'SELECT',  at (eval 110) line61
> select] ERR unknown command 'SELECT',  at (eval 110) line 61.
> 
> Is it possible to use amavis mit Redis Sentinel?
> Or is there another, better approach to achieve what we want?

Redis sentinel requires some additional support from clients,
which at this time amavisd does not provide unfortunately.
Something for a TODO list.

   http://redis.io/topics/sentinel-clients


Nuno Fernandes wrote:
> I use keepalived+custom scripts to achieve HA in redis without 
> sentinel.
> 
> I used as base the following project 
> https://github.com/aw/redis-failover but
> then created our own custom scripts.
> 
> P.S. - we don't use this redis cluster for amavisd but i'm certain it 
> would
> work as it uses the same protocol


I haven't tried any of the new HA or cluster features of redis.
That's certainly something to address in future.

Note there is one caveat with clustered Redis and amavis:
the Lua scripts that amavisd uses for speed assume that all records
exist on the same node, i.e. the requirement for listing all
affected keys in the KEYS argument is broken in some amavisd queries
which generate (sub)queries dynamically. This is fine for a plain
single Redis server instance, but will likely break in a Redis cluster.

The use of Redis by a SpamAssassin (for its bayes database) on the
other hand does *not* violate this redis requirement, and should be able
to work in a Redis cluster. But again, the client support for a Sentinel
is not currently available there either.

   Mark


More information about the amavis-users mailing list