Support » Plugin: Redis Object Cache » Can connect only as default user

  • Resolved benfa

    (@benfa)


    Hello,

    I can connect from WordPress to Redis as default user, defined in redis.conf thusly:

    #define( ‘WP_REDIS_USER’, ‘<user>’ );
    #define( ‘WP_REDIS_PASSWORD’, ‘<password>’);
    define( ‘WP_REDIS_PASSWORD’, ‘paessword’);

    When I comment the third line and un-comment the first two I cannot connect to the same Redis database. This error message appears in diagnostics:

    Connection Exception: WRONGPASS invalid username-password pair or user is disabled. (RedisException)
    Errors: [
    “WRONGPASS invalid username-password pair or user is disabled.”
    ]

    However, I can connect with a PHP script that uses those same credentials:

    <?php
    
    header('Content-type: text/plain');
    
    $redis = new Redis();
    //Connecting to Redis
    $redis->connect('<servername>', 6379);
    $redis->auth(['<user>', '<password>]);
     
    if ($redis->ping()) {
            echo "PONG\n";
    }
     
    ?>

    IIRC, I was able to connect to Redis as a user I had defined in redis.conf. I don’t know what the cause of this error is.

    How can I fix this?

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

    (@tillkruess)

    Hi!

    Can you post your diagnostics from the plugin settings screen?

    My guess is the WP_REDIS_HOST definition is too far down the config.

    Thread Starter benfa

    (@benfa)

    Here’s the full text of what’s in the diagnostics tab:
    ——————————————————

    Status: Connected
    Client: PhpRedis (v5.3.3)
    Drop-in: Valid
    Disabled: No
    Ping: 1
    Errors: []
    PhpRedis: 5.3.3
    Predis: Not loaded
    Credis: Not loaded
    PHP Version: 7.4.16
    Plugin Version: 2.0.17
    Redis Version: 6.2.1
    Multisite: No
    Filesystem: Working
    Global Prefix: "wp_"
    Blog Prefix: "wp_"
    WP_REDIS_HOST: "redis.benfa-redis.svc.cluster.local"
    WP_REDIS_PORT: 6379
    WP_REDIS_DATABASE: 0
    WP_REDIS_TIMEOUT: 1
    WP_REDIS_READ_TIMEOUT: 1
    WP_REDIS_PASSWORD: ••••••••
    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",
        "redis-cache",
        "blog_meta"
    ]
    Ignored Groups: [
        "counts",
        "plugins",
        "themes"
    ]
    Unflushable Groups: []
    Drop-ins: [
        "advanced-cache.php v by ",
        "Redis Object Cache Drop-In v2.0.17 by Till Krüss"
    ]

    ——————————————————

    I noticed that the diagnostics tab was displaying the Redis variables in a different order than wp-config.php, so I changed wp-config.php to match that order. REDIS_PASSWORD is the last of the Redis variables, with REDIS_USER preceding it, if it is used.

    Plugin Author Till Krüss

    (@tillkruess)

    It says “Status: Connected”, what’s the issue exactly?

    Thread Starter benfa

    (@benfa)

    I want to connect from WordPress to Redis as a specific user. This user will have a specific ACL applied to it.

    I can connect only if I specify the default user. In redis.conf, it is this:

    requirepass ‘<password>’

    …and in wp-config.php, I declare REDIS_PASSWORD, but not REDIS_USER.

    Connection fails if I try to connect as user benfa, specified in redis.conf like this:

    user benfa allcommands allkeys on >'<password>’

    …and in wp-config.php, I declare both REDIS_USER and REDIS_PASSWORD.

    Plugin Author Till Krüss

    (@tillkruess)

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