lumen framework redis主从配置

ijxebb2r  于 2021-06-09  发布在  Redis
关注(0)|答案(0)|浏览(380)

我用redis创建了一个主从结构,主ip 192.169.99.109,从ip 192.168.99.108,lumen不知为什么我不能配置redis。。。
lumen database.php redis密钥

'redis' => [
        'client' => 'predis',
        'cluster' => false,
        'options' => [
            'replication' => true,
        ],
        'master' => [
            'scheme' => 'tcp',
            'host' => '192.168.99.109',
            'password' => null,
            'port' => 6379,
            'alias' => 'master',
            'database' => 0,
        ],
        'slave-001' => [
            'scheme' => 'tcp',
            'host' => '192.168.99.108',
            'port' => 6379,
            'alias' => 'slave-001',
            'database' => 0,
        ],
        'slave-002' => [
            'scheme' => 'tcp',
            'host' => '192.168.99.110',
            'port' => 6379,
            'alias' => 'slave-002',
            'database' => 0,
        ],
        // add more slaves if needed
    ],

我可以很容易地做这项工作与正常的php没有问题。。。

$parameters = [
    'tcp://192.168.99.109:6379?alias=master',
    'tcp://192.168.99.108:6379',

];

$client = new Predis\Client($parameters, array('replication' => true,'prefix'=>'del__'));

$client->set('number', random_int(1,89999));
$client->get('number');

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题