• Resolved ex0danify

    (@ex0danify)


    Hi,
    I’m trying to setup this plugin with a remote redis server, my configuration is as follows:

    wp-config:

    
    WP_REDIS_HOST: "oam-db.skyxxxxxx.com"
    WP_REDIS_PORT: 6379
    WP_REDIS_TIMEOUT: 1
    WP_REDIS_READ_TIMEOUT: 1
    WP_REDIS_PASSWORD: ["gaxxx","••••••••"]
    

    Redis server log (When Loading my WP site):

    
    32323:M 28 Jul 2022 12:04:30.183 - Accepted 95.217.xxx.xxx:35880
    32323:M 28 Jul 2022 12:04:30.262 - Client closed connection
    


    Redis Object Cache – Diagnostics:

    
    Status: Not connected
    Client: PhpRedis (v5.3.7)
    Drop-in: Valid
    Disabled: No
    Ping: 
    Errors: [
        "Connection refused"
    ]
    PhpRedis: 5.3.7
    Relay: Not loaded
    Predis: Not loaded
    Credis: Not loaded
    PHP Version: 8.0.21
    Plugin Version: 2.1.6
    ...
    

    Why am I getting a connection refused error, when the request clearly reaches the redis server? I also tried setting a bogus username in wp-config to see if the error changes, and is does (so my auth array is correctly set).

    I’am also running another web application on the same server as my wordpress site without any problems (using the same redis host and same redis port).

    any Ideas?

    Cheers
    Lucas

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

    (@tillkruess)

    Why am I getting a connection refused error, when the request clearly reaches the redis server?

    Maybe it’s hitting the timeout?

    Thread Starter ex0danify

    (@ex0danify)

    Thanks for your response.
    I tried setting the timeouts to 30 seconds, same behavior :/

    Any more ideas?

    Plugin Author Till Krüss

    (@tillkruess)

    Can you connect from your web server to Redis via redis-cli?

    Thread Starter ex0danify

    (@ex0danify)

    Yes,
    I can connect from my webserver to my redis database server via redis-cli:

    
    .../var/www/html/skyxxxx-xxx.com/gdb # redis-cli -h oam-db.skyxxxxxx.com -p 6379
    oam-db.skyxxxxxx.com:6379> CONFIG GET databases
    1) "databases"
    2) "16"
    oam-db.skyxxxxxx.com:6379>
    

    Im absolutely clueless whats going wrong with wordpress here 🙁

    Plugin Author Till Krüss

    (@tillkruess)

    That’s weird. Maybe it’s PHP itself. Can you try running that on your server via HTTP?

    
    <?php
    
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    
    $redis = new Redis('oam-db.skyxxxxxx.com', 6379, 5.0, '', 100, 5.0);
    $redis->auth(["gaxxx", "••••••••"]);
    
    var_dump(
        $redis->ping('pong')
    );
    
    Thread Starter ex0danify

    (@ex0danify)

    Nothing unusual so far. I had to modify your script though, cause php-redis does not take arguments in the constructor class. I added a second line to actually connect to my server.

    Modified script:

    
    <?php
    
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    
    $redis = new Redis();
    $redis->connect('oam-db.skyxxxxxx.com', 6379, 5.0, '', 100, 5.0);
    $redis->auth(["gaxxx", "••••••••"]);
    
    var_dump(
        $redis->ping('pong')
    );
    

    Result:

    
    string(4) "pong"
    

    Result from your unmodified script:

    
    PHP Fatal error:  Uncaught ArgumentCountError: Redis::__construct() expects exactly 0 arguments, 6 given in /var/www/html/skyxxxxxx.com/redis_test.php:6
    Stack trace:
    #0 /var/www/html/skyxxxxxx.com/redis_test.php(6): Redis->__construct()
    #1 {main}
      thrown in /var/www/html/skyxxxxxx.com/redis_test.php on line 6
    

    Thanks for taking your time with me by the way!

    Plugin Author Till Krüss

    (@tillkruess)

    Ah, thanks, I was thinking Relay syntax 😅

    This is odd, so PHP can connect, what exactly happens when you set the WP_REDIS_HOST and such in WordPress?

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

The topic ‘“Connection refused” (another one)’ is closed to new replies.