That sounds like you’re using a real Redis Cluster (cluster_enabled
).
The WP_REDIS_HOST
won’t work, because Redis Object Cache needs to know all primary cluster nodes. Instead use:
define( 'WP_REDIS_CLUSTER', [
'tcp://127.0.0.1:6379?alias=primary-01',
'tcp://127.0.0.2:6379?alias=primary-02',
'tcp://127.0.0.3:6379?alias=primary-03',
] );
Whether you have multiple or a single primary node, you must use the WP_REDIS_CLUSTER
configuration, instead of WP_REDIS_HOST
.
Hi @tillkruess
thank you very much for your fast response. I’m aware of that this is no standard and we’re grateful for that.
Well actually we tried this as well. None of the configurations we tried is working. Once switching to WP_REDIS_CLUSTER
, we’re getting as error:
epoll_wait() reported that client prematurely closed connection, so upstream connection is closed too while reading upstream
We need to connect via tls, with user and password. Logging in into each of our nodes from the WordPress container via redis-cli
works fine:
redis-cli -h xxx-0001-001.xxx.xxx.memorydb.sa-east-1.amazonaws.com --user $REDIS_USER --pass $REDIS_PASSWORD --tls
As said, the connection via WP_REDIS_HOST
with the following URL once worked (so I can assume that in general all the required data arrives at the php code:
clustercfg.xxx.xxx.memorydb.sa-east-1.amazonaws.com
So I’m wondering why this leads to a connection close:
define( 'WP_REDIS_CLUSTER', [
'tcp://xxx-0001-001.xxx.xxx.memorydb.sa-east-1.amazonaws.com:6379',
'tcp://xxx-0001-002.xxx.xxx.memorydb.sa-east-1.amazonaws.com:6379',
'tcp://xxx-0002-001.xxx.xxx.memorydb.sa-east-1.amazonaws.com:6379',
'tcp://xxx-0002-002.xxx.xxx.memorydb.sa-east-1.amazonaws.com:6379',
] );
Also tried the protocols redis
, rediss
and tls
.
Any idea how to continue from here?
Of course the epoll_wait
error is comming from nginx. The fpm
does simply time out.
To exclude the option that the epoll_wait
timeout is due to missing memory or cpu, we removed the container limits temporarily for the container. Also we raised the fpm
pm
values:
pm.max_children = 25
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 10
pm.max_requests = 500
Should be sufficient enough…
-
This reply was modified 1 year, 7 months ago by
shvayapin.
I’d suggest making a redis.php
file on your EC2 instance and trying to connect manually via PhpRedis, once you figured out which configuration allow you to connect to your Elasticache Cluster, then I can tell you which WP_REDIS_*
constants to use.
Using WP_REDIS_HOST
will not work, because MOVED
responses aren’t handled.
You may also try using Predis, maybe that works better?
You can bypass the Nginx issues by using php
CLI first.
I know that people use Elasticache Clusters with Redis Object Cache, these forums may have some code snippets.