-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Implement ability to connect to Sentinel with TLS #2139
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
Conversation
@@ -28,6 +32,12 @@ | |||
protected String sentinelPassword; | |||
protected String sentinelClientName; | |||
|
|||
protected boolean isRedisSslEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Master
would be better that Redis
. E.g. isMasterSslEnabled
. Also, apply this change entire PR.
public JedisSentinelPool(String masterName, Set<String> sentinels, | ||
final GenericObjectPoolConfig poolConfig, final int connectionTimeout, final int soTimeout, | ||
final String password, final int database, final String clientName, | ||
final int sentinelConnectionTimeout, final int sentinelSoTimeout, final String sentinelPassword, | ||
final String sentinelClientName) { | ||
final String sentinelClientName, final boolean isRedisSslEnabled, final boolean isSentinelSslEnabled, | ||
final SSLSocketFactory sslSocketFactory, final SSLParameters sslParameters, | ||
final HostnameVerifier hostnameVerifier) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DON'T change an existing constructor or public method. Create a new one.
} | ||
|
||
public MasterListener(String masterName, String host, int port, | ||
long subscribeRetryWaitTimeMillis) { | ||
this(masterName, host, port); | ||
long subscribeRetryWaitTimeMillis) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long subscribeRetryWaitTimeMillis) { | |
long subscribeRetryWaitTimeMillis) { |
This change allows connecting to sentinel via TLS. Additionally, you can specify if you want to connect to the redis master with TLS or not.
When connecting to sentinel with TLS, it will still broadcast the non-TLS ports for redis. For this scenario to work,
toHostAndPort
was modified to be protected so consumers can sub-class JedisSentinelPool and implement your own port mapping behavior.