Skip to content

Conversation

@tysion
Copy link
Contributor

@tysion tysion commented Apr 26, 2025

This PR adds support for password authentication when connecting to Redis Sentinel.

Closes #924.

Allows configuring Sentinel password via sentinel_password option in secdist config.
Example:

{
    "redis_settings": {
        "taxi-tmp": {
            "password": "redispwd",
            "sentinel_password": "sentpwd",  /* <---- `AUTH sentpwd` will be executed on connection to sentinel`
            "database_index": 5,
            "secure_connection": false,
            "shards": [
                {
                    "name": "mymaster"
                }
            ],
            "sentinels": [
                {
                    "host": "127.0.0.1",
                    "port": 26379
                }
            ]
        }
    }
}

Note: by creating a PR or an issue you automatically agree to the CLA. See CONTRIBUTING.md. Feel free to remove this note, the agreement holds.

@tysion tysion requested a review from segoon as a code owner April 26, 2025 22:42
Copy link
Member

@apolukhin apolukhin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks, looks great!

A few comments follow:


for (const auto& sentinel : sentinels) {
EXPECT_TRUE(sentinel->WaitForFirstPingReply(kSmallPeriod));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a subscribe test too

mistergad pushed a commit to mistergad/userver that referenced this pull request Oct 8, 2025
…or non-subscribe cases

This PR adds support for password authentication when connecting to Redis Sentinel.

Closes: userver-framework#924

Allows configuring Sentinel password via `sentinel_password` option in secdist config.
Example:
```json
{
    "redis_settings": {
        "taxi-tmp": {
            "password": "redispwd",
            "sentinel_password": "sentpwd",  /* <---- `AUTH sentpwd` will be executed on connection to sentinel` */
            "database_index": 5,
            "secure_connection": false,
            "shards": [
                {
                    "name": "mymaster"
                }
            ],
            "sentinels": [
                {
                    "host": "127.0.0.1",
                    "port": 26379
                }
            ]
        }
    }
}
```

Tests: протестировано CI

Pull Request resolved: userver-framework#925
commit_hash:84ec2914e9b505c1655600cf3ce6ccf2281ae75c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Sentinel authentication with AUTH command

3 participants