Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ notes:
iamNeedsInitialConn: "Requires the {plugin:initialConnection} plugin. A global endpoint carries no region and points at the current primary cluster, so it must be resolved to the writer instance before the IAM token is generated."
# ✅-cell notes for IP-address / custom-domain (CNAME) endpoints, which the wrapper
# cannot recognize as RDS endpoints. Each states the exact parameter(s) to set.
failoverNeedsHostPattern: "Supported, but the wrapper cannot recognize an IP address or custom domain as an RDS endpoint, so set `cluster_instance_host_pattern` (using `?` as the instance-identifier placeholder) so topology can build per-instance endpoints; set the cluster identifier as well when using a custom domain."
failoverNeedsHostPattern: "Supported, but the wrapper cannot recognize an IP address or custom domain as an RDS endpoint, so set `cluster_instance_host_pattern` (using `?` as the instance-identifier placeholder) so topology can build per-instance endpoints; set the cluster identifier as well when using a custom domain. Without the pattern, the wrapper logs a warning when the connection opens, and failover raises `FailoverFailedError` immediately."
gdbNeedsHostPattern: "Supported, but the wrapper cannot recognize an IP address or custom domain as an RDS endpoint, so set `global_cluster_instance_host_patterns` (one region-prefixed pattern per region) and `failover_home_region` so the plugin can build per-region topology."
iamNeedsHostOverride: "Supported, but the wrapper cannot derive the token host or region from an IP address or custom domain, so set `iam_host` to a valid RDS endpoint (and `iam_region` if it cannot be parsed) so the IAM token is generated for the right host."
secretsNeedsRegion: "Supported, but the region cannot be parsed from an IP address or custom domain, so set `secret_region` (unless the secret id is an ARN, which already contains the region)."
Expand Down
25 changes: 21 additions & 4 deletions content/failover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ parameters:
spellings:
ruby:
name: cluster_instance_host_pattern
required: "If connecting using an IP address or custom domain URL: Yes<br/><br/>Otherwise: No"
required: "If connecting to an Aurora or RDS Multi-AZ DB cluster using an IP address or custom domain URL: Yes<br/><br/>Otherwise: No"
defaultNote: "auto-derived"

errors:
Expand All @@ -321,7 +321,7 @@ errors:
reusable: "No"
action: "Failover could not find a new instance. Wait until the server is available, then reconnect."
detail:
ruby: "The original connection failed, and the wrapper could not reconnect to a new instance before the failover attempt ended. Wait until the server is available, then reconnect."
ruby: "The original connection failed, and the wrapper could not reconnect to a new instance before the failover attempt ended. Wait until the server is available, then reconnect. If the message starts with `Failover is not possible` and names `cluster_instance_host_pattern`, the connection host is not a recognized RDS endpoint and the pattern is not set, so the wrapper cannot build DB instance hosts. Set `cluster_instance_host_pattern` instead of retrying."
- concept: failoverSuccess
ruby: "FailoverSuccessError"
connectionValid: "Yes"
Expand Down Expand Up @@ -386,6 +386,23 @@ enhanced:
availableSince: "1.0.0 (default plugin)"
compatibilityGuide: "./compatibility"
hostPatternParam: cluster_instance_host_pattern
hostPatternMissingNote: |
The wrapper checks for a missing pattern when a connection opens, once it has identified the
database as an Aurora or RDS Multi-AZ DB cluster. A single RDS instance or a community database behind an
IP address does not need the pattern, so it is not affected. If the connection host is not a
recognized RDS endpoint and `cluster_instance_host_pattern` is not set, the wrapper logs a warning
once per host and the connection opens. The warning names the host and the two fixes: set
`cluster_instance_host_pattern` (for example, `?.XXX.us-east-1.rds.amazonaws.com`), or remove
`failover` from `wrapper_plugins` (when `wrapper_plugins` is not set, `failover` comes from the
default plugin list).

If a failover starts in this configuration, it raises `FailoverFailedError` immediately, with the
same explanation as the warning, instead of retrying instance hosts that can't be resolved until
`failover_timeout_sec` passes.

