Support » Plugin: Redis Object Cache » Status:Not Connected using AWS redis primary/read with replication config

  • Resolved dawn360

    (@dawn360)


    Anyone had success connecting to AWS Redis primary and read using the replication config?
    I have on AWS, Redis with 1 primary and 1 read replica (cluster mode off)
    Primary EndpointPrimary endpoint
    xx.xx.ng.0001.use1.cache.amazonaws.com:6379
    Reader EndpointReader endpoint
    xx-ro.xx.ng.0001.use1.cache.amazonaws.com:6379

    When using WP_REDIS_HOST with the Redis primary endpoint it successfully connects
    define( 'WP_REDIS_HOST', 'xx.xx.ng.0001.use1.cache.amazonaws.com' ); //WORKS!

    However, when using both primary and reader with WP_REDIS_SERVERS definition status is always “Not Connected”

    define( 'WP_REDIS_SERVERS', [
        'tcp://xx.xx.ng.0001.use1.cache.amazonaws.com:6379?database=5&alias=master',
        'tcp://xx-ro.xx.ng.0001.use1.cache.amazonaws.com:6379?database=5&alias=slave-01'
    ] ); //Not Connected

    Diagnostics shows the error
    Connection Exception: Connection refused (RedisException)

    Note: using define( 'WP_REDIS_CLIENT', 'pecl' ); //PHPREDIS 5.0.2

    any ideas on this? Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    Are you running a cluster or single node?

    It’s an AWS Cluster with (cluster mode disabled) So cluster has a single shard and 1 read replica node ATM. I want to utilize both the primary node as well as the read replica.

    guessing i should have tried the following config instead?

    define( 'WP_REDIS_CLUSTER', [
        'tcp://127.0.0.1:6379?database=15&alias=node-01',
        'tcp://127.0.0.2:6379?database=15&alias=node-02',
    ] );
    Plugin Author Till Krüss

    (@tillkruess)

    WordPress doesn’t play well with read-only caches. If your cache is down, your site is likely as well. I’d use a cluster with several nodes or use sentinel.

    However try using the master and slave aliases:

    
    define( 'WP_REDIS_SERVERS', [
        'tcp://127.0.0.1:6379?database=5&alias=master',
        'tcp://127.0.0.2:6379?database=5&alias=slave-01',
    ] );
    

    The business editor has seamless support for salve failovers.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.