• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

Question Docker Redis throws 'read error on connection'

xmh87

New Pleskian
I've been using Redis on a docker image for a short while (a week or so), installed through plesk with success. We've decided to upgrade the hardware of the VPS server and after the upgrade & reboot the docker Redis throws "read error on connection" when trying to do anything other than connecting.


I've tried setting PHP's default_socket_timeout

PHP:
ini_set('default_socket_timeout', -1);

and the redis timeout:

PHP:
$clientRedis->setOption(Redis::OPT_READ_TIMEOUT, -1);

But still the error remains..
Here's my code I use for testing:

PHP:
    <?php
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
    ini_set('default_socket_timeout', -1);
    
    $clientRedis = new Redis();
    
    function Redis_connect($hostname, $port){
        $start = time();
        global $clientRedis;
        try {
            
            $connected = $clientRedis->connect($hostname, $port);
            
            $clientRedis->setOption(Redis::OPT_READ_TIMEOUT, -1);
            if (!$connected) { throw new Exception(); }
        } catch (Exception $e) {
            $elapsed = time() - $start;
            echo "Elapsed: " . $elapsed . "\n";
            die($e->getMessage());
        }
    
    
    }
    
    //Connecting to Redis server on localhost
    echo Redis_connect("127.0.0.1", 6379);
    
    
    echo "Connected to server successfully";
    echo "";
    echo "Server is running: " . $clientRedis->ping();
    echo "";
    
    
    ?>

This outputs:

Code:
    Connected to server successfully
    Fatal error: Uncaught RedisException: read error on connection in [..]/redis.php:32 Stack trace: #0 [..]/redis.php(32): Redis->ping() #1 {main} thrown in [..]/redis.php on line 32

the only thing I could find on Google was the timeout settings mentioned above, which did not work. I've tried several image versions, alpine, latest, 5.0.8; all the same error.
Strangest thing is that it worked before the reboot/upgrade. The VPS company won't provide any support because it is software..


Does anyone know what's going on here?
 
Back
Top