Support » Plugin: Redis Object Cache » Status: Not Connected despite plugin can see Redis server

  • Resolved CodeBard

    (@codebard)


    Kubernetes, using a custom docker image with debian buster PHP 7.3 fpm, Apache. Connecting to an in-cluster Redis cluster directly. No matter which version of php-redis i install (4.2.0 Debian Buster default, or, 5.2.2 latest or 5.1.0 version from PECL) i still get status Not Connected. The plugin can see the Redis server and ping it however, also can get its info. Using a sidecar im able to connect to the server and query it easily with redis-cli. The Redis cluster requires -c flag (allowing redirection of queries?) maybe that is the reason?

    Configuration is below:

    define( 'WP_REDIS_HOST', 'redis-cluster' );
    define( 'WP_CACHE', true );
    // define( 'WP_REDIS_CLIENT', 'pecl' );
    define( 'WP_REDIS_PASSWORD', 'SOMEPASSWORD' );
    define( 'WP_REDIS_DATABASE', '0' );
    define( 'WP_CACHE_KEY_SALT', 'SOMESALTHERE' );
    define( 'WP_REDIS_SELECTIVE_FLUSH', true );
    define( 'WP_REDIS_DISABLE_BANNERS', true );

    Diagnostics in plugin:

    Status: Not Connected
    Client: PhpRedis (v5.1.0)
    Drop-in: Valid
    Ping: 1
    Redis Extension: 5.1.0
    Predis Client: 1.1.1
    PHP Version: 7.3.14-1~deb10u1
    Redis Version: 5.0.9
    Multisite: Yes
    Global Prefix: ""
    Blog Prefix: 1
    WP_REDIS_HOST: "redis-cluster"
    WP_REDIS_DATABASE: "0"
    WP_CACHE_KEY_SALT: "SOMESALTHERE"
    WP_REDIS_PASSWORD: "**********"
    Global Groups: {
        "0": "blog-details",
        "1": "blog-id-cache",
        "2": "blog-lookup",
        "3": "global-posts",
        "4": "networks",
        "5": "rss",
        "6": "sites",
        "7": "site-details",
        "8": "site-lookup",
        "9": "site-options",
        "10": "site-transient",
        "11": "users",
        "12": "useremail",
        "13": "userlogins",
        "14": "usermeta",
        "15": "user_meta",
        "16": "userslugs",
        "33": "blog_meta"
    }
    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"
    ]
    Unflushable Groups: []
Viewing 3 replies - 16 through 18 (of 18 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    That’s a common error message, try Googling it.

    Chasing that particular error message did not avail, neither playing with the cluster configuration.

    Instead, i moved to using redis + sentinel, configured it without password (accessible only in-cluster) and configured the plugin to use sentinel port and read only port for servers.

    Now it works and properly stores keys in db. The config i used:

    define( 'WP_REDIS_CLIENT', 'predis' );
    define( 'WP_REDIS_SENTINEL', 'mymaster' );
    define( 'WP_REDIS_SERVERS', [
        'tcp://redis-headless:26379',
        'tcp://redis-headless:6379',
    ] );
    
    define( 'WP_CACHE', true );
    // define( 'WP_REDIS_CLIENT', 'pecl' );
    // define( 'WP_REDIS_PASSWORD', 'SOMEPASSWORDHERE' );
    define( 'WP_REDIS_DATABASE', '0' );
    define( 'WP_CACHE_KEY_SALT', 'SOMEKEYHERE' );
    define( 'WP_REDIS_SELECTIVE_FLUSH', true );

    This uses Bitnami’s redis helm chart below.

    https://github.com/bitnami/charts/tree/master/bitnami/redis

    Installed with…

    helm install /root/custom-chart-location -n redis -f /root/custom-chart-location/values.yaml –set cluster.enabled=true –set sentinel.enabled=true –set usePassword=false

    The values.yaml has Bitnami’s production values, except with network policy disabled.

    Redis client at web nodes is installed via pecl. Version of php-redis installed is 5.2.2

    These may help somebody.

    • This reply was modified 3 weeks, 4 days ago by CodeBard.
    • This reply was modified 3 weeks, 4 days ago by CodeBard.
    Plugin Author Till Krüss

    (@tillkruess)

    Thanks for sharing the details @codebard!

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