If bare instance identifiers resolve in your environment, for example through a DNS search domain,
set `cluster_instance_host_pattern: "?"`. An explicitly set pattern turns off both the warning and
the immediate failure, so failover connects to the bare instance identifiers as before.
monitoringPrefix: "topology_monitoring_"
connectSnippet: |
require 'aws_advanced_ruby_driver_wrapper/postgresql'
Expand Down Expand Up @@ -426,10 +443,10 @@ enhanced:
spellings:
ruby:
name: cluster_instance_host_pattern
required: "Required for IP addresses and custom domains; otherwise No"
required: "Required for IP addresses and custom domains in front of an Aurora or RDS Multi-AZ DB cluster; otherwise No"
defaultNote: "auto-derived for recognizable RDS endpoints"
description:
ruby: "Pattern used to build instance endpoints when the connection host is not a recognizable RDS endpoint. Use `?` as the instance identifier placeholder."
ruby: "Pattern used to build instance endpoints when the connection host is not a recognizable RDS endpoint. Use `?` as the instance identifier placeholder. If the connection host is not a recognized RDS endpoint and this is not set on an Aurora or RDS Multi-AZ DB cluster, the wrapper logs a warning when the connection opens, and failover raises `FailoverFailedError` immediately. Set it to `?` if bare instance identifiers resolve in your environment. See [Host pattern](#host-pattern)."
- concept: clusterTopologyRefreshRate
type: integer
unitTrap: true
Expand Down
2 changes: 1 addition & 1 deletion content/plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1898,7 +1898,7 @@ plugins:
ruby: { name: out_of_home_failover_mode, required: "No", defaultNote: "depends on URL", example: "strict_any_reader" }
- concept: globalHostPatterns
type: string
description: "Comma-separated instance host patterns for every Global Database region. Prefix custom-domain patterns with `[region]`. Required for Aurora Global Databases; ignored otherwise."
description: "Comma-separated instance host patterns for every Global Database region. Prefix custom-domain patterns with `[region]`. Required for Aurora Global Databases, and the only host pattern they need: `cluster_instance_host_pattern` is not required. It is only read when the database is identified as a Global Database (a `global-aurora-pg` / `global-aurora-mysql` dialect). Without `wrapper_dialect`, a Global Database is only identified when it spans more than one region. If the database is identified as a regional cluster instead (for example because `wrapper_dialect` is set to `aurora-pg`), this setting is ignored and `cluster_instance_host_pattern` applies, as with the `failover` plugin. In that case, if the connection host is an IP address or custom domain and `cluster_instance_host_pattern` is not set, the wrapper logs a warning explaining that this setting does not apply, and failover raises `FailoverFailedError` immediately. For a Global Database, set `wrapper_dialect` to a `global-aurora-*` dialect and keep this setting; for a standalone cluster, use the `failover` plugin with `cluster_instance_host_pattern`."
spellings:
ruby: { name: global_cluster_instance_host_patterns, required: "Yes for Global Databases; otherwise No", defaultNote: "none", example: "?.xyz1.us-east-1.rds.amazonaws.com,?.xyz2.us-west-1.rds.amazonaws.com" }
- concept: accessibleRegions
Expand Down
4 changes: 4 additions & 0 deletions content/templates/enhanced-failover.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ In addition to parameters for the underlying database driver, configure the foll
### Host pattern

When connecting through an IP address, CNAME, custom domain, or another endpoint that does not contain a recognizable RDS instance pattern, set `{{ enhanced.wrappers[wrapper_id].hostPatternParam }}`. Use `?` as the placeholder for the DB instance identifier. For example, if instance endpoints follow `instanceIdentifier.customHost`, use `?.customHost` as the pattern. The wrapper uses this pattern to build per-instance endpoints while it discovers topology.
{% if enhanced.wrappers[wrapper_id].hostPatternMissingNote %}

{{ enhanced.wrappers[wrapper_id].hostPatternMissingNote }}
{%- endif %}

:::warning
When using a CNAME or custom domain, set both the instance host pattern and the cluster identifier. Without the pattern, topology discovery cannot construct resolvable per-instance hostnames.
Expand Down
2 changes: 1 addition & 1 deletion site/docs-ruby/compatibility/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Legend: ✅ compatible · ❌ not compatible · a numbered footnote `[^n]` links

[^3]: Aurora Limitless shard groups manage their own routing; the failover plugin does not operate on the Limitless shard-group endpoint.

[^4]: Supported, but the wrapper cannot recognize an IP address or custom domain as an RDS endpoint, so set `cluster_instance_host_pattern` (using `?` as the instance-identifier placeholder) so topology can build per-instance endpoints; set the cluster identifier as well when using a custom domain.
[^4]: Supported, but the wrapper cannot recognize an IP address or custom domain as an RDS endpoint, so set `cluster_instance_host_pattern` (using `?` as the instance-identifier placeholder) so topology can build per-instance endpoints; set the cluster identifier as well when using a custom domain. Without the pattern, the wrapper logs a warning when the connection opens, and failover raises `FailoverFailedError` immediately.

[^5]: Aurora Limitless shard groups manage their own routing; the global database failover plugin does not operate on the Limitless shard-group endpoint.

Expand Down
21 changes: 19 additions & 2 deletions site/docs-ruby/enhanced-failover.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ In addition to parameters for the underlying database driver, configure the foll
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `failover_mode` | String | No | depends on URL | Defines the target role during failover: `strict_writer`, `reader_or_writer`, or `strict_reader`. A read-only cluster endpoint defaults to `reader_or_writer`; other URLs default to `strict_writer`. |
| `cluster_instance_host_pattern` | String | Required for IP addresses and custom domains; otherwise No | auto-derived for recognizable RDS endpoints | Pattern used to build instance endpoints when the connection host is not a recognizable RDS endpoint. Use `?` as the instance identifier placeholder. |
| `cluster_instance_host_pattern` | String | Required for IP addresses and custom domains in front of an Aurora or RDS Multi-AZ DB cluster; otherwise No | auto-derived for recognizable RDS endpoints | Pattern used to build instance endpoints when the connection host is not a recognizable RDS endpoint. Use `?` as the instance identifier placeholder. If the connection host is not a recognized RDS endpoint and this is not set on an Aurora or RDS Multi-AZ DB cluster, the wrapper logs a warning when the connection opens, and failover raises `FailoverFailedError` immediately. Set it to `?` if bare instance identifiers resolve in your environment. See [Host pattern](#host-pattern). |
| `cluster_topology_refresh_rate_sec` | Float | No | `5.0` | Regular interval at which the topology monitor refreshes the cluster when it is stable. *(sec)* |
| `failover_timeout_sec` | Float | No | `300.0` | Maximum time allowed to reconnect to a new writer or reader after failover starts. *(sec)* |
| `cluster_topology_high_refresh_rate_sec` | Float | No | `0.1` | Interval between topology updates during the high-rate period after a new writer is detected. *(sec)* |
Expand All @@ -167,6 +167,23 @@ In addition to parameters for the underlying database driver, configure the foll

When connecting through an IP address, CNAME, custom domain, or another endpoint that does not contain a recognizable RDS instance pattern, set `cluster_instance_host_pattern`. Use `?` as the placeholder for the DB instance identifier. For example, if instance endpoints follow `instanceIdentifier.customHost`, use `?.customHost` as the pattern. The wrapper uses this pattern to build per-instance endpoints while it discovers topology.

The wrapper checks for a missing pattern when a connection opens, once it has identified the
database as an Aurora or RDS Multi-AZ DB cluster. A single RDS instance or a community database behind an
IP address does not need the pattern, so it is not affected. If the connection host is not a
recognized RDS endpoint and `cluster_instance_host_pattern` is not set, the wrapper logs a warning
once per host and the connection opens. The warning names the host and the two fixes: set
`cluster_instance_host_pattern` (for example, `?.XXX.us-east-1.rds.amazonaws.com`), or remove
`failover` from `wrapper_plugins` (when `wrapper_plugins` is not set, `failover` comes from the
default plugin list).

If a failover starts in this configuration, it raises `FailoverFailedError` immediately, with the
same explanation as the warning, instead of retrying instance hosts that can't be resolved until
`failover_timeout_sec` passes.

If bare instance identifiers resolve in your environment, for example through a DNS search domain,
set `cluster_instance_host_pattern: "?"`. An explicitly set pattern turns off both the warning and
the immediate failure, so failover connects to the bare instance identifiers as before.

:::warning
When using a CNAME or custom domain, set both the instance host pattern and the cluster identifier. Without the pattern, topology discovery cannot construct resolvable per-instance hostnames.
:::
Expand Down Expand Up @@ -206,7 +223,7 @@ a specific **error class**.

### FailoverFailedError

The original connection failed, and the wrapper could not reconnect to a new instance before the failover attempt ended. Wait until the server is available, then reconnect.
The original connection failed, and the wrapper could not reconnect to a new instance before the failover attempt ended. Wait until the server is available, then reconnect. If the message starts with `Failover is not possible` and names `cluster_instance_host_pattern`, the connection host is not a recognized RDS endpoint and the pattern is not set, so the wrapper cannot build DB instance hosts. Set `cluster_instance_host_pattern` instead of retrying.

### FailoverSuccessError

Expand Down
2 changes: 1 addition & 1 deletion site/docs-ruby/using-plugins/gdb-failover.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Verify plugin compatibility within your Ruby configuration using the [compatibil
| `failover_home_region` | String | Yes for endpoints with no region; otherwise No | parsed from URL | The AWS region the application runs in. Determines which of the in-home and out-of-home modes applies. Defaults to the region parsed from the connection endpoint, and is required when the endpoint carries no region (a Global Database endpoint, an IP address, or a custom domain).<br/><br/>Example: `us-west-1` |
| `in_home_failover_mode` | String | No | depends on URL | Failover mode used while the Global Database primary region **is** the home region. Values include `strict_writer`, `home_reader_or_writer`, `strict_home_reader`, `strict_out_of_home_reader`, `strict_any_reader`, `out_of_home_reader_or_writer`, and `any_reader_or_writer`. When unset, the mode is derived from the initial connection endpoint: a writer or global writer cluster endpoint defaults to `strict_writer`, and any other endpoint defaults to `home_reader_or_writer`. This plugin does not read `failover_mode`; use this parameter and `out_of_home_failover_mode` instead.<br/><br/>Example: `strict_writer` |
| `out_of_home_failover_mode` | String | No | depends on URL | Failover mode used while the Global Database primary region **is not** the home region. Accepts the same values as the in-home mode. When unset, it is derived from the initial endpoint the same way as the in-home mode: a writer or global writer cluster endpoint defaults to `strict_writer`, and any other endpoint defaults to `home_reader_or_writer`.<br/><br/>Example: `strict_any_reader` |
| `global_cluster_instance_host_patterns` | String | Yes for Global Databases; otherwise No | none | Comma-separated instance host patterns for every Global Database region. Prefix custom-domain patterns with `[region]`. Required for Aurora Global Databases; ignored otherwise.<br/><br/>Example: `?.xyz1.us-east-1.rds.amazonaws.com,?.xyz2.us-west-1.rds.amazonaws.com` |
| `global_cluster_instance_host_patterns` | String | Yes for Global Databases; otherwise No | none | Comma-separated instance host patterns for every Global Database region. Prefix custom-domain patterns with `[region]`. Required for Aurora Global Databases, and the only host pattern they need: `cluster_instance_host_pattern` is not required. It is only read when the database is identified as a Global Database (a `global-aurora-pg` / `global-aurora-mysql` dialect). Without `wrapper_dialect`, a Global Database is only identified when it spans more than one region. If the database is identified as a regional cluster instead (for example because `wrapper_dialect` is set to `aurora-pg`), this setting is ignored and `cluster_instance_host_pattern` applies, as with the `failover` plugin. In that case, if the connection host is an IP address or custom domain and `cluster_instance_host_pattern` is not set, the wrapper logs a warning explaining that this setting does not apply, and failover raises `FailoverFailedError` immediately. For a Global Database, set `wrapper_dialect` to a `global-aurora-*` dialect and keep this setting; for a standalone cluster, use the `failover` plugin with `cluster_instance_host_pattern`.<br/><br/>Example: `?.xyz1.us-east-1.rds.amazonaws.com,?.xyz2.us-west-1.rds.amazonaws.com` |
| `accessible_regions` | String | No | all regions | Comma-separated list of AWS regions the application can reach. When set, failover only considers nodes in these regions as candidates; topology monitoring still tracks every region. If the home region is also set, it must be included.<br/><br/>Example: `us-east-1,us-west-1` |
| `failover_timeout_sec` | Float | No | `300.0` | Maximum allowed time to attempt reconnecting to a new writer or reader instance after a cluster failover is initiated. *(sec)*<br/><br/>Example: `300.0` |
| `cluster_topology_refresh_rate_sec` | Float | No | `5.0` | Cluster topology refresh rate while the cluster is not in failover (the regular slow monitoring rate). *(sec)*<br/><br/>Example: `5.0` |
Expand Down