How to check if Redis is used in NC

Please tell me how to check if Redis is used in NC.
For example, I deliberately mistakenly entered Redis’ password in Config.php, but Nextcloud will not issue an error. I am passwording Redis. Redis stand alone works fine.

‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘filelocking.enabled’ => true,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘redis’ =>
array (
‘host’ => ‘localhost’,
‘port’ => 6379,
‘password’ => ‘MYPASSWORD’,
),

2 Likes

Do you not see errors in the log?

use “redis-cli MONITOR” and then browse around on nextcloud and you should see input in redis-cli

12 Likes

Just to add to this, I am using redis with a socket.
my config.php has the following:
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘filelocking.enabled’ => ‘true’,
‘redis’ =>
array (
‘host’ => ‘/var/run/redis/redis.sock’,
‘port’ => 0,
‘timeout’ => 0.0,
),

So my test command was “redis-cli -s /var/run/redis/redis.sock MONITOR”

Hi:

I have configured Nextcloud 15.0.7 under PHP 7.2 to use Redis via socket adding these lines to config.php

‘filelocking.enabled’ => ‘true’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘redis’ => [ ‘host’ => ‘/var/run/redis/redis.sock’, ‘port’ => 0, ‘timeout’ => 0.0, ],

I have setup redis to use socket setting in /etc/redis/redis.conf

port 0
unixsocket /var/run/redis/redis.sock
unixsocketperm 770

however when execute redis-cli:

sudo -u redis redis-cli -s /var/run/redis/redis.sock monitor

Show only OK, and nothing else activity while browsing or copy files in Nextcloud.

There are not any log error message in Apache logs or nextcloud logs.

How to check Nextcloud is actually using redis?

After the OK, you should get a stream of data flowing on your console if redis is being used. But not every page on NC uses redis. Browsing through “files” got me nothing. However, digging into “gallery” shows a lot of use.

Unfortunatelly neither browsing files or browsing gallery in Nextcloud show me anything in redis-cli after OK.
I have tested to change the redis configuration to use tcp instead of socket (with the consequent change in nextcloud config) and the result is the same.

I don’t know how to debug redis use in nextcloud.
There are some config directive to do that?

Finally found the problem: In Php 7.3 is missing the redis module.
This can check easily in phpinfo().
Now i must know how to setup redis php module in php 7.3 using Sury’s repositories. :thinking:

Problem solved
To use php-redis from Sury repositories:

apt-get install php-redis -t stretch

Then

phpenmod redis
systemctl restart php7.3-fpm

And set the permissiones in redis.sock to 770

chmod 770 /var/run/redis/redis.sock

Now redis is working with nextcloud and can check it using redis-cli

redis-cli -s /var/run/redis/redis.sock monitor

2 Likes

@Guillermo – Why this exotic approach?

IMHO one should consider to prefer the official packages:

Maybe I missed some details but would prefer a more clear understanding.
:nerd_face:

Just curious.
:innocent:

Furthermore:

:lab_coat:

Happy hacking.
:sunflower:

IMHO one should consider to prefer the official packages:

https://packages.debian.org/buster/redis-server
https://packages.debian.org/buster/php-redis

Thanks a lot for the suggestion
But i’m using Debian LTS and Debian Stretch and the latest php version supported in stretch is 7.0.
I use Sury repositories to get the latest php version and latest php modules without worrying about that debian version i’m using.

I see. This is a free world and many endeavours …

Good luck.
:four_leaf_clover:

I only see lines with “SELECT” “0” coming over the console like:

1573977323.034287 [0 unix:/var/run/redis/redis-server.sock] “SELECT” “0”
1573977328.028506 [0 unix:/var/run/redis/redis-server.sock] “SELECT” “0”
1573977332.732083 [0 unix:/var/run/redis/redis-server.sock] “SELECT” “0”
1573977333.041170 [0 unix:/var/run/redis/redis-server.sock] “SELECT” “0”
1573977335.435345 [0 unix:/var/run/redis/redis-server.sock] “SELECT” “0”
1573977338.034784 [0 unix:/var/run/redis/redis-server.sock] “SELECT” “0”
1573977343.032001 [0 unix:/var/run/redis/redis-server.sock] “SELECT” “0”
1573977348.035607 [0 unix:/var/run/redis/redis-server.sock] “SELECT” “0”
1573977353.038618 [0 unix:/var/run/redis/redis-server.sock] “SELECT” “0”

