Could not connect to Redis at 127.0.0.1:6379: Connection refused

regarding this Rspam filter stats have reset

I tried:
redis-cli -s /var/run/redis-rspamd/rspamd --scan --pattern BAYES_* | xargs redis-cli del

But the server answers with:
Could not connect to Redis at 127.0.0.1:6379: Connection refused

What could be the cause and how to fix it?

Sincerely, Marko

Ps.:

 systemctl status redis-rspamd
● redis-rspamd.service - Redis persistent key-value database Rspamd
   Loaded: loaded (/usr/lib/systemd/system/redis-rspamd.service; static; vendor preset: disabled)
   Active: active (running) since Mon 2021-02-22 12:30:09 CET; 15min ago
 Main PID: 737 (redis-server)
   CGroup: /system.slice/redis-rspamd.service
           └─737 /usr/bin/redis-server 127.0.0.1:0

Feb 22 12:30:09 ns-srv01.dargels.de systemd[1]: Started Redis persistent key-value dat...d.
Hint: Some lines were ellipsized, use -l to show in full.
[root@prometheus ~]# redis-cli -s /var/run/redis-rspamd/rspamd --scan --pattern BAYES_*
BAYES_SPAM_keys
BAYES_HAM_keys
[root@prometheus ~]# systemctl status redis redis-rspamd
● redis.service - Redis persistent key-value database
   Loaded: loaded (/usr/lib/systemd/system/redis.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/redis.service.d
           └─limit.conf
   Active: inactive (dead)

● redis-rspamd.service - Redis persistent key-value database Rspamd
   Loaded: loaded (/usr/lib/systemd/system/redis-rspamd.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2021-02-16 10:57:47 CET; 6 days ago
 Main PID: 817 (redis-server)
   CGroup: /system.slice/redis-rspamd.service
           └─817 /usr/bin/redis-server 127.0.0.1:0

Feb 16 10:57:47 prometheus.de-labrusse.fr systemd[1]: Started Redis persistent key-value database Rspamd.
[root@prometheus ~]# 
[root@prometheus ~]# ll /var/lib/redis/
total 6160
-rw-r--r-- 1 redis redis 6304186 Dec 22  2019 dump.rdb
drwxr-xr-x 2 redis redis      46 Feb 22 12:56 rspamd
[root@prometheus ~]# ll /var/lib/redis/rspamd/
total 143864
-rw-r--r-- 1 redis mail  13391108 Feb 22 12:56 dump.rdb
-rw-r--r-- 1 redis mail 133918999 Oct 25  2019 dump.rdb20191025
[root@ns-srv01 rspamd]# redis-cli -s /var/run/redis-rspamd/rspamd --scan --pattern BAYES_*
BAYES_SPAM_keys
BAYES_HAM_keys

it works be happy

yes, but I really want to reset my bays filter because a lot of wrong spam classifications by my user

But the reset procedure doesn’t work.

[root@ns-srv01 rspamd]# redis-cli -s /var/run/redis-rspamd/rspamd --scan --pattern BAYES_* | xargs redis-cli del
Could not connect to Redis at 127.0.0.1:6379: Connection refused

[root@ns-srv01 rspamd]# redis-cli -s /var/run/redis-rspamd/rspamd --scan --pattern RS* | xargs redis-cli del
Could not connect to Redis at 127.0.0.1:6379: Connection refused
Could not connect to Redis at 127.0.0.1:6379: Connection refused

read carefully what you pasted and you will see your typo…a clue look at redis

I fixed the wiki

1 Like

I like that you are trying to draw my attention to something specific. But I obviously have tomatoes on my eyes.

1 Like

ok, not only tomatoes… I would never have had this idea

1 Like

it makes sense, we use a specific database path, you have to adjust it

Just now it works well

[root@ns-srv01 ~]# rspamc stat
Results for command: stat (0.007 seconds)
Messages scanned: 5507
Messages with action reject: 2230, 40.49%
Messages with action soft reject: 10, 0.18%
Messages with action rewrite subject: 0, 0.00%
Messages with action add header: 761, 13.81%
Messages with action greylist: 962, 17.46%
Messages with action no action: 1544, 28.03%
Messages treated as spam: 3001, 54.49%
Messages treated as ham: 2506, 45.50%
Messages learned: 252
Connections count: 0
Control connections count: 34
Pools allocated: 116
Pools freed: 81
Bytes allocated: 26.73MiB
Memory chunks allocated: 144
Shared chunks allocated: 17
Chunks freed: 0
Oversized chunks: 1
Fuzzy hashes in storage "local": 0
Fuzzy hashes in storage "rspamd.com": 1943393204
Fuzzy hashes stored: 1943393204
Statfile: BAYES_SPAM type: redis; length: 0; free blocks: 0; total blocks: 0; free: 0.00%; learned: 0; users: 0; languages: 0
Statfile: BAYES_HAM type: redis; length: 0; free blocks: 0; total blocks: 0; free: 0.00%; learned: 0; users: 0; languages: 0
Total learns: 0 <<----

after manual training:

[root@ns-srv01 ~]# rspamc stat
Results for command: stat (0.003 seconds)
Messages scanned: 5507
Messages with action reject: 2230, 40.49%
Messages with action soft reject: 10, 0.18%
Messages with action rewrite subject: 0, 0.00%
Messages with action add header: 761, 13.81%
Messages with action greylist: 962, 17.46%
Messages with action no action: 1544, 28.03%
Messages treated as spam: 3001, 54.49%
Messages treated as ham: 2506, 45.50%
Messages learned: 1631
Connections count: 0
Control connections count: 2108
Pools allocated: 2196
Pools freed: 2161
Bytes allocated: 28.81MiB
Memory chunks allocated: 144
Shared chunks allocated: 17
Chunks freed: 0
Oversized chunks: 141
Fuzzy hashes in storage "local": 0
Fuzzy hashes in storage "rspamd.com": 1943430706
Fuzzy hashes stored: 1943430706
Statfile: BAYES_SPAM type: redis; length: 0; free blocks: 0; total blocks: 0; free: 0.00%; learned: 1379; users: 1; languages: 0
Statfile: BAYES_HAM type: redis; length: 0; free blocks: 0; total blocks: 0; free: 0.00%; learned: 0; users: 0; languages: 0
Total learns: 1379.   <<----

2 Likes

how did you train it, would you like to add something in the wiki please ?

1 Like

yes I can: Rspam filter stats have reset

Where is the best place for me to do this? …new article? …expand an existing one?

2 Likes

in the useful command like you found the tip to reset it, a real howto needs a place but tiny command needs a tiny place.

But you can do it like you want, do a new place and drop a link in the useful command, same for me

@stephdl done: https://wiki.nethserver.org/doku.php?id=userguide:manual_training_of_the_bayes_filter_rspamd#manual_training_of_the_bayes_filter_rspamd

please review the how to.

Sincerely, Marko

3 Likes

really good work, I added a line in the useful command

3 Likes

Great userguide, worked like a charm :+1:

2 Likes