Modifying Max Memory and its policy in Redis Config

First of all, log in to your server with SSH (root). Once you've logged into the server, open the Terminal. Now, run the following command to copy the existing Redis config file for backup purposes:

cp /etc/redis/redis.conf /etc/redis/redis.conf_bak

Now, modify /etc/redis/redis.conf file with nano editor or using SFTP:

nano /etc/redis/redis.conf

Set the following values:

maxmemory 256mb
maxmemory-policy allkeys-lfu

If you already have uncommented values starting with # at the Redis config, edit the value without adding them manually to the config! Once the value is added. restart Redis by running the following command line:

service redis restart

Done! Make sure to replace the maxmemory value with your own, depending on the RAM of your server. For example 256mb for 4GB of RAM, and 512mb for more than 4GB of RAM.

  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to restrict direct root access in Linux

We can do it just in two steps. Step One: At first we will create new root user as follows (for...

How to extract .tar.gz files in Linux/UNIX OS

A tarball is a group of files that are bundled together using the tar command. Use the...

How to add welcome message when SSH start?

You need to change the contents of /etc/motd. Unfortunately, by default, /etc/motd is a link to...

How to change root password when SSH logged in

Run the following command: passwd Now type your new passwordOnce done, retype new passwordDone!...

How to install Pinguzo on any Linux/UNIX OS

Login to Pinguzo panel using Softaculous account or create an account of Pinguzo To add new...