Skip to content

a php redis sentinel client based on phpredis extension.

Notifications You must be signed in to change notification settings

hustclf/PHPRedisSentinel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

PHPRedisSentinel

a high performance redis-sentinel client for php based on phpredis extension. (hustclf.github.io)

advantages

1. singleton pattern

2. connecting pool

3. support multi methods

  • ping
  • masters
  • master
  • slaves
  • sentinels
  • getMasterAddrByName
  • reset
  • failOver
  • ckquorum
  • flushConfig
  • monitor
  • remove
  • set
  • getLastError
  • clearLastError
  • info

examples

        $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);

About

a php redis sentinel client based on phpredis extension.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages