Support » Plugin: Redis Object Cache » Master-Slave Config ‘Not-Connected’

  • Resolved connorja

    (@connorja)


    Hi,
    I’m using a Master-Slave configuration but I’m not able to get the plugin to connect.
    When I define the WP_REMOTE_HOST per server individually, to either the master or slave it works. However, not when I define them in master-slave config as mentioned in the documentation.

    The table shows Master & Slave in the server list however it says no password for each server.

    The diagnostics shows:

    Status: Not Connected
    Client: PhpRedis (v4.3.0)
    Drop-in: Valid
    Connection Exception: Connection refused (RedisException)
    Redis Extension: 4.3.0
    Predis Client: 1.1.1
    PHP Version: 7.2.19

    Connection refused. Which tells me that the define password isn’t working. It does for single host however.

    wp-config.php has the following:

    define( 'WP_REDIS_SERVERS', [
            'tcp://1.1.1.1:6379?database=0&alias=master',
            'tcp://1.2.1.1:6379?database=0&alias=slave',
            ] );
    define( 'WP_REDIS_PASSWORD','password123');
    define('WP_CACHE', true);

    How do I define a password for both master and slave? The password is the same for password and slave so I’ve assumed a single declaration will work?
    Thank you in advance Till!

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

    (@tillkruess)

    Hey!

    First of all define('WP_CACHE', true); is not related to this plugin, that’s a page cache, not object cache.

    The WP_REDIS_PASSWORD should work as long as you’re seeing both servers in the server list and the constants are defined right after another. Are you seeing the masked password in the diagnostics?

    Connection refused sounds like a TCP connection error to me, I’d use local IPs like 10.0.0.0 or 192.168.0.0 for your Redis servers, since 1.1.1.1 is an actual IP address (Cloudflare’s DNS service) and that’s probably why it’s failing to connect.

    connorja

    (@connorja)

    Hi Till,
    Sorry I should of highlighted that 1.1.1.1 isn’t the IP address I placed in the config and it was the private IPs of the servers – not entirely sure why I hid an IP that you can’t reach ha.

    So the diagnostics does show a masked password but the server list table shows No password.

    Thanks

    Plugin Author Till Krüss

    (@tillkruess)

    Ah, that’s actually a bug 🙂

    I just fixed that on GitHub, thanks!

    However, it won’t affect the actual connection, since the password is added to clusters and such: https://github.com/tillkruss/redis-cache/blob/master/includes/object-cache.php#L500-L504

    My guess would be VPN issues. Make sure you can actually connect from your WordPress machine to your Redis cluster.

    You can just test it by SSHing into your WP machine and then pining “1.1.1.1” using the redis-cli.

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