a high performance redis-sentinel client for php based on phpredis extension. (hustclf.github.io)
- ping
- masters
- master
- slaves
- sentinels
- getMasterAddrByName
- reset
- failOver
- ckquorum
- flushConfig
- monitor
- remove
- set
- getLastError
- clearLastError
- info
$policy = [
'servers' => [
[
'host' => '127.0.0.1',
'port' => '26379',
],
[
'host' => '127.0.0.1',
'port' => '26380',
],
[
'host' => '127.0.0.1',
'port' => '26381',
],
]
];
$sentinel = RedisSentinel::getInstance($policy);
// ping
$ret = $sentinel->ping();
// get all monitored masters
$ret = $sentinel->masters();
// get master by master name
$ret = $sentinel->master('mymaster');
// get slaves
$ret = $sentinel->slaves('mymaster');
// get sentinels
$ret = $sentinel->sentinels('mymaster');
// get master address by master name
$ret = $sentinel->getMasterAddrByName('mymaster');
// and so on
var_dump($ret);