Skip to content

Phpredis sentinel auth #697

@McFistyBuns

Description

@McFistyBuns

Please correct me if I missed something, but it doesn't look like you can pass any password to a sentinel when using Phpredis.

$address = (new $sentinelClass(
$dsn->getHost(),
(int) $dsn->getPort(),
$connectionTimeout,
$connectionPersistent,
5, // retry interval
$readTimeout,
))->getMasterAddrByName($masterName);

the Phpredis RedisSentinel class allows for an $auth parameter at the end.

https://github.com/phpredis/phpredis/blob/develop/sentinel.md#readme

Took me a bit to figure out why my setup was working with predis and not phpredis. I patched in the parameter for myself to pass the password from the parameters config: $options['parameters']['password'] ?? null since my cluster setup uses the same password for both. I could see a more robust path, though, in checking the dsn string for a password first in case the the sentinel and the node passwords are different.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImproves existing functionalityphpredisSpecific to PhpRedis

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions