mirror of
https://github.com/open-metadata/OpenMetadata
synced 2026-05-24 09:39:11 +00:00
Fix aurora driver settings
This commit is contained in:
parent
3da48dc2da
commit
d959976b1c
2 changed files with 56 additions and 3 deletions
|
|
@ -243,6 +243,30 @@ database:
|
|||
rewriteBatchedStatements: ${DB_MYSQL_REWRITE_BATCHED_STATEMENTS:-true} # Critical for MySQL batch
|
||||
cachePrepStmts: ${DB_MYSQL_CACHE_PREP_STMTS:-true}
|
||||
prepStmtCacheSize: ${DB_MYSQL_PREP_STMT_CACHE_SIZE:-500}
|
||||
|
||||
# AWS JDBC Driver specific properties for Aurora - these are ignored by other drivers
|
||||
wrapperPlugins: ${DB_AWS_WRAPPER_PLUGINS:-readWriteSplitting,failover,efm2}
|
||||
wrapperLoggerLevel: ${DB_AWS_WRAPPER_LOGGER_LEVEL:-INFO}
|
||||
wrapperDialect: ${DB_AWS_WRAPPER_DIALECT:aurora-pg}
|
||||
|
||||
# Aurora cluster identification
|
||||
clusterId: ${DB_AWS_CLUSTER_ID:-}
|
||||
clusterRegion: ${DB_AWS_CLUSTER_REGION:-}
|
||||
|
||||
# Read/Write splitting configuration
|
||||
readWriteSplitting.readerAny: ${DB_AWS_RWS_READER_ANY:-true}
|
||||
readWriteSplitting.connectionPoolSize: ${DB_AWS_RWS_CONNECTION_POOL_SIZE:-10}
|
||||
readWriteSplitting.maxIdleTime: ${DB_AWS_RWS_MAX_IDLE_TIME:-300000}
|
||||
readWriteSplittingConnectionStrategy: ${DB_AWS_RWS_CONNECTION_STRATEGY:-leastConnections}
|
||||
|
||||
# Failover configuration
|
||||
failover.enableClusterAwareFailover: ${DB_AWS_FAILOVER_CLUSTER_AWARE:-true}
|
||||
failover.clusterTopologyRefreshRateMs: ${DB_AWS_FAILOVER_TOPOLOGY_REFRESH_MS:-30000}
|
||||
failover.readerFailoverTimeoutMs: ${DB_AWS_FAILOVER_READER_TIMEOUT_MS:-30000}
|
||||
|
||||
# Enhanced Failure Monitoring
|
||||
efm2.enable: ${DB_AWS_EFM_ENABLE:-true}
|
||||
efm2.monitoringIntervalMs: ${DB_AWS_EFM_MONITORING_INTERVAL_MS:-5000}
|
||||
prepStmtCacheSqlLimit: ${DB_MYSQL_PREP_STMT_CACHE_SQL_LIMIT:-2048}
|
||||
useServerPrepStmts: ${DB_MYSQL_USE_SERVER_PREP_STMTS:-true}
|
||||
useLocalSessionState: ${DB_MYSQL_USE_LOCAL_SESSION_STATE:-true}
|
||||
|
|
|
|||
|
|
@ -238,17 +238,46 @@ public class HikariCPDataSourceFactory extends DataSourceFactory {
|
|||
private void configureAWSJDBCDriver(HikariConfig config) {
|
||||
Properties props = config.getDataSourceProperties();
|
||||
|
||||
// AWS JDBC Driver specific properties for Aurora cluster discovery
|
||||
// Set default AWS JDBC Driver properties
|
||||
props.put("wrapperPlugins", "readWriteSplitting,failover,efm2");
|
||||
props.put("wrapperLoggerLevel", "INFO");
|
||||
props.put("wrapperDialect", "aurora-pg");
|
||||
|
||||
// Override properties from configuration if present
|
||||
// Default read/write splitting configuration
|
||||
props.put("readWriteSplitting.readerAny", "true");
|
||||
props.put("readWriteSplitting.connectionPoolSize", "10");
|
||||
props.put("readWriteSplitting.maxIdleTime", "300000");
|
||||
props.put("readWriteSplittingConnectionStrategy", "leastConnections");
|
||||
|
||||
// Default failover configuration
|
||||
props.put("failover.enableClusterAwareFailover", "true");
|
||||
props.put("failover.clusterTopologyRefreshRateMs", "30000");
|
||||
props.put("failover.readerFailoverTimeoutMs", "30000");
|
||||
|
||||
// Default enhanced failure monitoring
|
||||
props.put("efm2.enable", "true");
|
||||
props.put("efm2.monitoringIntervalMs", "5000");
|
||||
|
||||
// Override with AWS-specific properties from configuration
|
||||
Map<String, String> properties = getProperties();
|
||||
if (properties != null) {
|
||||
// Only copy AWS JDBC driver specific properties
|
||||
for (Map.Entry<String, String> entry : properties.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
props.put(key, entry.getValue());
|
||||
if (key.startsWith("wrapper")
|
||||
|| key.startsWith("readWriteSplitting")
|
||||
|| key.startsWith("failover.")
|
||||
|| key.startsWith("efm2.")
|
||||
|| key.equals("clusterId")
|
||||
|| key.equals("clusterRegion")) {
|
||||
props.put(key, entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove conflicting PostgreSQL properties that prevent read replica usage
|
||||
props.remove("targetServerType");
|
||||
props.remove("loadBalanceHosts");
|
||||
}
|
||||
|
||||
private void configureMySQL(HikariConfig config) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue