PHP 5.3+ redis-sentinel client for php based on phpredis extension.
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
.travis-ci tests Jan 3, 2017
examples tests Dec 29, 2016
src add info method Jan 3, 2017
tests tests Jan 3, 2017
.gitignore init Dec 27, 2016
.travis.yml tests Dec 29, 2016
README.md tests Dec 30, 2016
composer.json add describe and keywords in composer.json Jan 3, 2017
phpunit.xml add test cases Dec 29, 2016

README.md

redis-sentinel

Latest Stable Version Total Downloads Latest Unstable Version License travis

redis-sentinel client for php based on phpredis extension.

examples

Get Redis master address and create Redis object:

$sentinel = new \Jenner\RedisSentinel\Sentinel();
$sentinel->connect('127.0.0.1', 6379);
$address = $sentinel->getMasterAddrByName('mymaster');

$redis = new Redis();
$redis->connect($address['ip'], $address['port']);
$info = $redis->info();
print_r($info);

Create redis-sentinel pool and create Redis object:

$sentinel_pool = new \Jenner\RedisSentinel\SentinelPool();
$sentinel_pool->addSentinel('127.0.0.1', 26379);
$sentinel_pool->addSentinel('127.0.0.1', 26380);

$address = $sentinel_pool->master('mymaster');
print_r($address);

$redis = $sentinel_pool->getRedis('mymaster');
$info = $redis->info();
print_r($info);