shyevsa/yii2-redis-sentinel

Yii2 Redis Connection with auto resolve redis `host` and `port` master from redis-sentinel

Installs: 6 838

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 1

Open Issues: 0

Type:yii2-extension

v0.1.2 2024-09-17 16:08 UTC

This package is auto-updated.

Last update: 2024-11-17 16:27:10 UTC


README

This is an extention of yiisoft/yii2-redis to use Sentinel as Source of Connection parameter.

Based on pyurin/yii2-redis-ha. It only work on sentinel, and unable to connect to redis host without sentinel.

Instalation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist shyevsa/yii2-redis-sentinel:"*"

or add

"shyevsa/yii2-redis-sentinel":"*"

to the require section of your composer.json.

Usage

'components'=>[
    'redis' => [
        'class' => \shyevsa\redis\Connection::class,
        'master_name' => 'mymaster',
        'database' => 0
        'sentinels' => [
            '10.10.4.1',
            '10.10.4.2',
            [
              'hostname'=>'127.0.0.1',
              'port'=>3000,
            ],        
        ],        
    ]
]

The sentinels use the same connection parameter as regular redis connection check yiisoft/yii2-redis for detail