Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phpredis sentinel auth #697

Closed
McFistyBuns opened this issue Feb 9, 2023 · 2 comments
Closed

Phpredis sentinel auth #697

McFistyBuns opened this issue Feb 9, 2023 · 2 comments
Labels
enhancement Improves existing functionality phpredis Specific to PhpRedis

Comments

@McFistyBuns
Copy link

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.

@ostrolucky
Copy link
Collaborator

That's correct. PR welcome ;)

@ostrolucky ostrolucky added phpredis Specific to PhpRedis enhancement Improves existing functionality labels Feb 9, 2023
@ostrolucky
Copy link
Collaborator

Done in #727

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves existing functionality phpredis Specific to PhpRedis
Projects
None yet
Development

No branches or pull requests

2 participants