IBM Cloud Docs
Changing the Redis configuration

Changing the Redis configuration

In IBM Cloud® Databases for Redis, you can change some of the Redis configuration settings to tune your databases to your use-case. In a typical Redis setting, you can change the configuration from the command line by using CONFIG SET. You can still use CONFIG SET on your deployment but the changes do NOT persist if there is a failover, node restart, or other event on your deployment. Changing the configuration with CONFIG SET can be used for testing, evaluation, and tuning purposes.

Note the following Redis configuration restrictions:

  • Redis 4: CONFIG and all subcommands are deprecated and will no longer work on or after 30 November 2021
  • Redis 5: no restrictions
  • Redis 6 (and newer): only CONFIG GET and CONFIG RESETSTAT are exposed

To make permanent changes to the database configuration, use the Cloud Databases CLI plug-in or API to write the changes to the configuration file for your deployment.

To make a change, you send a JSON object with the settings that you want to change and their new values. For example, to set the maxmemory-policy setting, you would supply the following either to the CLI or to the API.

{"configuration":{"maxmemory-policy":"allkeys-lru"}}

Using the CLI

View the configuration schema of possible settings through the Cloud Databases cli-plugin with the cdb deployment-configuration-schema command.

ibmcloud cdb deployment-configuration-schema <deployment name or CRN>

To change your configuration, use the cdb deployment-configuration command.

ibmcloud cdb deployment-configuration <deployment name or CRN> [@JSON_FILE | JSON_STRING]

The command reads the changes that you would like to make from the JSON object or a file.

Using the API

There are two deployment-configuration endpoints, one for viewing the configuration schema and one for changing the configuration. To view the configuration schema, send a GET request to /deployments/{id}/configuration/schema.

To change the configuration, send the settings that you would like to change as a JSON object in the request body of a PATCH request to /deployments/{id}/configuration.

For more information, see the API reference.

Available configuration settings

To check the current value of a setting, use CONFIG GET from a CLI client. You can check all of the settings by using CONFIG GET *.

Many of the settings are used to configure Redis as a cache. For more information, see the Configuring Redis as a Cache page.

Configuration Settings for Redis
Setting Default Notes
maxmemory 80% of your deployment's memory Determines the amount of data that you can store in Redis.
appendonly yes Enables or disables Redis persistence.
maxmemory-policy noeviction Determines eviction behavior when maxmemory limit is reached.
maxmemory-samples 5 Tunes LRU eviction algorithm when Redis is configured as a cache.
stop-writes-on-bgsave-error yes Redis stops accepting writes if it detects an unsuccessful backup snapshot.