Precautions for using Redis in OneInStack

0dbb4980acb58d4396e9a2055bf2176e.png

When using OneInStack, there are some things to pay attention to, otherwise it may cause problems with your Redis during use.

1. Redis default configuration memory is 122 MB

The default memory configuration of Redis in OneInStack is relatively small, only 122MB, which is definitely not enough for some large-scale applications. Therefore, in actual use, it is better to modify it to a larger value.

Configuration file path: /usr/local/redis/etc/redis.conf

The item that needs to be modified is 122000000 maxmemory 122000000 Modifying 256000000 to 256000000 can set the memory used by Redis to 256 MB, thereby expanding the overall available memory size and handling large databases with ease.

2. The eviction mechanism of Redis is noeviction

The default eviction mechanism of Redis in OneInStack is noeviction , that is, no eviction is performed when the memory is full, an error is reported in the write cache, and the read cache is not affected.

This is the right thing to do when using Redis as a database. However, for caching scenarios, the eviction mechanism needs to be modified. For example, the eviction mechanism can be modified to allkeys-lru , that is, the least recently used key is eliminated from all keys.

Add a line of configuration to the configuration file ( /usr/local/redis/etc/redis.conf )

 maxmemory-policy allkeys-lru

This article is reprinted from: https://www.ixiqin.com/2022/05/11/oneinstack-redis-considerations/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment