Skip to content
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

[5.7] support change redis sentinel connection to default without change version control file database.php in some production environment #26922

Closed
wants to merge 1 commit into from

Conversation

dynamohuang
Copy link

Enable Define default connection so that support redis sentinel connection without change version control file database.php in some production environment. In this way Just change .env REDIS_DEFAULT_CONNECTION.

For eg:

'default_connection' => env('REDIS_DEFAULT_CONNECTION', 'default'), 'default' => [ 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', 6379), 'database' => 0, ], 'sentinel' => [ 'tcp://192.168.104.65:26379?timeout=0.100', 'tcp://192.168.104.65:26380?timeout=0.100', 'options' => [ 'replication' => 'sentinel', 'service' => 'clouds', 'parameters' => [ 'password' => 'clouds@1234', 'database' => 0, ], ], ],

…ction without change database.php in some production environment. In this way Just change .env REDIS_DEFAULT_CONNECTION.

 For eg:

  'default_connection' => env('REDIS_DEFAULT_CONNECTION', 'default'),
        'default' => [
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => 0,
        ],
        'sentinel' => [
            'tcp://192.168.104.65:26379?timeout=0.100',
            'tcp://192.168.104.65:26380?timeout=0.100',
            'options' => [
                'replication' => 'sentinel',
                'service' => 'clouds',
                'parameters' => [
                    'password' => 'clouds@1234',
                    'database' => 0,
                ],
            ],
        ],
@dynamohuang
Copy link
Author

Referring issue:
#18850

@dynamohuang
Copy link
Author

In database config file
// Create a custom connection to use redis sentinel 'cache_sentinel' => [ // Set the Sentinel Host from Environment (optinal you can hardcode if want to use in prod only) env('CACHE_REDIS_SENTINEL_1'), env('CACHE_REDIS_SENTINEL_2'), env('CACHE_REDIS_SENTINEL_3'), 'options' => [ 'replication' => 'sentinel', 'service' => 'cachemaster'), 'parameters' => [ 'password' => env('REDIS_PASSWORD', null), 'database' => 0, ], ], ],
https://stackoverflow.com/questions/52885098/configure-redis-sentinel-in-laravel-5-5

@driesvints driesvints changed the title support change redis sentinel connection to default without change version control file database.php in some production environment [5.7] support change redis sentinel connection to default without change version control file database.php in some production environment Dec 20, 2018
@taylorotwell
Copy link
Member

I am closing this pull request because it lacks sufficient explanation, tests, or both. It is difficult for us to merge pull requests without these things because the change may introduce breaking changes to the framework.

Feel free to re-submit your change with a thorough explanation of the feature and tests - integration tests are preferred over unit tests. Please include it's benefit to end users; the reasons it does not break any existing features; how it makes building web applications easier, etc.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants