-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to connect to Redis Sentinel for Cache, PageCache and Session #11222
Ability to connect to Redis Sentinel for Cache, PageCache and Session #11222
Conversation
2a32bd0
to
dd1464f
Compare
I fixed PHPCs checks. |
composer.json
Outdated
"colinmollenhour/credis": "1.6", | ||
"colinmollenhour/php-redis-session-abstract": "~1.2.2", | ||
"colinmollenhour/credis": "^1.8", | ||
"colinmollenhour/php-redis-session-abstract": "1.3.5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change to
+ "colinmollenhour/credis": "~1.9.0",
+ "colinmollenhour/php-redis-session-abstract": "~1.3.5",
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will do it asap. Regards
@vrann note that |
@orlangur I updated composer.json as you said. Regards |
|
@orlangur is any help from me needed for this issue ? Especially regarding conflicts. Or are you guys actually working internally on this one to test it and merge it by your own ? Best regards |
Hi @romainruaud, please resolve conflicts and force push changes as a single commit. I'll try to find somebody familiar with Redis Sentinel to be able to play with your implementation and review it. |
a962c98
to
0acb77f
Compare
@orlangur I fixed the conflicts, rebased the branch and squashed the commits. Let me know if more help is needed. Best regards |
@vrann agreed to look into it as he even wrote some HLD involving Redis Sentinel. |
Great to see you are gonna have a look on this one, actually Redis is the last component which is not HA-friendly and prevent this prevent us (but anybody else) to build complete autoscaling platform. @orlangur I see that Travis is broken due to composer.lock file not being up-to-date. Do you want me to fix this on this branch or will you process the fix by yourselves when integrating it to develop ? Regards |
@romainruaud please fix and do and amend commit + force push. |
0acb77f
to
1d94d7c
Compare
It's been a while that I wonder why Magento has not implemented sentinels usage and that's a real problem if we want to get Redis Hight Available. I am impatient to finally be able to avoid losing sessions if Redis craches... Is there any chance to see that PR to be implemented soon ? |
1d94d7c
to
4c4bbb1
Compare
@metal3d, looks like the support of Redis sentinels already available in 2.2 develop and this PR only add the possibility to configure it in install step. But I personally does not see reason why we need to do it in install and not after |
@kandy "But I personally does not see reason why we need to do it in install and not after" In fact we need it because we have a devops stack which is building environments from scratch (from a git repo) and processes the setup:install step if it's a totally new environment. Also, this is not logical to have configuration options such as redis sentinel that we can only specify after installing. The install parameters should allow exactly the same thing than editing the env.php manually (since the installer is basically a php process which writes the env.php). |
@romainruaud, Magento use bin/magento setup:config:set command for this |
Sorry @kandy but I cannot agree. All other settings of env.file are available through setup:install. There is not point doing setup:install with files as cache backend (and session) and process a setup:config:set just after. => I would lose the prebuilt cache. For me the command should be consistant with the rest |
4c4bbb1
to
aaceaf8
Compare
Update version of CM modules requirement. Adding Tests for Redis Session Configuration. Update unit tests for Redis usage with Sentinel. Update version of CM modules requirement.
aaceaf8
to
159c737
Compare
@kandy Usage of HA redis for sessions would need at least v1.3.5 of colinmollenhour/php-redis-session-abstract, but 2.2-develop still ships with v1.3.4 |
…to/magento2/pull/11222 uses "host", so support both
Hi all |
Magento installation on command line needs to contact Redis, there is an error if we use Sentinels, that PR fixes that... and you refuse that fix. Can you please explain the reason you don't want to fix this ? "Internal discussion" is not very informative. Thanks. |
Hi @metal3d,
Please report an issue describing such scenario, then possible approaches to solve this problem can be discussed. Cannot say anything about internal discussion as didn't participate / read meeting minutes. "All other settings of env.file are available through setup:install" is a strong argument to me personally though if it is true. |
@kandy Which cli command are you referring to; setup:config:set doesn't include those options to write to the env file appropriately? The setup config doesn't have this option
|
@tschirmer @romainruaud Yep, I agree that is valuable to deliver it in 2.3/2.4 branch |
Description
This PR provides the support of Redis Sentinel for Cache, PageCache, and Session.
Usage of Redis Sentinel is suitable in an HA environment.
This is supported "out of the box" by colinmollenhour modules (credis, php-abstract-session, and it's cache backend). See https://github.com/colinmollenhour/Cm_Cache_Backend_Redis#high-availability-and-load-balancing-support
But Magento is not actually fully compatible with Redis Sentinel usage. This PR intends to add this compatibility.
What has been done :
New variables added to the
setup:install
in command line :Basically, there are three parameters that are identical in the 3 cases :
Please also note that when using Sentinel, you must use the IP/address of your sentinel servers as your Redis Host. Since you are meant to have several sentinels when running such an instance, you can use the list of all your sentinel servers as an input for the "host" or "server" configuration values for Redis (Eg : 'tcp://10.0.3.1:26379,tcp://10.0.3.2:26379,tcp://10.0.3.3:26379') .
Here is an example of a generated
app/etc/env.php
:Manual testing scenarios
Contribution checklist