Group flush not working on AWS Elasticache Serverless
-
Hi there,
I recently migrated our Redis instance to AWS Elasticache Serverless and noticed that
wp_cache_flush_group
no longer works. It’s not a huge issue as we put excluded the group in question from persistent storage and it suits our needs for now, but I wanted to flag this as a potential issue.If there is any Redis CLI command or script you would like me to run to help troubleshoot, please let me know.
Cheers!
Alex
-
Are you seeing an error when you’re running
wp_cache_flush_group()
?@julieadrienne it just returns
false
. Here are our cache settings in wp-config.php:define('WP_REDIS_SCHEME', 'tls'); define('WP_REDIS_HOST', 'AWS_ENDPOINT_REDACTED'); define('WP_REDIS_PORT', 6379); define('WP_REDIS_DISABLE_BANNERS', true); define('WP_REDIS_IGNORED_GROUPS', ['groups']); // this is the group that we're looking to flush separately
Let me know if I need to enable any debugging option to get more verbose output.
Are those all the
WP_REDIS_*
constants you’re setting, or are there any others?Does your AWS instance have
cluster mode
enabled or disabled?That’s all the constants we’re setting, everything else is as is.
Elasticache Serverless is cluster mode enabled by default I believe. There is no option in the admin panel. From the announcement the client has to support cluster mode but they don’t provide a configuration endpoint.
Can you dump
redis-cli INFO CLUSTER
in here to see what sort of cluster AWS Elasticache Serverless is using?Here you go, with a couple extra commands. Let me know if you need anything else.
INFO
:# Server redis_version:7.1 redis_mode:cluster arch_bits:64 run_id:0 # Replication role:master connected_slaves:1 slave0:ip=REDACTED,port=6380,state=online,offset=0,lag=0 # Cluster cluster_enabled:1
INFO CLUSTER
:# Cluster cluster_enabled:1
CLUSTER INFO
:cluster_state:ok cluster_slots_assigned:16384 cluster_slots_ok:16384 cluster_slots_pfail:0 cluster_slots_fail:0 cluster_known_nodes:2 cluster_size:1 cluster_current_epoch:0 cluster_my_epoch:0 cluster_stats_messages_sent:0 cluster_stats_messages_received:0 total_cluster_links_buffer_limit_exceeded:0
Great. You’re using a native Redis Cluster, that means you cannot use the
WP_REDIS_HOST
configuration, you must use:define( 'WP_REDIS_CLIENT', 'phpredis' ); define( 'WP_REDIS_CLUSTER', [ 'tcp://127.0.0.1:6379?alias=node-01', 'tcp://127.0.0.2:6379?alias=node-02', 'tcp://127.0.0.3:6379?alias=node-03', ] );
Hi @julieadrienne,
I did give that a try but I’m getting this error:
Couldn't map cluster keyspace using any provided seed
CLUSTER SHARDS
returns the following:1) 1) slots 2) 1) (integer) 0 2) (integer) 16383 3) nodes 4) 1) 1) id 2) 391fe7f8456c55dd9da927432439baa600000000 3) ip 4) 127.0.0.1 5) endpoint 6) REDACTED 7) hostname 8) REDACTED 9) role 10) master 11) replication-offset 12) 0 13) health 14) online 15) tls-port 16) 6379 2) 1) id 2) a3745ba00b485da78396197c0cf99a5400000000 3) ip 4) 127.0.0.1 5) endpoint 6) REDACTED 7) hostname 8) REDACTED 9) role 10) replica 11) replication-offset 12) 0 13) health 14) online 15) tls-port 16) 6380
I tried both endpoints in both TLS and TCP mode and get the same error every time.
Appreciate your help!
What does your config look like now?
I tried the following configs, all preceded with the
phpredis
line, unsuccessfully:define( 'WP_REDIS_CLUSTER', [ 'tcp://FIRST_ENDPOINT:6379?alias=node-01', 'tcp://SECOND_ENDPOINT:6380?alias=node-02', ] ); define( 'WP_REDIS_CLUSTER', [ 'tls://FIRST_ENDPOINT:6379?alias=node-01', 'tls://SECOND_ENDPOINT:6380?alias=node-02', ] ); define( 'WP_REDIS_CLUSTER', [ 'tcp://FIRST_ENDPOINT:6379?alias=node-01', ] ); define( 'WP_REDIS_CLUSTER', [ 'tls://FIRST_ENDPOINT:6379?alias=node-01', ] ); define( 'WP_REDIS_CLUSTER', [ 'tcp://SECOND_ENDPOINT:6380?alias=node-01', ] ); define( 'WP_REDIS_CLUSTER', [ 'tls://SECOND_ENDPOINT:6380?alias=node-01', ] );
I’ll note that we’ve been running the non-cluster config (I added it a couple comments above) with no issues apart from the group flush specifically.
-
This reply was modified 1 year, 5 months ago by
alexl75.
Please post the full configuration you’re using and the error message you’re seeing with that configuration.
With this configuration, everything works except group flush:
define('WP_REDIS_CLIENT', 'phpredis'); define('WP_REDIS_SCHEME', 'tls'); define('WP_REDIS_HOST', 'AWS_ENDPOINT_REDACTED'); define('WP_REDIS_PORT', 6379); define('WP_REDIS_DISABLE_BANNERS', true); define('WP_REDIS_IGNORED_GROUPS', ['groups']); // this is the group that we're looking to flush separately
With this configuration, I get the following error on every page load:
Couldn't map cluster keyspace using any provided seed
define('WP_REDIS_CLIENT', 'phpredis'); define('WP_REDIS_CLUSTER', [ 'tls://AWS_ENDPOINT_REDACTED:6379?alias=node-01', ]); define('WP_REDIS_DISABLE_BANNERS', true);
Try removing the
WP_REDIS_SCHEME
andWP_REDIS_HOST
andWP_REDIS_PORT
.You only need the
WP_REDIS_CLUSTER
.I did try the 2 configurations I indicated as their own, separately with no other variables.
With
WP_REDIS_HOST
everything works fine except group flush.With
WP_REDIS_CLUSTER
I get this errorCouldn't map cluster keyspace using any provided seed
on every page load.If your Redis cluster shows
cluster_enabled:1
, then you MUST useWP_REDIS_CLUSTER
.Using
WP_REDIS_HOST
with a native Redis Cluster doesn’t work. -
This reply was modified 1 year, 5 months ago by
- The topic ‘Group flush not working on AWS Elasticache Serverless’ is closed to new replies.