You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Matteo Dessalvi <mt...@yahoo.it> on 2014/08/20 14:25:45 UTC

sa-learn site-wide bayes on Redis

Hi all.


I am managing a bunch of Linux MTAs which are placed in
front of some Exchange servers. In such a configuration
the Bayes filter is deployed site-wide.

For a new deployment of these servers I am planning
to use Redis as a centralized backend (previously
the bayes db were just files saved on the disk).

My question is: do I have to use a specific option
to tell sa-learn that the bayes db is now hosted on
Redis? Or sa-learn will use the info from the
bayes_sql_dsn directive in my local.cf?

Looking into the wiki:
http://wiki.apache.org/spamassassin/SiteWideBayesSetup

or into the sa-learn docs:
http://spamassassin.apache.org/full/3.4.x/doc/sa-learn.html

did not give me any clues.


Thanks in advance!


Best regards,
   Matteo

Re: sa-learn site-wide bayes on Redis

Posted by Axb <ax...@gmail.com>.
I so love to posters.....

On 08/20/2014 03:33 PM, Matteo Dessalvi wrote:
> Ok, perfect! Thanks a lot! This is what I want to know
> and I was not so sure about.
>
> I may be wrong but it looks to me the fact that
> tools like sa-learn can access transparently the
> backends configured for SA is not exactly clear
> from the docs.
>
> It would be great if the wiki maintainers could add
> a short note somewhere in the pages regarding the
> SiteWide deployment or related topics.
>
> Best regards,
>       Matteo
>
> On 20.08.2014 15:08, Axb wrote:
>> bayes_store_module  Mail::SpamAssassin::BayesStore::Redis
>>
>> tells SA to use the Redis backend. To sa-learn this becomes transparent,
>> as with any other backed (DBD,SDBM,SQL)
>>
>> bayes_redis.cf shows what parameters are mandatory/optional

Watch your memory usage:

If you configure Redis to dump data from memory to file, it's safe to 
*double* the amount of memory you planned for Redis usage


as in my case:

sa-learn --dump magic
0.000          0          3          0  non-token data: bayes db version
0.000          0   25218483          0  non-token data: nspam
0.000          0   11919587          0  non-token data: nham

# Memory
used_memory:3637407032
used_memory_human:3.39G
used_memory_rss:4068585472
used_memory_peak:3702485960
used_memory_peak_human:3.45G
used_memory_lua:205824
mem_fragmentation_ratio:1.12
mem_allocator:jemalloc-3.2.0


I keep at least 5 GB of free memory for the dump to file to avoid ugly 
swaps or crashes.

free
	total       used       free     shared    buffers     cached
Mem:    14262648    5786664    8475984  0          162744     1343408
-/+ buffers/cache:    4280512    9982136
Swap:      2046968          0    2046968




Re: sa-learn site-wide bayes on Redis

Posted by Matteo Dessalvi <mt...@yahoo.it>.
Ok, perfect! Thanks a lot! This is what I want to know
and I was not so sure about.

I may be wrong but it looks to me the fact that
tools like sa-learn can access transparently the
backends configured for SA is not exactly clear
from the docs.

It would be great if the wiki maintainers could add
a short note somewhere in the pages regarding the
SiteWide deployment or related topics.

Best regards,
      Matteo

On 20.08.2014 15:08, Axb wrote:
> bayes_store_module  Mail::SpamAssassin::BayesStore::Redis
>
> tells SA to use the Redis backend. To sa-learn this becomes transparent,
> as with any other backed (DBD,SDBM,SQL)
>
> bayes_redis.cf shows what parameters are mandatory/optional
>
>

Re: sa-learn site-wide bayes on Redis

Posted by Axb <ax...@gmail.com>.
bayes_store_module  Mail::SpamAssassin::BayesStore::Redis

tells SA to use the Redis backend. To sa-learn this becomes transparent, 
as with any other backed (DBD,SDBM,SQL)

