Home // How to install Redis for Nextcloud

How to install Redis for Nextcloud

0 comment 3 mins read

Redis, which stands for Remote Dictionary Server, is a fast, key-value data store that works in memory and is free to use. Salvatore Sanfilippo, who made Redis in the first place, started the project because he wanted to make his Italian startup more scalable. From there, he made Redis, which is now used as a database, cache, message broker, and queue.

Redis has response times of less than one millisecond, which lets it handle millions of requests per second for real-time applications in fields like gaming, ad-tech, financial services, healthcare, and the Internet of Things (IoT). Today, Redis is one of the most popular open source engines. For the past five years in a row, Stack Overflow has named it the “Most Loved” database. Redis is often used in caching, session management, gaming, leaderboards, real-time analytics, geospatial, ride-hailing, chat/messaging, media streaming, and pub/sub apps because it works quickly.

Most major Linux distributions provide packages for Redis.

Ubuntu/Debian

If you’re running a very minimal distribution (such as a Docker container) you may need to install lsb-release first:

sudo apt install lsb-release
  • Machine Used – LXC Container running Ubuntu 20.04

Step 1 – Install Redis

Redis-Server

Install it from the Ubuntu repository using the APT package manager. At the time of this writing, 5.0.7 may be found in the default repositories.

To get started, use sudo apt update to refresh the apt package cache on your machine.

Next, type sudo apt install redis-server to set up Redis.

Remote Access

If you’d like to connect applications that are not on the machine, we can do it this way.

sudo nano /etc/redis/redis.conf

Change bind 127.0.0.1 to bind 0.0.0.0 . Save and exit and then run:

sudo service redis-server restart

PHP-Redis

You’ll need to install the redis php module on the nextcloud server as well:

You Might Be Interested In
sudo apt install php-redis

Step 2 — Testing Redis-Server

Prior to making any more changes to Redis’ setup, it’s a good idea to verify that it’s working as intended, as you would with any freshly installed program. We will go through two techniques to confirm that Redis is operating appropriately in this stage.

Start by confirming that the Redis service is operating

sudo systemctl status redis

If it is running without any errors, this command will produce output similar to the following:

Connect to the server using redis-cli, the command-line client for Redis, to verify that it is operating properly:

redis-cli

Should be more than enough for testing its connectivity. You also confirmed that the machine

Step 3 – Connect it to Nextcloud

Local Redis

At this point we know Redis is functional and ready to be implement into our Nextcloud instance. Head to your Nextcloud config folder, edit the config.php and add these lines:

'memcache.local' => '\\OC\\Memcache\\Redis',
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'filelocking.enabled' => 'true',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => 'localhost',
'port' => 6379,
'timeout' => 0.0,
),

Remote Redis server

If you want to use a remote redis server you need to set the ip or FQDN of the Redis machine in the ‘host’ parameter:

'memcache.local' => '\\OC\\Memcache\\Redis',
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'filelocking.enabled' => 'true',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => 'CHANGEME',
'port' => 6379,
'timeout' => 0.0,
),

Conclusion

That’s it, your Nextcloud instance should automatically start using redis for memory caching and help prevent deadlocks.

You Might Be Interested In

Find out more about redis

Leave a Comment

Copyright @2022-2023 All Right Reserved – PCPlanet

Adblock Detected

The only intrusive ad here is the google vignette, help support me by disabling your adblocker.