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.
Installs the packages, enables & starts the service and checks working via port.
yum -y install redis php-redis
systemctl enable redis --now
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.
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
Edit the Nextcloud PHP configuration file (change path as required) and restart all the services. After doing this, the warning message should go away.
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’,