-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[8.x] Adding support for using a different Redis DB in a Sentinel setup #38764
[8.x] Adding support for using a different Redis DB in a Sentinel setup #38764
Conversation
Please can you include some tests? |
@GrahamCampbell sure, I added a connection test. |
Wouldn't it be better to override options directly on the stores instead of in the options array? |
If you would ask me @driesvints I think this would make more sense; ` 'redis' => [
|
That's a big breaking change so we cannot do that. Maybe something more like: 'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'replication' => 'sentinel',
'service' => 'mymaster',
],
'default' => [
'tcp://'.env('REDIS_HOST_1').':26379?timeout=0.100',
'tcp://'.env('REDIS_HOST_2').':26379?timeout=0.100',
'tcp://'.env('REDIS_HOST_3').':26379?timeout=0.100',
'options' => [
'parameters' => [
'password' => env('REDIS_PASSWORD', null),
'database' => env('REDIS_DATABASE', null),
],
],
],
'storetwo' => [
'tcp://'.env('REDIS_HOST_1').':26379?timeout=0.100',
'tcp://'.env('REDIS_HOST_2').':26379?timeout=0.100',
'tcp://'.env('REDIS_HOST_3').':26379?timeout=0.100',
'options' => [
'parameters' => [
'password' => env('REDIS_PASSWORD', null),
'database' => env('REDIS_DATABASE_TWO', null),
],
],
],
], But not ideal. I agree that your solution is better but every app would break if we changed it like that. |
Yes I agree, that last comment looks to me as the most easy way, would you like me to reflect that into the commit @driesvints? |
Let's see what Taylor says. |
Where do we even document that you can pass these |
I don't think there are any docs on how to do this, but since the config is passed to predis, it's just works with their documentation (except the store parameters). But Sentinel is a very much used setup in a more enterprise infra. |
…up (laravel#38764) * Update RedisManager.php * Update RedisManager.php * Add test for Sentinel connections
…up (laravel#38764) * Update RedisManager.php * Update RedisManager.php * Add test for Sentinel connections
Following the Cache and Database documentation, it should be possible to create multiple cache stores from the Laravel database config.
This doest work if someone is using a Redis Sentinel configuration.
The host can be changed, but not the selected DB. This change won't break current configurations.
Current config:
New config: