Troubleshooting database cluster groups for Aurora
Each member cluster of a database cluster group for Aurora is an Aurora DB cluster that you troubleshoot with your existing tools, on a direct connection to that member cluster. A group adds one step: link what the application sees at the routing endpoint to the member cluster and instance that ran the work. After that, use standard Aurora troubleshooting. For more information, see Troubleshooting for Amazon Aurora and Troubleshooting Amazon Aurora MySQL database performance.
Collect the facts in Before you start: what to collect, and then trace an affected session with Tracing a session or statement across the group. To go from what you see to the page that fixes it, use Find the page for your symptom. To use an error code to find its fix, see Using error codes to troubleshoot. For what each error code means, see Error codes for database cluster groups for Aurora in the reference. On each symptom page, you find the symptom, a read-only check and where it runs, the cause, and the fix.
Before you start: what to collect
Collect the following information before you change anything. The checks and AWS Support both use it.
-
The time window, in UTC
-
The error code (Aurora MySQL) and the exact statement
-
The global connection ID of an affected session at the routing endpoint, and the version that the routing layer reports
-
The group identifier, and the alias and DB cluster identifier of each member cluster
The checks are read-only. A fix might need a change, such as a restart, a mapping write, or ending a session. Each change is a separate step that you choose to run. Because the member cluster still serves your application, open each direct session on it as read-only, with statement and lock time limits. Check one member cluster at a time, and check the busiest one last. Run whole-table reads such as COUNT(*) on an Aurora clone, not on a member cluster that serves traffic.
The global connection ID is in the ID column of router_processlist. For how to find the session behind it, see Tracing a session or statement across the group.
-- Runs at: routing endpoint. The version that the routing layer reports, and the global connection IDs (ID column). SELECT VERSION(); SELECT * FROM dbclustergroup_sys.router_processlist; -- Runs at: member cluster endpoint (direct). Read-only, 60-second SELECT limit, 5-second lock waits. SET SESSION transaction_read_only = ON, max_execution_time = 60000, lock_wait_timeout = 5, innodb_lock_wait_timeout = 5;
To find the member clusters, read the mapping of aliases to DB cluster identifiers at the routing endpoint. Then read each member cluster's endpoint, status, and instances in the AWS CLI or the console. For more information, see Connecting to an Amazon Aurora DB cluster. The table doesn't accept ORDER BY, so read the whole table and sort it in your client.
-- Runs at: routing endpoint. Read the whole table; sort and filter in your client. SELECT * FROM dbclustergroup_sys.member_cluster_mappings;
Use the alias in SQL at the routing endpoint, and the DB cluster identifier with the AWS CLI and CloudWatch. They can differ.
The group publishes CloudWatch metrics for the group, the routing layer, and each member cluster. To watch the path through the routing layer, use these metrics with the routing layer's process list and your application's metrics. For more information, see Monitoring database cluster groups for Aurora.
Checking the group's setup
When routed statements don't behave as you expect, for example right after you set up routing, check the setup in the order of the following table. Each check is read-only. Run the first check in the AWS CLI, and the other checks at the routing endpoint. Read the member cluster aliases first, and then the data mappings that name them. If a later check gives an unexpected result, run the alias check again.
| Check | Read (where it runs) | How to read the result |
|---|---|---|
| Member clusters | describe-db-cluster-groups (AWS CLI) |
Every cluster that you added appears as a member. |
| Member cluster aliases | SELECT * FROM dbclustergroup_sys.member_cluster_mappings; (routing endpoint) |
Note each member_cluster_alias. A data mapping can name only an alias that this table lists, so an empty result blocks every later check. |
| Data mappings | SELECT * FROM dbclustergroup_sys.data_mappings; (routing endpoint) |
Compare each row's cluster_db_name and cluster_table_name with the tables on that member cluster. A row whose collocation the routing function doesn't cover reaches no member cluster. |
| A routed read | A SELECT on a mapped table, or on a scaleout table with a routing key value (routing endpoint) |
Rows and an empty result both mean that the statement routed. A SELECT 1 proves only the sign-in, because the routing layer answers it itself. |
| Your application | The application's first statements (routing endpoint) | A permission error on a first statement means that the member cluster user is missing on that member cluster, or lacks a privilege. See Sign-in is refused. |
If a check fails, find the symptom in Find the page for your symptom.
Find the page for your symptom
Find your symptom in the following table, and then read its entry. Where an error code identifies the symptom, the table gives the Aurora MySQL error number.
| What you see | See |
|---|---|
A client can't connect, connecting is slow, a connection drops, or a connection waits at a limit: Aurora MySQL 2003, 2002, or 2013 |
Connecting fails, is slow, or drops |
A connection or sign-in without TLS fails: Aurora MySQL 3159, 1045, or 2061 |
A sign-in without TLS fails |
A sign-in is refused, or the first statement after sign-in is refused: Aurora MySQL 1045, 3118, or 2013 at sign-in |
Sign-in is refused |
| You have an error code and want its meaning | Error codes for database cluster groups for Aurora for its meaning, and Using error codes to troubleshoot for its fix |
Routed statements for one member cluster fail, but direct connections to it work, including right after you add a data mapping or a scaleout table: Aurora MySQL 1429, 1105, or 1053 |
A member cluster is unreachable through the routing endpoint |
| Every client stalls at once, or latency rises everywhere | Every client stalls or slows down |
A statement is slow, runs too long, or waits on a lock, or an idle session holds locks: Aurora MySQL 1205 or 1317 |
Troubleshooting slow queries, long-running statements, and lock waits |
| One member cluster is much busier than the others | Troubleshooting uneven load across member clusters |
A statement is refused and doesn't run, for example because it reaches more than one member cluster: Aurora MySQL 1235 |
A statement is refused |
No rows, rows from an unexpected member cluster, or a retryable error after a mapping change: Aurora MySQL 1412 or 63928 |
Wrong rows, or rows from an unexpected member cluster |
A session setting, a variable, or a session pin behaves differently through the routing endpoint: Aurora MySQL 1179 |
A session behaves differently through the routing endpoint |
A data movement job stays in one phase, ends in Error, or is refused, or a read or write fails during its cutover: error 63927 |
A move is stuck or failed |
A schema change reached some member clusters and not others: Aurora MySQL 1146 or 1054 |
A schema change is half done |
| An upgrade or a restore is refused, or a restore doesn't return what you expect | An upgrade or restore problem |
Using error codes to troubleshoot
An error from the routing endpoint carries a MySQL error number. Match an error by its code and by the statement that you sent, not by the text alone, because one code covers several causes. In your application, handle errors by code, not by message text.
An error reaches your client through the routing endpoint from one of two places:
-
The routing layer. It refused the statement, or couldn't route it or deliver it. The pages in Error codes for database cluster groups for Aurora list these errors with their exact message texts and causes.
-
A member cluster. The routing layer sent the statement to a member cluster, and the member cluster returned the error with its own code and text. To find the member cluster and the statement, trace the session as described in Tracing a session or statement across the group. Then troubleshoot the error on that member cluster as you do on any Aurora DB cluster.
On Aurora MySQL, the protocol doesn't mark an error as coming from the routing layer. An error packet carries only the error number, the SQLSTATE, and the message, with no routing-layer marker. Tell a routing-layer error from a member cluster error that has the same code by the code together with the statement that you sent, or by tracing the session (Tracing a session or statement across the group), not by a marker.
Aurora MySQL error 1235 means that the routing layer refused the statement and ran it on no member cluster. Don't retry the statement unchanged, because it returns the same error. Change the statement, or run it on a pinned session or a direct connection to the member cluster. For the statements that the routing layer refuses, see A statement is refused.
On Aurora MySQL, some errors inside a transaction end only the statement, and the transaction stays open. For example, error 1235 for a statement that reaches a second member cluster, and error 1146, leave the transaction open. Run ROLLBACK, not COMMIT, because a COMMIT commits the statements that ran before the error. Then fix the cause, and retry the whole transaction.
By contrast, error 63928 (SQLSTATE 40001) means the routing layer has already rolled the whole transaction back, because a mapping changed after the transaction's first routed statement. Don't send COMMIT. Retry the whole transaction from its first statement. If the session holds server-side prepared statements, the routing layer closes the connection instead, so reconnect and run the whole transaction again. For the full retry rule, see Transaction errors and retries.
For what to retry after each kind of error, see Retrying after an error. For an error that you can't explain, give AWS Support the exact statement and the version that the routing layer reports. On Aurora MySQL, read the version with SELECT VERSION(); at the routing endpoint.
To find the fix for an error, find its family in the following table. Read the meaning of the error on its error-code page, and then find its fix on the troubleshooting page.
| Error family | Message and cause (reference) | What to do (troubleshooting) |
|---|---|---|
| Connection and sign-in | Connection and sign-in errors | Fixing connection and sign-in errors by code |
| Routing and data mappings | Routing and data mapping errors | Fixing routing and data mapping errors |
| Scaleout tables and routing functions | Scaleout table and routing function errors | Fixing scaleout table and routing function errors |
| Data movement and group limits | Data movement errors | Fixing data movement and group limit errors by code |
| Sessions, pins, and transactions | Session and transaction errors | Fixing session and transaction errors |