-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[FLINK-38522][cdc connector mysql] use ssl for BinaryLogClient when searching for binlog offset for starting mysql cdc from timestamp #4156
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
50cf4e8
111681c
22e99b7
8aedf5f
6615f91
a9777b4
9b9d40f
b8c2863
536f467
71c82cf
9ff8808
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,6 +27,7 @@ | |||||||||||||||||||
| import com.github.shyiko.mysql.binlog.event.EventData; | ||||||||||||||||||||
| import com.github.shyiko.mysql.binlog.event.EventHeaderV4; | ||||||||||||||||||||
| import com.github.shyiko.mysql.binlog.event.RotateEventData; | ||||||||||||||||||||
| import com.github.shyiko.mysql.binlog.network.SSLMode; | ||||||||||||||||||||
| import io.debezium.config.Configuration; | ||||||||||||||||||||
| import io.debezium.connector.mysql.MySqlConnection; | ||||||||||||||||||||
| import io.debezium.connector.mysql.MySqlConnectorConfig; | ||||||||||||||||||||
|
|
@@ -242,12 +243,30 @@ private static Map<String, String> querySystemVariables( | |||||||||||||||||||
| return variables; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| static SSLMode sslModeFor(MySqlConnectorConfig.SecureConnectionMode mode) { | ||||||||||||||||||||
| switch (mode) { | ||||||||||||||||||||
| case DISABLED: | ||||||||||||||||||||
| return SSLMode.DISABLED; | ||||||||||||||||||||
| case PREFERRED: | ||||||||||||||||||||
| return SSLMode.PREFERRED; | ||||||||||||||||||||
| case REQUIRED: | ||||||||||||||||||||
| return SSLMode.REQUIRED; | ||||||||||||||||||||
| case VERIFY_CA: | ||||||||||||||||||||
| return SSLMode.VERIFY_CA; | ||||||||||||||||||||
| case VERIFY_IDENTITY: | ||||||||||||||||||||
| return SSLMode.VERIFY_IDENTITY; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| return null; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| public static BinlogOffset findBinlogOffset( | ||||||||||||||||||||
| long targetMs, MySqlConnection connection, MySqlSourceConfig mySqlSourceConfig) { | ||||||||||||||||||||
| MySqlConnection.MySqlConnectionConfiguration config = connection.connectionConfig(); | ||||||||||||||||||||
| BinaryLogClient client = | ||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can centralize the SSL configuration in the DebeziumUtils#createBinaryClient method, Line 96 in 001cba0
and based on the implementation of MySqlStreamingChangeEventSource, we also need to add the following code to set SslSocketFactory: Lines 224 to 231 in 001cba0
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review and recommendation @lvyanquan !
|
||||||||||||||||||||
| new BinaryLogClient( | ||||||||||||||||||||
| config.hostname(), config.port(), config.username(), config.password()); | ||||||||||||||||||||
| client.setSSLMode(sslModeFor(config.sslMode())); | ||||||||||||||||||||
watsonjo737 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| if (mySqlSourceConfig.getServerIdRange() != null) { | ||||||||||||||||||||
| client.setServerId(mySqlSourceConfig.getServerIdRange().getStartServerId()); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.