Skip to content

Commit 00f1eb7

Browse files
authored
Merge pull request #2149 from renshuaijin/bugfix/replication-bootstrap
Fix Resolve the issue of Replication bootstrap using schemaDatabase for JDBC connection
2 parents d4ebb40 + 513b7eb commit 00f1eb7

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/main/java/com/zendesk/maxwell/bootstrap/MaxwellBootstrapUtilityConfig.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public String getConnectionURI() {
4646

4747
public String getReplicationConnectionURI( ) {
4848
try {
49-
return getConfigConnectionURI(replicationMysql);
49+
return getConfigReplicationConnectionURI(replicationMysql);
5050
} catch (URISyntaxException e) {
5151
LOGGER.error(e.getMessage(), e);
5252
throw new RuntimeException("Unable to generate bootstrap's replication jdbc connection URI", e);
@@ -65,6 +65,18 @@ private String getConfigConnectionURI(MaxwellMysqlConfig config) throws URISynta
6565
return uriBuilder.build().toString();
6666
}
6767

68+
private String getConfigReplicationConnectionURI(MaxwellMysqlConfig config) throws URISyntaxException {
69+
URIBuilder uriBuilder = new URIBuilder();
70+
uriBuilder.setScheme("jdbc:mysql");
71+
uriBuilder.setHost(config.host);
72+
uriBuilder.setPort(config.port);
73+
uriBuilder.setPath("/" + databaseName);
74+
for (Map.Entry<String, String> jdbcOption : config.jdbcOptions.entrySet()) {
75+
uriBuilder.addParameter(jdbcOption.getKey(), jdbcOption.getValue());
76+
}
77+
return uriBuilder.build().toString();
78+
}
79+
6880
protected OptionParser buildOptionParser() {
6981
OptionParser parser = new OptionParser();
7082
parser.accepts( "config", "location of config.properties file" )

0 commit comments

Comments
 (0)