bayes_redis.cf shows what parameters are mandatory/optional

On 08/20/2014 03:02 PM, Matteo Dessalvi wrote:
> No, unfortunately it does not help me.
> I already have a proper config file for SA
> to access Redis as backend and most of
> the configurations are done automatically
> through a Chef cookbook (Redis included).
>
> In the docs you pointed me there's nothing
> about the interaction between sa-learn and
> Redis.
>
> Best regards,
>     Matteo
>
> On 20.08.2014 14:42, Axb wrote:
>>
>> see
>>
>> http://svn.apache.org/repos/asf/spamassassin/trunk/contrib/HOWTO.Bayes-Redis/
>>
>>
>>
>> hope that helps.
>> This is not an official doc, so if you see anything that needs to be
>> added/changed, pls let me know.
>>


Re: sa-learn site-wide bayes on Redis

Posted by Matteo Dessalvi <mt...@yahoo.it>.
No, unfortunately it does not help me.
I already have a proper config file for SA
to access Redis as backend and most of
the configurations are done automatically
through a Chef cookbook (Redis included).

In the docs you pointed me there's nothing
about the interaction between sa-learn and
Redis.

Best regards,
    Matteo

On 20.08.2014 14:42, Axb wrote:
>
> see
>
> http://svn.apache.org/repos/asf/spamassassin/trunk/contrib/HOWTO.Bayes-Redis/
>
>
> hope that helps.
> This is not an official doc, so if you see anything that needs to be
> added/changed, pls let me know.
>

Re: BayesStore::Redis can't do AUTH when Redis is <=2.6 (was: sa-learn site-wide bayes on Redis)

Posted by Marcin Mirosław <ma...@mejor.pl>.
W dniu 21.08.2014 o 15:20, Matteo Dessalvi pisze:
> Which version of Redis are you using? I did have some
> problems with the 2.4 version packaged by Debian and
> I did solve a similar problem using a more recent
> version, like the 2.7 or 2.8.

And you fixed my problem! Indeed, upgrading from redis-2.6.15 to 2.8.13
fixed problem with not working AUTH.
Thanks Matteo!


Re: sa-learn site-wide bayes on Redis

Posted by Matteo Dessalvi <mt...@yahoo.it>.
Which version of Redis are you using? I did have some
problems with the 2.4 version packaged by Debian and
I did solve a similar problem using a more recent
version, like the 2.7 or 2.8.

Matteo

On 21.08.2014 14:45, Marcin Mirosław wrote:
> W dniu 21.08.2014 o 13:45, Matteo Dessalvi pisze:
>> I am pretty sure SA support the Redis authentication mechanism.
>> For my tests I have used the following line:
>>
>> bayes_sql_dsn  server=127.0.0.1:6379;password=MySecretPWD;database=2
>
> Thanks Matteo,
> firstly I should try then write to ML:) So now I did own check. It looks
> that SA doesn't authenticate when connects to redis. It didn't work for
> me with your example not when I used
> bayes_sql_password   password
>
> When redis needs passowrd then SA throws "bayes: Redis failed: Redis
> error: ERR operation not permitted", tcpdump also confirms that SA
> doesn't do AUTH.
> It's strange because in Redis.pm I can see that authentication is
> supported. Now I'm thinking where I could made mistake in configuration...
>
> Thanks,
> Marcin
>

Re: sa-learn site-wide bayes on Redis

Posted by Marcin Mirosław <ma...@mejor.pl>.
W dniu 21.08.2014 o 13:45, Matteo Dessalvi pisze:
> I am pretty sure SA support the Redis authentication mechanism.
> For my tests I have used the following line:
> 
> bayes_sql_dsn  server=127.0.0.1:6379;password=MySecretPWD;database=2

Thanks Matteo,
firstly I should try then write to ML:) So now I did own check. It looks
that SA doesn't authenticate when connects to redis. It didn't work for
me with your example not when I used
bayes_sql_password   password

