Redis CONFIG SET Command

Introduction

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

  • dbfilename
  • requirepass
  • masterauth
  • cluster-announce-ip
  • unixsocket
  • logfile
  • pidfile
  • slave-announce-ip
  • maxmemory
  • proto-max-bulk-len
  • client-query-buffer-limit
  • maxmemory-samples
  • lfu-log-factor
  • lfu-decay-time
  • timeout
  • active-defrag-threshold-lower
  • active-defrag-threshold-upper
  • active-defrag-ignore-bytes
  • active-defrag-cycle-min
  • active-defrag-cycle-max
  • auto-aof-rewrite-percentage
  • auto-aof-rewrite-min-size
  • hash-max-ziplist-entries
  • hash-max-ziplist-value
  • list-max-ziplist-size
  • list-compress-depth
  • set-max-intset-entries
  • zset-max-ziplist-entries
  • zset-max-ziplist-value
  • hll-sparse-max-bytes
  • lua-time-limit
  • slowlog-log-slower-than
  • latency-monitor-threshold
  • slowlog-max-len
  • port
  • cluster-announce-port
  • cluster-announce-bus-port
  • tcp-backlog
  • databases
  • repl-ping-slave-period
  • repl-timeout
  • repl-backlog-size
  • repl-backlog-ttl
  • maxclients
  • watchdog-period
  • slave-priority
  • slave-announce-port
  • min-slaves-to-write
  • min-slaves-max-lag
  • hz
  • cluster-node-timeout
  • cluster-migration-barrier
  • cluster-slave-validity-factor
  • repl-diskless-sync-delay
  • tcp-keepalive
  • cluster-require-full-coverage
  • cluster-slave-no-failover
  • no-appendfsync-on-rewrite
  • slave-serve-stale-data
  • slave-read-only
  • stop-writes-on-bgsave-error
  • daemonize
  • rdbcompression
  • rdbchecksum
  • activerehashing
  • activedefrag
  • protected-mode
  • repl-disable-tcp-nodelay
  • repl-diskless-sync
  • aof-rewrite-incremental-fsync
  • aof-load-truncated
  • aof-use-rdb-preamble
  • lazyfree-lazy-eviction
  • lazyfree-lazy-expire
  • lazyfree-lazy-server-del
  • slave-lazy-flush
  • maxmemory-policy
  • loglevel
  • supervised
  • appendfsync
  • syslog-facility
  • appendonly
  • dir
  • save
  • client-output-buffer-limit
  • unixsocketperm
  • slaveof
  • notify-keyspace-events
  • bind

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 requirePass setting:

127.0.0.1:6379> CONFIG SET "requirePass" "password"
OK

Notice the “OK” response indicating success.

Conclusion

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 for 30 Days

It's easy to get started. Imagine the time you'll save by not worrying about database management. Let's do this!

PILOT FREE FOR 30 DAYS

Keep in the know!

Subscribe to our emails and we’ll let you know what’s going on at ObjectRocket. We hate spam and make it easy to unsubscribe.