Support » Plugin: Redis Object Cache » Status: Not Connected

  • Resolved PanjiNamjaElf

    (@panjinamjaelf)


    I use PhpRedis (v4.3.0) but when i enable Redis Object Cache status display not connected

    Here diagnostic log:

    Status: Not Connected
    Redis Version: Unknown
    Client: PhpRedis (v4.3.0)
    Drop-in: Valid
    Connection Exception: php_network_getaddresses: getaddrinfo failed: Name or service not known (RedisException)
    Redis Extension: 4.3.0
    Predis Client: 1.1.1
    PHP Version: 7.2.17
    Multisite: No
    Global Prefix: "wp_"
    Blog Prefix: "wp_"
    WP_REDIS_HOST: "redis"
    WP_REDIS_MAXTTL: "14400"
    WP_CACHE_KEY_SALT: "example.com_obj:"
    Global Groups: [
        "blog-details",
        "blog-id-cache",
        "blog-lookup",
        "global-posts",
        "networks",
        "rss",
        "sites",
        "site-details",
        "site-lookup",
        "site-options",
        "site-transient",
        "users",
        "useremail",
        "userlogins",
        "usermeta",
        "user_meta",
        "userslugs"
    ]
    Ignored Groups: [
        "counts",
        "plugins",
        "blog-details",
        "blog-id-cache",
        "blog-lookup",
        "global-posts",
        "networks",
        "rss",
        "sites",
        "site-details",
        "site-lookup",
        "site-options",
        "site-transient",
        "users",
        "useremail",
        "userlogins",
        "usermeta",
        "user_meta",
        "userslugs",
        "blog_meta",
        "themes"
    ]
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    Your “host” isn’t reachable.

    PanjiNamjaElf

    (@panjinamjaelf)

    How to make it reachable ?

    This line is causing issue when your redis is in master/slave replication mode. Command INFO is not allowed in replication mode.

    
    $server_info = $this->redis->info( 'SERVER' );
    

    Temporary fix.

    
    @@ -572,11 +572,14 @@ class WP_Object_Cache
                     $this->redis->ping();
                 }
    
    -            $server_info = $this->redis->info( 'SERVER' );
    -            if (isset($server_info['redis_version'])) {
    -                $this->redis_version = $server_info['redis_version'];
    -            } elseif (isset( $server_info['Server']['redis_version'])) {
    -                $this->redis_version = $server_info['Server']['redis_version'];
    +            // If not in replication mode.
    +            if ( ! $options['replication'] ) {
    +                $server_info = $this->redis->info( 'SERVER' );
    +                if (isset($server_info['redis_version'])) {
    +                    $this->redis_version = $server_info['redis_version'];
    +                } elseif (isset( $server_info['Server']['redis_version'])) {
    +                    $this->redis_version = $server_info['Server']['redis_version'];
    +                }
                 }
    
    Plugin Author Till Krüss

    (@tillkruess)

    Would you mind submitting a PR on GitHub with you fix?

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