Fix Predis Sentinel authentication when Sentinel requires password - #604
Fix Predis Sentinel authentication when Sentinel requires password#604bsabalaskey wants to merge 4 commits into
Conversation
|
Can you think of any scenarios where this would cause issues for any existing Sentinel setups that don't use your exact password setup? |
|
That is why I excluded changing things with the password in the Sentinel URI. If there is no password set at all, then this code is not triggered. And this only applies to Sentinel. So I believe that I covered the cases. The only limit is that the Redis and Sentinel password have to be the same. I suppose that flexibility could be added by having a WP_SENTINEL_PASSWORD to allow that being different, and then if same is not defined, fall back to the WP_REDIS_PASSWORD. |
That seems reasonable. Thanks! |
tillkruss
left a comment
There was a problem hiding this comment.
This just needs a changelog entry.
…ix/predis-sentinel-auth # Conflicts: # includes/object-cache.php
|
To make it flexible for a different Sentinel password from the Redis password, I used a WP_REDIS_SENTINEL_PASSWORD constant. The configuration style of that constant work in the same way as WP_REDIS_PASSWORD. Docs are all updated to describe that too. |
tillkruss
left a comment
There was a problem hiding this comment.
Please add a changelog entry to your branch, then I can merge this ✌️
|
The change was updated in the latest push I did, as part of the flexibility to add use a Sentinel password different from the Redis password. |
Problem: WP_REDIS_PASSWORD is applied to Redis node parameters but not Sentinel-specific parameters in Predis Sentinel mode.
Symptom: admin health check shows Redis as unreachable unless each Sentinel URI includes ?password=whatever
Fix: propagate Redis password and optional username into $servers when WP_REDIS_SENTINEL is defined.
Why it matters: avoids forcing credentials into each Sentinel URI and makes authenticated Sentinel setups work consistently and easier.
Reproduce the Problem and Showing the Fix
Tested With