我正在尝试将 redis 集群与 predis + phpiredis 一起使用,因为我看到 phpiredis 提高了性能。
这是我的 PHP 代码:
$cluster = [
'tcp://127.0.0.1:30001',
'tcp://127.0.0.1:30002',
'tcp://127.0.0.1:30003',
'tcp://127.0.0.1:30004',
'tcp://127.0.0.1:30005',
'tcp://127.0.0.1:30006',
];
$client = new Predis\Client($cluster,
[
'connections' => [
'tcp' => 'Predis\Connection\PhpiredisStreamConnection'
],
]
);
我收到以下错误:
致命错误:未捕获的异常 'Predis\Response\ServerException' 与 /var/www/html/predis-1.0/src/Client.php:365 中的消息 'MOVED 6918 127.0.0.1:30002' 堆栈跟踪:#0 /var/ www/html/predis-1.0/src/Client.php(330): Predis\Client->onErrorResponse(Object(Predis\Command\StringGet), Object(Predis\Response\Error)) #1 /var/www/html /predis-1.0/src/Client.php(310): Predis\Client->executeCommand(Object(Predis\Command\StringGet)) #2 /var/www/html/redisTests/predis.php(52): Predis\ Client->__call('get', Array) #3 /var/www/html/redisTests/predis.php(52): Predis\Client->get('test') #4 {main} throw in /var/ www/html/predis-1.0/src/Client.php 在第 365 行
现在,如果我只设置前 2 个集群 ip,它工作正常。有人可以解释一下是怎么来的吗?
有人可以告诉我有什么问题吗?predis + ppiredis 是否完全支持集群?
在此先感谢您的帮助!