Redis CONFIG SET Command
In this article we’ll take a look at the CONFIG GET’s companion, CONFIG SET. We’ll look at the command’s basic syntax and give you a reference for all the configuration settings that are available. Without further ado, let’s jump in.
What does the CONFIG SET command do?
The CONFIG SET command lets you set a configuration parameter for your Redis server. The great thing about this command is that the server is reconfigured at run time without any need to restart! Small tweaks or big changes like switching persistence options both happen immediately with no need for restart.
The CONFIG SET syntax
It takes in two parameters, the name of the configuration option and the value that you’d like to set it to:
CONFIG SET config-option-name "value"
What configuration options are there?
You can find all the configuration option names several ways.
1. Use the
CONFIG GET * command which will retrieve all the settings and their current values.
2. Consult the Redis documentaion.
3. Consult the redis.conf file.
3. Here is a convenient list of the configuration settings available in Redis 2.6
How do I know if the command worked?
The CONFIG SET command will return the “OK” string to indicate success and show you an error otherwise.
We’ll show a quick demo of changing the
127.0.0.1:6379> CONFIG SET "requirePass" "password"
Notice the “OK” response indicating success.
Get intimately familiar with the configuration settings if you plan on using Redis in production. This command is simple and the syntax is simple but the ramifications of a single configuration setting change can be huge. If you want your data in the hands of a company you trust, please reach out to us at Object Rocket. We can assess what you need and take the load of managing your database technology.
Pilot the ObjectRocket Platform Free!
Try Fully-Managed CockroachDB, Elasticsearch, MongoDB, PostgreSQL (Beta) or Redis.Get Started