No matter what i or other users browse or do in the cloud.

Is that the correct behaviour?

Have a look at

or similar articles and/or thw documentation, I presume.
:nerd_face:

Furthermore, a word of advice for NC in general:

IMHO one should make a difference between either trustworthy production systems and more reliable home systems or the more free experimental endeavours on feature loaden hack systems and hobby machines.

Stay sober, stay safe, keep your data secure.
:safety_vest:

Happy hacking.
:sunflower:

… that was not the answer to my question, nevertheless, thank you for your answer!

My redis-server is working, the file permissions are correct, when i change them to an other user for example, i get Internal Server Error with ““Message”:“RedisException: Permission denied”” in Nextcloud Logfile.
Furthermore i see a bunch of activity while browsing but only of the variety “SELECT” “0” .

Resuming my question: Is that the normal expected behaviour?
Could you send me some lines of your ‘redis-cli monitor’ output for me to know what i should expect?

Thanks in advance

Please think first, act second only and always have the protection of your data in mind.
:innocent:


This is the home user forum and although you may ask freely and virtually anything, it may depend what you get answered for free. Any enterprise should ref. to Nextcloud GmbH as there shall be professional support available:

  1. Customers and Partners (mainly) closed portal — https://portal.nextcloud.com/
  2. An Enterprise Subscription from Nextcloud is available with email and phone support.

Furthermore, one could consult the Nextcloud Community Guidelines

NOTE: Please be aware I am not affiliated with Nextcloud GmbH and my views are the free views as both a volunteer and a EU citizen and appear in a private capacity solely.


Good to learn you seem to be on the safe bank already.
:safety_vest:

Please be aware my contributions usually aim at the public domain and may not address your specific concern while intentionally taking into account to fail to meet your personal expectations, unfortunately.
:nerd_face:

BTW a kind gesture like problem solved (i.e. :white_check_mark:) or a little ACK to one or more of my comments (i.e. click on the heart icon :heart:) would show you are satisfied. This could be a kind gesture and would motivate me like authors of other advice to continue in lending a hand freely…
:smiley:

Happy hacking.
:sunflower:

Hi @TP75, thanks a lot for you preconfigured textblock answers :wink:

Here is the solution :white_check_mark: i just found out myself by REreading the config.sample.php:

my old values where:

  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0,
    'dbindex' => 0,
  ),

where the
'dbindex' => 0,
is optional, if undefined SELECT will not run and will use Redis Server’s default DB Index.

Removing that line, makes the “SELECT” “0” remove.

As you can see, i have had configured my server to only do memcache.locking by redis, since i have everything running on one host.

After changing the config to

  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0,
//    'dbindex' => 0,
  ),

i get a much more verbose output.

Sometimes the simplest solution is usually the most obvious, and you still can not get it right away :wink:

3 Likes

You are most welcome. Good that you took the effort to reconsider your approach and nicely learned the repair as a home user training on the job in this short time, apparently.
:smiley:

Learning is reading. The NC community and specifically the NC devs took quite an effort to produce the available set of documentation. Unfortunately, many users just grab this forum and the community while completely ignoring the most basic facts and online NC docs, apparently.
:nerd_face:

This is no complaint, just a more general observation.
:innocent:

@ernolf This was quite intentionally. There are just too many requests ignoring the most basic facts around and I as a poor volunteer like many more others cannot address every-bodies likings, I presume.

Good that you found some “preconfigured textblock answers” a.k.a. the online NC documentation by your own observation and efforts, apparently. Stay pragmatic and improve.
:+1:

Please find a virtual sign of my sympathy as some tag to your last contrib included.
:smiley:

Happy hacking.
:sunflower:

1 Like