Hi All, this document shows you how to allocate maximum memory for the Redis server.

Redis is a “source-available” in-memory data structure project implementing a distributed, in-memory key-value database with optional durability. Redis supports different kinds of abstract data structures, such as strings, lists, maps, sets, sorted sets, hyperloglogs, bitmaps, streams, and spatial indexes


* Redis installed Server, if not check this link to achieve.


Memory can be allocated using 2 different methods, one is from redis-cli and another one from the configuration file.

Method 1:

Step 1: Login to the Redis server, and enter the redis cli using the below command,


Step 2: Once you are in redis cli enter the below command to check the current maximum memory allocated to redis service.> config get maxmemory
1) "maxmemory"
2) "0"> 

Step 3: Now you can see the maximum memory allocated to the Redis server is 0MB, so let’s increase the memory. In order to increase the maximum memory enter the following command in Redis cli.

config set maxmemory 100MB

Now you can see 100mb of memory is allocated to your service.> config set maxmemory 100MB
OK> config get maxmemory
1) "maxmemory"
2) "104857600">

Method 2:
In method 2, allocation of memory is done through the configuration file redis.conf

Step 1: Edit/ADD the below entry with required size to allocate memory for Redis server.

vi /etc/redis/redis.conf

maxmemory 100MB

Step 2: Once you added the memory in the configuration file, its required to restart the service of Redis server. Execute the below command to perform this.

service redis restart

Step 3: Now login to Redis cli and check the memory allocated.

redis-cli> config get maxmemory
1) "maxmemory"
2) "104857600"

© 2019, Techrunnr. All rights reserved.

Questions Answered
Articles Written
Overall Points
Categories: databaseLinux

Prabhin Prabharkaran

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!

Leave a Reply

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.