Scalable Anti-Spam Using Spamassassin and MySQL

Revision as of 20:47, 6 May 2011 by Gayle (talk | contribs) (Created page with '{{Article Infobox|{{admin}}|{{ZCS 7.0}}|||}} =Spamassassin Bayes Database Options= By default, SpamAssassin in Zimbra ZCS utilizes a Berkeley DB format database for it's Bayes fi…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Admin Article

Article Information

This article applies to the following ZCS versions.

ZCS 7.0 Article ZCS 7.0


Spamassassin Bayes Database Options

By default, SpamAssassin in Zimbra ZCS utilizes a Berkeley DB format database for it's Bayes filtering data. The Berkeley DB format database implementation in SpamAssassin uses a sequential locking mechanism which can impede message processing for larger ZCS installations. Thus the default for SpamAssassin to use the Berkeley DB format database may not be ideal.

Alternatively, SpamAssassin can be configured to use a MySQL back-end database to store its Bayes filtering data. A MySQL database affords increased performance to SpamAssassin and message processing as it allows for concurrent access to the indexed database.

Although there is some overhead in running and maintaining a MySQL database instance, the performance gains may warrant this extra overhead.


Enabling MySQL database

As the zimbra user, run the following commands:

zmlocalconfig -e antispam_mysql_enabled=TRUE
zmantispamctl restart


Reverting to (default) Berkeley DB format database

As the zimbra user, run the following commands:

zmlocalconfig -e antispam_mysql_enabled=FALSE
zmantispamctl restart


Accessing a remote Spamassassin MySQL database

Optionally in a multi-node environment, if a Spamassassin MySQL Database server is already running on another MTA node, Spamassassin can be configured to utilize that remote Spamassassin MySQL Database (instead of running an additional MySQL database instance).

To configure Spamassassin to utilize a remote Spamassassin MySQL Database server, the user name and password of the remote Spamassassin MySQL Database is required. This can be obtained by running the following commands as the zimbra user:

On remote server

zmlocalconfig -s antispam_mysql_user
zmlocalconfig -s antispam_mysql_password


To enable the local MTA server to access the remote Spamassassin MySQL Database, as the zimbra user, run the following commands on the local server:

On local server

zmlocalconfig -e antispam_mysql_user=<username>
zmlocalconfig -e antispam_mysql_password=<password>
zmlocalconfig -e antispam_mysql_host=<remote_host>
zmlocalconfig -e antispam_mysql_enabled=TRUE
zmantispamctl restart

where "<username>" is the name of the MySQL user and "<password>" is the password for the MySQL user account on the remote server; and where <remote_host> is the FQDN of the remote host already running the Spamassassin MySQL Database engine.


Verified Against: ZCS 7.0 Date Created: 5/5/2011
Article ID: https://wiki.zimbra.com/index.php?title=Scalable_Anti-Spam_Using_Spamassassin_and_MySQL Date Modified: 2011-05-06



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search