Configuring Memory-Based Locking in OwnCloud
Configuring Memory-Based Locking in OwnCloud
Goal:
Switch OwnCloud’s transactional file locking from the slow database-based method to
memory-based locking using Redis.
1. Install Redis Server
————————
On Ubuntu/Debian:
sudo apt update
sudo apt install redis-server php-redis
Ensure Redis is running:
sudo systemctl enable redis-server
sudo systemctl start redis-server
2. Enable Redis in PHP
————————
Check if Redis is enabled:
php -m | grep redis
If not:
sudo apt install php-redis
sudo systemctl restart apache2 # or php-fpm
3. Configure config.php for Redis Locking
——————————————
Edit /var/www/owncloud/config/config.php
Add or modify:
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘redis’ => [
‘host’ => ‘localhost’,
‘port’ => 6379,
// ‘password’ => ‘your_redis_password’,
‘timeout’ => 0.0,
‘dbindex’ => 0,
],
Optionally add for local cache:
‘memcache.local’ => ‘\OC\Memcache\APCu’,
4. Set Proper Redis Permissions
———————————
Ensure web server user (e.g., www-data) can access Redis.
5. Verify it’s Working
————————
Check owncloud.log:
tail -f /var/www/owncloud/data/owncloud.log
Monitor Redis:
redis-cli monitor
Checklist:
– Redis is installed and running
– php-redis extension is enabled
– config.php is configured for Redis
– OwnCloud logs show no errors





