×


How to modify Redis configuration on Ubuntu

With the command line, modifying the configuration of Redis is made easy. Redis serves as an in-memory data storage system used as a database or cache.
As part of our Server Support Services here at Ibmi Media, we regularly help our customers to modify Redis Configuration on their server.

Below are the steps taken to modify Redis configurations on Ubuntu Linux distribution.

Modifying Redis Configuration

Redis has a in-built command line interface which make making changes to its configuration easy. It is made possible via the redis-cli interface which enables modifying its configuration.

Redis configuration file is located at the /etc/redis/redis.conf directory of the server.

At runtime, we can use the config set to configure Redis without even restarting the service. Precaution needs to taken when making any changes in the Redis configuration so as not to disrupt the performance of the Redis Server.

To use the config set, use the syntax below;

127.0.0.1:6379> config set parameter value


For example, if you want to change the Redis database dump, use the command below;

127.0.0.1:6379> config set "db_filename" "new_file.rdb"


The output of the command will return OK if the configuration changes is correct. Otherwise you will get an error report.

Making Permanent changes to Redis Configuration

To make a permanent change to the Redis configuration, use config rewrite directives in the command. Such as in;

127.0.0.1:6379> config rewrite


This will preserve the structure of the redis.conf file configuration.

Checking the accuracy of the Redis configuration

Checking the redis configuration helps to read the current parameters of Redis server configuration with the config get command. With this command, a single argument is taken which can either be an exact match of that parameter specified in redis.conf or in a glob pattern.

For example, have a look at the following command;

127.0.0.1:6379> config get repl*


All parameters associated to repl will be returned as the output.

Need to fix Redis or change Redis configuration? We can help.


Conclusion

By means of Redis command line, changes in Redis Server configuration can be easily implemented. In summary Redis is an in-Memory data store capable of storing data.