How can I configure the anti-spam learning in Warden to use Redis for storing bayes data ?

For high volume servers we recommend switching from the default MySQL storage back end to the the Redis back end for Bayes data. This allows spam training and Bayes lookups to run in memory which makes it extremely fast. 

Export the Current Bayes Data

Run the sa-learn command below to export the Bayes data that is stored in the MySQL database to a file that you can use later to import back into the Redis database:

sa-learn -u amavis --backup > /tmp/amavis-bayes.db

Install Redis

Important: It is up to you to secure your Redis installation. You should make sure that the Redis port 6379 is not exposed to the Internet. We recommend binding Redis to the IPv4 loopback interface 127.0.0.1 (normally this is done by default) and setting a password for it. Also Redis is an in memory storage engine so you must have the free memory available on the server. (A typical server will use under 100MB of bayes data while a really busy server could use over 1 GB of memory.)

RHEL/Centos/Cloudlinux/AlmaLinux

yum install redis
systemctl enable redis --now 

Debian/Ubuntu

apt-get install redis-server
systemctl enable redis-server --now 

Enable Redis in Warden

  1. Go to Warden -> Settings -> Learning Settings and change the Bayes store module option to Redis.
  2. Enter in the Redis password if you are using one in the Bayes SQL DSN.
  3. Enter in the Bayes Token TTL (The number of days before the entries expire). For low volume servers we recommend 180d (6 months). For high volume servers we recommend 90d (3 months).
  4. Press the update button to save your settings.

If everything is working you should see the Anti-spam learning dashboard widget reset to zero and it should increment throughout the day as the real-time learning, auto learning, and nightly training runs.

Import the Exported Bayes Data Back into Redis

Run the sa-learn command below to import the exported Bayes data back into the Redis database:

sa-learn -u amavis --restore /tmp/amavis-bayes.db
  • redis, learning, bayes, optimize, performance
  • 2 Пользователи нашли это полезным
Помог ли вам данный ответ?

Связанные статьи

How can I change the interface language of the extension?

You can change the interface language under Settings -> Application Settings -> Locale...

How can I disable admin email notifications in Amavis?

Amavis has different default options for controlling where virus, spam, banned file attachments,...

How can I whitelist or blacklist a mail server from greylisting?

To Whitelist a Mail Server From Greylisting Navigate to Warden -> Settings ->...

How can I enable third party anti-virus signatures within Warden to improve the ClamAV detection rate?

Warden supports enabling third party anti-virus signatures to improve the detection rate. These...

How can I setup a local caching DNS resolver to speed up DNS queries used by Amavis?

Run the following command to check if local DNS caching is enabled: host -tTXT...