Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter sebestyeng

    (@sebestyeng)

    Of course. Please note that this is the very first PHP code of my life and I don’t know how to use it properly, I only tested if it can read data from my redis system with one node down.

    <?php
    require 'autoload.php';
    
    Predis\Autoloader::register();
    
    $parameters = ['tcp://192.168.40.88?role=master', 'tcp://192.168.40.105'];
    $options    = ['replication' => 'predis'];
    
    $client = new Predis\Client($parameters, $options);
    $value = $client->get('teszt');
    echo $value;
    ?>
    

    “Teszt” key is set before by redis-cli set teszt 123

    I can get it nicely:
    (I also did some telnet testing to show you that one – the replica in this case – is down)

    root@SEBILAPTOP:/tmp/predis# php client-test.php
    123
    root@SEBILAPTOP:/tmp/predis# telnet 192.168.40.105 6379
    Trying 192.168.40.105...
    telnet: Unable to connect to remote host: Connection refused
    root@SEBILAPTOP:/tmp/predis# telnet 192.168.40.88 6379
    Trying 192.168.40.88...
    Connected to 192.168.40.88.
    Escape character is '^]'.
    quit
    +OK
    Connection closed by foreign host.
    

    Thread Starter sebestyeng

    (@sebestyeng)

    Thank you for your answer!

    I read the documentation as you suggested but I don’t understand your point here. Even the title topic clearly says “How Redis supports high availability and failover with replication”.

    It is clear the master should be available, but if I stop a replica why it affects the Redis Object Cache plugin’s connection to the redis system while the master is up and ready-to-go?

    In the title of this support ticket I wrote “Not Connected if any Redis node is down“. According to this I’ve created a scenario for you where the master (127.0.0.1) is alive and the replica (192.168.40.105) goes down.

    On overview tab:

    Overview
    Status:	 Not connected
    Drop-in:	 Valid
    Filesystem:	 Writeable

    On diagnostics:

    Status: Not connected
    Client: predis
    Drop-in: Valid
    Disabled: No
    Ping: 
    Connection Exception: Connection refused [tcp://192.168.40.105:6379] (Predis\Connection\ConnectionException)
    Errors: [
        "Connection refused [tcp:\/\/192.168.40.105:6379]"
    ]

    (wp-config.php is still the same)

    I know predis client can handle this because I’ve tested it with a short PHP code.

Viewing 2 replies - 1 through 2 (of 2 total)