我用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');
暂无答案!
目前还没有任何答案,快来回答吧!