Having battled with this for several hours, Iâm documenting this for posterity. My clientâs Nextcloud was already configuring using APUc for local caching but since the last upgrade, you get the following warning:
The database is used for transactional file locking. To enhance performance, please configure memcache, if available
These are the steps I followed to get redis caching working on a standalone Nextcloud server. Assumes youâre running as sudo. If not, youâll need sudo prefixes here and there.
Install redis and PHP module
Installs the packages, enables & starts the service and checks working via port.
yum -y install redis php-redis
systemctl enable redis --now
redis-cli ping
Change to using a socket
By default, redis binds to a TCP port. This change is recommended for standalone servers and changes it to use a socket. You edit the file, restart the service and check itâs working.
nano /etc/redis.conf
systemctl restart redis
redis-cli -s â/var/run/redis/redis.sockâ ping
The following changes are made to redis.conf:
- Comment out bind 127.0.0.0 line
- Change port to 0
- Uncomment unixsocket /var/run/redis/redis.sock
- Uncomment unixsocketperm 777
Reconfigure Nextcloud to use redis
Edit the Nextcloud PHP configuration file (change path as required) and restart all the services. After doing this, the warning message should go away.
nano /data/nextcloud/config/config.php
systemctl restart nginx php-fpm redis
Add the following variables to config.php:
âredisâ => [
  âhostâ => â/var/run/redis/redis.sockâ,
  âportâ => 0,
  âtimeoutâ => 0.0,
],
âmemcache.lockingâ => â\OC\Memcache\Redisâ,