Fix Wordpress Redis Docker/Kubernetes: "ERR unknown command 'FLUSHDB'"

Reading time: 1 min

If you use for example redis bitnami helm chart with Replication, FLUSHDB is not possible. To fix this you can make follow this guide.

Adjust your wp-config.php in this style:

define('WP_REDIS_CLIENT', 'phpredis'); define('WP_REDIS_HOST', 'redis'); define('WP_REDIS_PORT', 6379); define('WP_REDIS_PASSWORD', getenv_docker('REDIS_PASSWORD', 'not_defined')); define('WP_REDIS_PREFIX', 'wordpress:');

\

And then enter the cli-container and execute

Terminal window
wp config set WP_CACHE true --raw --allow-root wp eval "copy(WP_CONTENT_DIR . '/plugins/redis-cache/includes/object-cache.php', WP_CONTENT_DIR . '/object-cache.php');" --allow-root wp redis status --allow-root

\