dpsarr/laravel-redis-sentinel

Package allows connect laravel to redis sentinel via PHPRedis

v0.1 2021-06-10 15:48 UTC

This package is auto-updated.

Last update: 2024-05-13 15:43:27 UTC


README

Allows to connect to Redis via Redis Sentinel

Change your redis config in config/database.php

    'redis' => [
        'client' => env('REDIS_CLIENT', 'phpredis'),

        'options' => [
            'cluster' => env('REDIS_CLUSTER', 'redis'),
            'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
        ],

        'default' => [
            'password' => env('REDIS_PASSWORD', null),
            'database' => env('REDIS_DB', '0'),
            'master' => 'mymaster',
            'sentinel' => [
                'hosts' => [
                    '172.21.0.1' => 26379,
                ],
                'timeout' => 0,
                'persistent' => null,
                'retry_interval' => 0,
                'read_timeout' => 0,
            ],
        ],
    ],