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

[8.x] Fix flushDb (cache:clear) for redis clusters #36281

Merged
merged 1 commit into from
Feb 17, 2021
Merged

[8.x] Fix flushDb (cache:clear) for redis clusters #36281

merged 1 commit into from
Feb 17, 2021

Commits on Feb 16, 2021

  1. Fix flushDb (cache:clear) for redis clusters

    When running `php artisan cache:clear` with a redis cluster, the flushDb() function is currently unable to run on each master if you are using a password or TLS scheme - #35180
    
    For redis clusters an empty `$config` array is passed through to the constructor of `vendor\laravel\framework\src\Illuminate\Redis\Connections\PhpRedisConnection.php` causing authentication to fail.
    
    However, even if you update `vendor\laravel\framework\src\Illuminate\Redis\Connectors\PhpRedisConnector.php` to pass through the cluster password it still fails because `$redis = tap(new Redis)->connect($host, $port);` does not connect to each master node using the correct TLS scheme or any steam context such as `local_cert`, `local_pk`, `cafile` or `verify_peer_name`.
    
    This pull request fixes the issue by using `Directed node commands` as described here - https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#directed-node-commands
    
    It uses the already authenticated `RedisCluster` connection with correct scheme and context to direct the `flushdb` command to each master node to succesfully clear the cache.
    willbrowningme authored Feb 16, 2021
    Configuration menu
    Copy the full SHA
    d9232ca View commit details
    Browse the repository at this point in the history