How to know if redis is being used?

Hello all,

Thanks to the great help of the Nextcloud community in different places, I managed to migrate my instance from a ‘native’ install on a 36 bit Raspberry Pi OS to a docker install on a 64 bit OS.

I included this in my docker-compose.yml:

  redis:
    image: redis:alpine
    restart: always

  app:
...
    environment:
      - REDIS_HOST=redis

Does it matter then whether I specify Redis also the below or not?

  'memcache.local' => '\\OC\\Memcache\\APCu',
  'redis' => 
  array (
    'host' => 'redis',
    'port' => '6379',
  ),

As per this video I used docker compose exec -it redis sh -c "redis-cli monitor" and found that Redis is receiving traffic when I refresh my page :+1:

I don’t notice a difference in page loading speed really (not sure if that’s expected), so I’m wondering: how can I know whether NC is actually using Redis; that the docker container serves its purpose? Is the fact that the Redis server is receiving traffic when I refresh my NC page already indicative of good working?

Many thanks!

2 Likes

tail -f /var/log/… …/redis.log

you get this, it’s work …
you get no accept/client/keys/DB it is broken

1662310:C 22 Mar 2022 14:46:44.807 # WARNING supervised by systemd - you MUST set appropriate values for TimeoutStartSec and TimeoutStopSec in your service unit.
1662310:C 22 Mar 2022 14:46:44.807 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1662310:C 22 Mar 2022 14:46:44.807 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=1662310, just started
1662310:C 22 Mar 2022 14:46:44.807 # Configuration loaded
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 6.0.16 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1662310
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

