Skip to content

Commit

Permalink
Merge pull request #1682 from m-martinez/fix-bootstrap-replication-jdbc
Browse files Browse the repository at this point in the history
Use replication JDBC options in bootstrap utility
  • Loading branch information
osheroff committed Jun 2, 2021
2 parents 9696775 + c56aab5 commit ace174e
Showing 1 changed file with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,33 @@ public MaxwellBootstrapUtilityConfig(String argv[]) {


public String getConnectionURI() {
URIBuilder uriBuilder = new URIBuilder();
uriBuilder.setScheme("jdbc:mysql");
uriBuilder.setHost(mysql.host);
uriBuilder.setPort(mysql.port);
uriBuilder.setPath("/" + schemaDatabaseName);
for (Map.Entry<String, String> jdbcOption : mysql.jdbcOptions.entrySet()) {
uriBuilder.addParameter(jdbcOption.getKey(), jdbcOption.getValue());
}
try {
return uriBuilder.build().toString();
return getConfigConnectionURI(mysql);
} catch (URISyntaxException e) {
LOGGER.error(e.getMessage(), e);
throw new RuntimeException("Unable to generate bootstrap's jdbc connection URI", e);
}
}

public String getReplicationConnectionURI( ) {
return "jdbc:mysql://" + replicationMysql.host + ":" + replicationMysql.port;
try {
return getConfigConnectionURI(replicationMysql);
} catch (URISyntaxException e) {
LOGGER.error(e.getMessage(), e);
throw new RuntimeException("Unable to generate bootstrap's replication jdbc connection URI", e);
}
}

private String getConfigConnectionURI(MaxwellMysqlConfig config) throws URISyntaxException {
URIBuilder uriBuilder = new URIBuilder();
uriBuilder.setScheme("jdbc:mysql");
uriBuilder.setHost(config.host);
uriBuilder.setPort(config.port);
uriBuilder.setPath("/" + schemaDatabaseName);
for (Map.Entry<String, String> jdbcOption : config.jdbcOptions.entrySet()) {
uriBuilder.addParameter(jdbcOption.getKey(), jdbcOption.getValue());
}
return uriBuilder.build().toString();
}

protected OptionParser buildOptionParser() {
Expand Down

0 comments on commit ace174e

Please sign in to comment.