|
| 1 | +# Enhanced Support for Amazon RDS Multi-AZ DB Cluster |
| 2 | + |
| 3 | +As of [v2.3.0](https://github.com/awslabs/aws-advanced-jdbc-wrapper/releases/tag/2.3.0), the AWS JDBC Driver has expanded its support for Amazon RDS Multi-AZ DB Cluster Deployment. By leveraging the topology information within the RDS Multi-AZ DB Cluster, the driver is capable of switching over the connection to a new writer node in approximately 1 second or less, given there is no replica lag during minor version upgrades or OS maintenance upgrades. |
| 4 | + |
| 5 | +## General Usage |
| 6 | + |
| 7 | +The process of using the AWS JDBC Driver with RDS Multi-AZ DB Cluster is the same as using it with an RDS Aurora cluster. All properties, configurations, functions, etc., remain consistent. Instead of connecting to a generic database endpoint, simply replace the endpoint with the Cluster Writer Endpoint provided by the RDS Multi-AZ DB Cluster. |
| 8 | + |
| 9 | +### MySQL |
| 10 | + |
| 11 | +Preparing a connection with MySQL in a Multi-AZ Cluster remains the same as before: |
| 12 | + |
| 13 | +```java |
| 14 | +Connection conn = DriverManager.getConnection("jdbc:aws-wrapper:mysql://cluster-writer-endpoint[:port]/database", props); |
| 15 | +``` |
| 16 | + |
| 17 | +### PostgreSQL |
| 18 | + |
| 19 | +The topology information is populated in Amazon RDS for PostgreSQL versions 13.12, 14.9, 15.4, or higher, starting from revision R3. Ensure you have a supported PostgreSQL version deployed. |
| 20 | + |
| 21 | +Per AWS documentation and [this blog post](https://aws.amazon.com/blogs/database/achieve-one-second-or-less-downtime-with-the-advanced-jdbc-wrapper-driver-when-upgrading-amazon-rds-multi-az-db-clusters/), the `rds_tools` extension must be manually installed using the following DDL before the topology information becomes available on target cluster: |
| 22 | + |
| 23 | +```sql |
| 24 | +CREATE EXTENSION rds_tools; |
| 25 | +``` |
| 26 | + |
| 27 | +Then, prepare the connection with: |
| 28 | + |
| 29 | +```java |
| 30 | +Connection conn = DriverManager.getConnection("jdbc:aws-wrapper:postgresql://cluster-writer-endpoint[:port]/database", props); |
| 31 | +``` |
| 32 | + |
| 33 | +## Optimizing Switchover Time |
| 34 | + |
| 35 | +Amazon RDS Multi-AZ with two readable standbys now supports minor version upgrades with 1 second of downtime. |
| 36 | + |
| 37 | +See feature announcement [here](https://aws.amazon.com/about-aws/whats-new/2023/11/amazon-rds-multi-az-two-stanbys-upgrades-downtime/). |
| 38 | + |
| 39 | +During minor version upgrades of RDS Multi-AZ DB clusters, the `failover` plugin switches the connection from the current writer to a newly upgraded reader. If minimizing downtime during switchover is critical to your application, consider adjusting the `failoverClusterTopologyRefreshRateMs` to a lower value such as 100ms, from the default 2000ms. However, be aware that this can potentially increase the workload on the database during the switchover. |
| 40 | + |
| 41 | +For more details on the `failover` plugin configuration, refer to the [Failover Configuration Guide](/docs/using-the-jdbc-driver/FailoverConfigurationGuide.md). |
| 42 | + |
| 43 | +## Examples |
| 44 | + |
| 45 | +We have created many examples in the [examples](/examples) folder demonstrating how to use the driver. |
| 46 | + |
| 47 | +For additional information, you may also refer to [this AWS blog post](https://aws.amazon.com/blogs/database/achieve-one-second-or-less-downtime-with-the-advanced-jdbc-wrapper-driver-when-upgrading-amazon-rds-multi-az-db-clusters/). |
| 48 | + |
| 49 | +## Limitations |
| 50 | + |
| 51 | +The following plugins have been tested and confirmed to work with Amazon RDS Multi-AZ DB Clusters: |
| 52 | + |
| 53 | +* [Aurora Connection Tracker Plugin](/docs/using-the-jdbc-driver/using-plugins/UsingTheAuroraConnectionTrackerPlugin.md) |
| 54 | +* [Failover Connection Plugin](/docs/using-the-jdbc-driver/using-plugins/UsingTheFailoverPlugin.md) |
| 55 | +* [Host Monitoring Connection Plugin](/docs/using-the-jdbc-driver/using-plugins/UsingTheHostMonitoringPlugin.md) |
| 56 | + |
| 57 | +The compatibility of other plugins has not been tested at this time. They may function as expected or potentially result in unhandled behavior. |
| 58 | +Use at your own discretion. |
0 commit comments