Symptoms:
When a Redis for VMware Tanzu Application Service instance fails to persist to disk, it could happen in two different ways:
When upgrading Redis, the upgrade fails because the installation process is unable to stop Redis.
- Any other operation (Except a read error) returns a MISCONF error. Depending on the implementation, this might stop any bound apps from working correctly.
Error message:
MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.
This problem occurs when Redis has used up all of the available disk space. There are two ways that Redis persists to disk:
In circumstances where Redis experiences a high rate of data modifications, the appendonly.aof file might occupy too much space, causing any further persistence attempts to fail.
First, verify that you can write data to the persistent disk. If there is an event such as a storage outage, it may be the case that the disk has entered read only mode to prevent data corruption. To test this, you can try the following:
In this scenario, you may be able to resolve simply by running a bosh recreate of the VM. This should create a new VM and reattach the disk, which should put it back to a read/write state.
If this disk itself is writable but you still face the error, your persistent disk may be full. To check this:
Case 1: Where potential data loss and downtime are not an issue
The resolution, in this case, involves forcefully stopping Redis, releasing the space, and restarting Redis.
The steps are:
You may wish to also remove /var/vcap/store/redis/dump.rdb. Please do this with extreme caution. Deleting this file means that when Redis starts up again, it will have no data whatsoever.
Once running, you can restore the data from a previously created snapshot. Please see our restore documentation.
Case 2: Data loss or downtime is unacceptable
The resolution in this case involves temporarily pointing Redis to a new location, releasing the space in the original location, and re-pointing Redis to the original persistent location. Redis remains online the whole time.
Redis password |
cat /var/vcap/store/redis/redis.conf | grep requirepass |
Config command alias |
cat /var/vcap/stored/redis/redis.conf | grep "CONFIG" |
The current location where Redis persists files, original- location |
/var/vcap/packages/redis/bin/redis-cli -a {password} <config-command-alias> GET dir |
10. Set the location for Redis to persist files to the newly mounted disk: /var/vcap/packages/redis/bin/redis-cli -a {password} {config-command-alias} SET dir {mount-dir}
11. Perform a successful persist to disk:
/var/vcap/packages/redis/bin/redis-cli -a {password} save /var/vcap/packages/redis/bin/redis-cli -a {password} bgrewriteaof
12. Run:
watch '/var/vcap/packages/redis/bin/redis-cli -a {password} INFO | grep aof_rewrite_in_progress'
Until it displays 'aof_rewrite_in_progress:0'"
13. Clean up original_location:
rm {original-location}/appendonly.aof rm {original-location}/dump.rdb
14. Redeploy the Redis Tile with the disk/memory ratios described above.
15. Set the location for Redis persistence back to the original one:
/var/vcap/packages/redis/bin/redis-cli -a {password} {config-command-alias} SET dir {original-location}
16. Perform a successful persist:
/var/vcap/packages/redis/bin/redis-cli -a {password} save /var/vcap/packages/redis/bin/redis-cli -a {password} bgrewriteaof
17.Run:
watch '/var/vcap/packages/redis/bin/redis-cli -a {password} INFO | grep aof_rewrite_in_progress'
Until it displays 'aof_rewrite_in_progress:0'"
18. Unmount, detach and delete LARGE_DISK.
19. This should have been done in step 14. If you haven't yet, modify Resource Config in the Redis tile to a persistent disk of at least 3.5 times the size of the allocated RAM for the Dedicated Node, as described in the docs here