When redis needs passowrd then SA throws "bayes: Redis failed: Redis
error: ERR operation not permitted", tcpdump also confirms that SA
doesn't do AUTH.
It's strange because in Redis.pm I can see that authentication is
supported. Now I'm thinking where I could made mistake in configuration...

Thanks,
Marcin

Re: sa-learn site-wide bayes on Redis

Posted by Matteo Dessalvi <mt...@yahoo.it>.
I am pretty sure SA support the Redis authentication mechanism.
For my tests I have used the following line:

bayes_sql_dsn  server=127.0.0.1:6379;password=MySecretPWD;database=2

Matteo

On 21.08.2014 12:56, Marcin Mirosław wrote:
>
> Hi!
> I'm reading bayes_redis.cf and I can see:
> "
> #NOTE: We're not using authentication assuming the Redis server/port
> should not be reachable form the "outside"
> # You can add authentication once you've seen it work.
> "
>
> Does it means that this example config doesn't include authentication
> options or it means that SA doesn't support auth for redis?
>
> Marcin
>
>
>
>

Re: sa-learn site-wide bayes on Redis

Posted by Marcin Mirosław <ma...@mejor.pl>.
W dniu 20.08.2014 o 14:42, Axb pisze:
> On 08/20/2014 02:25 PM, Matteo Dessalvi wrote:
>> Hi all.
>>
>>
>> I am managing a bunch of Linux MTAs which are placed in
>> front of some Exchange servers. In such a configuration
>> the Bayes filter is deployed site-wide.
>>
>> For a new deployment of these servers I am planning
>> to use Redis as a centralized backend (previously
>> the bayes db were just files saved on the disk).
>>
>> My question is: do I have to use a specific option
>> to tell sa-learn that the bayes db is now hosted on
>> Redis? Or sa-learn will use the info from the
>> bayes_sql_dsn directive in my local.cf?
>>
>> Looking into the wiki:
>> http://wiki.apache.org/spamassassin/SiteWideBayesSetup
>>
>> or into the sa-learn docs:
>> http://spamassassin.apache.org/full/3.4.x/doc/sa-learn.html
>>
>> did not give me any clues.
> 
> see
> 
> http://svn.apache.org/repos/asf/spamassassin/trunk/contrib/HOWTO.Bayes-Redis/
> 
> 
> hope that helps.
> This is not an official doc, so if you see anything that needs to be
> added/changed, pls let me know.

Hi!
I'm reading bayes_redis.cf and I can see:
"
#NOTE: We're not using authentication assuming the Redis server/port
should not be reachable form the "outside"
# You can add authentication once you've seen it work.
"

Does it means that this example config doesn't include authentication
options or it means that SA doesn't support auth for redis?

Marcin





Re: sa-learn site-wide bayes on Redis

Posted by Axb <ax...@gmail.com>.
On 08/20/2014 02:25 PM, Matteo Dessalvi wrote:
> Hi all.
>
>
> I am managing a bunch of Linux MTAs which are placed in
> front of some Exchange servers. In such a configuration
> the Bayes filter is deployed site-wide.
>
> For a new deployment of these servers I am planning
> to use Redis as a centralized backend (previously
> the bayes db were just files saved on the disk).
>
> My question is: do I have to use a specific option
> to tell sa-learn that the bayes db is now hosted on
> Redis? Or sa-learn will use the info from the
> bayes_sql_dsn directive in my local.cf?
>
> Looking into the wiki:
> http://wiki.apache.org/spamassassin/SiteWideBayesSetup
>
> or into the sa-learn docs:
> http://spamassassin.apache.org/full/3.4.x/doc/sa-learn.html
>
> did not give me any clues.

see

http://svn.apache.org/repos/asf/spamassassin/trunk/contrib/HOWTO.Bayes-Redis/

hope that helps.
This is not an official doc, so if you see anything that needs to be 
added/changed, pls let me know.