1662310:M 22 Mar 2022 14:46:44.810 # Server initialized
1662310:M 22 Mar 2022 14:46:44.810 * Loading RDB produced by version 6.0.16
1662310:M 22 Mar 2022 14:46:44.810 * RDB age 17 seconds
1662310:M 22 Mar 2022 14:46:44.810 * RDB memory usage when created 1.26 Mb
1662310:M 22 Mar 2022 14:46:44.813 * DB loaded from disk: 0.002 seconds
1662310:M 22 Mar 2022 14:46:44.813 * Ready to accept connections
1662310:M 22 Mar 2022 14:46:44.813 - DB 0: 857 keys (151 volatile) in 1024 slots HT.
1662310:M 22 Mar 2022 14:46:48.228 - Accepted ::1:41570
1662310:M 22 Mar 2022 14:46:48.247 - Accepted ::1:41572
1662310:M 22 Mar 2022 14:46:48.274 - Client closed connection
1662310:M 22 Mar 2022 14:46:48.283 - Client closed connection
1662310:M 22 Mar 2022 14:46:49.836 - DB 0: 849 keys (143 volatile) in 1024 slots HT.
1662310:M 22 Mar 2022 14:46:54.860 - DB 0: 848 keys (142 volatile) in 1024 slots HT.
1662310:M 22 Mar 2022 14:46:58.841 - Accepted ::1:41578
1662310:M 22 Mar 2022 14:46:58.865 - Accepted ::1:41580
1662310:M 22 Mar 2022 14:46:58.866 - Client closed connection
1662310:M 22 Mar 2022 14:46:58.867 - Accepted ::1:41582
1662310:M 22 Mar 2022 14:46:58.913 - Client closed connection
1662310:M 22 Mar 2022 14:46:58.914 - Client closed connection
1662310:M 22 Mar 2022 14:46:58.988 - Accepted ::1:41586
1662310:M 22 Mar 2022 14:46:59.033 - Accepted ::1:41588
1662310:M 22 Mar 2022 14:46:59.447 - Client closed connection
1662310:M 22 Mar 2022 14:46:59.451 - Client closed connection
1662310:M 22 Mar 2022 14:46:59.880 - DB 0: 860 keys (154 volatile) in 1024 slots HT.
1662310:M 22 Mar 2022 14:47:01.758 - Accepted ::1:41592
1662310:M 22 Mar 2022 14:47:02.128 - Client closed connection
1662310:M 22 Mar 2022 14:47:03.384 - Accepted ::1:41596
1662310:M 22 Mar 2022 14:47:03.410 - Accepted ::1:41598
1662310:M 22 Mar 2022 14:47:03.412 - Client closed connection
1662310:M 22 Mar 2022 14:47:03.413 - Accepted ::1:41600
1662310:M 22 Mar 2022 14:47:03.434 - Client closed connection
1662310:M 22 Mar 2022 14:47:03.434 - Accepted ::1:41602
1662310:M 22 Mar 2022 14:47:03.489 - Accepted ::1:41606
1662310:M 22 Mar 2022 14:47:03.518 - Accepted ::1:41608
1662310:M 22 Mar 2022 14:47:03.519 - Client closed connection
1662310:M 22 Mar 2022 14:47:03.519 - Accepted ::1:41610
1662310:M 22 Mar 2022 14:47:03.537 - Client closed connection
1662310:M 22 Mar 2022 14:47:03.537 - Accepted ::1:41612
1662310:M 22 Mar 2022 14:47:03.552 - Client closed connection
1662310:M 22 Mar 2022 14:47:03.552 - Client closed connection
1662310:M 22 Mar 2022 14:47:03.559 - Client closed connection
1662310:M 22 Mar 2022 14:47:03.559 - Client closed connection
1662310:M 22 Mar 2022 14:47:03.560 - Accepted ::1:41616
1662310:M 22 Mar 2022 14:47:03.576 - Accepted ::1:41618
1662310:M 22 Mar 2022 14:47:03.586 - Client closed connection
1662310:M 22 Mar 2022 14:47:03.586 - Accepted ::1:41620
1662310:M 22 Mar 2022 14:47:03.608 - Client closed connection
1662310:M 22 Mar 2022 14:47:03.633 - Client closed connection
1662310:M 22 Mar 2022 14:47:03.666 - Accepted ::1:41624
1662310:M 22 Mar 2022 14:47:03.692 - Accepted ::1:41626
1662310:M 22 Mar 2022 14:47:03.712 - Client closed connection
1662310:M 22 Mar 2022 14:47:03.712 - Accepted ::1:41628
1662310:M 22 Mar 2022 14:47:03.731 - Client closed connection
1662310:M 22 Mar 2022 14:47:03.756 - Client closed connection
1662310:M 22 Mar 2022 14:47:04.903 - DB 0: 866 keys (160 volatile) in 1024 slots HT.
1662310:M 22 Mar 2022 14:47:05.428 - Accepted ::1:41632
1662310:M 22 Mar 2022 14:47:05.485 - Accepted ::1:41634
1662310:M 22 Mar 2022 14:47:05.509 - Client closed connection
1662310:M 22 Mar 2022 14:47:05.509 - Accepted ::1:41636
1662310:M 22 Mar 2022 14:47:05.528 - Client closed connection
1662310:M 22 Mar 2022 14:47:05.528 - Client closed connection
1662310:M 22 Mar 2022 14:47:09.932 - DB 0: 867 keys (161 volatile) in 1024 slots HT.

1 Like

Thanks for replying @stratege1401. Is what you’re saying also true for redis in a Docker container? Checking the virtual file system of the container, I seem to get an empty log folder:

pi@raspberry:/nextcloud-docker $ docker compose exec -it redis sh -c "ls /var"
cache  empty  lib    local  lock   log    mail   opt    run    spool  tmp
pi@raspberry:/nextcloud-docker $ docker compose exec -it redis sh -c "ls /var/log"
pi@raspberry:/nextcloud-docker $

sorry, my tail -f is from a barre metal server under debian 11.2

In case of snap, logs are usually under /var/snap/redis/
Under docker, the official redis docker does not log anything specific to redis unless you specifically use logging directive from the docker composer to direct logs to a specific log files…

I have to specific solution for you… https://docs.docker.com/compose/compose-file/#logging

This is why i don’t do snap/docker or stuff adding complexity to complexity…

Hello~ I have the same question~

Just exec redis-cli inside your redis container and type “redis-cli monitor” if there is output, this means that redis is indeed working.

docker exec -it redis /bin/sh
cd
redis-cli monitor
ctrl+c

Then, I found that redis is working for nextcloud, it changs a lot duing I am using the nextcloud.