How to set and get REDIS maximum memory size in Ubuntu?
Dung Do Tien
Mar 08 2021
334
I have a small VPS server install Ubuntu 18. I Installed Redis and deploy the website on that server. I don't know default what's default maximum RAM for Redis. And now I want to limit it to 400MB.
How can I get the current config maximum RAM for Redis and set it to 400MB?
Thanks for any suggestions.
Have 1 answer(s) found.
-
B4
Blue Jame Mar 08 2021
To check the max size memory configure for Redis you have to access inside Redis server by command
redis-cli
1. To get the current max memory size, you can use the command below:
config get maxmemory
Output :
127.0.0.1:6379> config get maxmemory 1) "maxmemory" 2) "1000000000" 127.0.0.1:6379>
2. To set max memory size for Redis. For example, set to 400MB using the command below:
config set maxmemory 400M
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.