Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -1165,15 +1165,19 @@
* which then causes a FileLocked exception.
*
* See https://redis.io/topics/cluster-spec for details about the Redis cluster
*
* Authentication works with phpredis version 4.2.1+. See
* https://github.com/phpredis/phpredis/commit/c5994f2a42b8a348af92d3acb4edff1328ad8ce1
*/
'redis.cluster' => [
'seeds' => [ // provide some/all of the cluster servers to bootstrap discovery, port required
'localhost:7000',
'localhost:7001'
'localhost:7001',
],
'timeout' => 0.0,
'read_timeout' => 0.0,
'failover_mode' => \RedisCluster::FAILOVER_ERROR
'failover_mode' => \RedisCluster::FAILOVER_ERROR,
'password' => '', // Optional, if not defined no password will be used.
],


Expand Down
6 changes: 5 additions & 1 deletion lib/private/RedisFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ private function create() {
} else {
$readTimeout = null;
}
$this->instance = new \RedisCluster(null, $config['seeds'], $timeout, $readTimeout);
if (isset($config['password']) && $config['password'] !== '') {
$this->instance = new \RedisCluster(null, $config['seeds'], $timeout, $readTimeout, false, $config['password']);
} else {
$this->instance = new \RedisCluster(null, $config['seeds'], $timeout, $readTimeout);
}

if (isset($config['failover_mode'])) {
$this->instance->setOption(\RedisCluster::OPT_SLAVE_FAILOVER, $config['failover_mode']);
Expand Down