Why do I connect to a cluster endpoint when I connect to a read-only cluster endpoint? #195
-
Hi During the Maria jdbc to aws jdbc migration, i connected read-only cluster endpoint and ran debug my jdbc url is jdbc:mysql:aws://xx-database-1.cluster-ro-xxxxx but connection host is xx.database-1.cluster-xxxxxx so, when I checked the FailoverConnectionPlugin class, I checked the part that forces 'cluster-' in the contents of 'getRdsClusterHostUrl' method. I need to separate the read cluster and writer cluster and connect them. Please answer why this is enforced as above and how to connect to a read-only cluster. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello @lteawoo You can use different URLs to connect to Aurora DB cluster nodes. If your application needs to connect to a reader node it may use either Aurora Reader Endpoint, or any Aurora Instance Endpoint (assuming that an endpoint is associated with a reader node). In either way, you application connects to a reader node. More details about Aurora endpoints is at https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Connecting.html#Aurora.Connecting.AuroraMySQL AWS JDBC Driver for MySQL can recognize different endpoints provided in a connection string and change its behaviour accordingly. The driver doesn't force a user to use any particular URL type in a connection string. The function that you mentioned is used for detecting/recognizing a particular Aurora endpoint, not forcing it. More details can be found at https://github.com/awslabs/aws-mysql-jdbc#connection-url-descriptions |
Beta Was this translation helpful? Give feedback.
Hello @lteawoo
You can use different URLs to connect to Aurora DB cluster nodes. If your application needs to connect to a reader node it may use either Aurora Reader Endpoint, or any Aurora Instance Endpoint (assuming that an endpoint is associated with a reader node). In either way, you application connects to a reader node. More details about Aurora endpoints is at https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Connecting.html#Aurora.Connecting.AuroraMySQL
and
https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Overview.Endpoints.html#Aurora.Overview.Endpoints.Types
AWS JDBC Driver for MySQL can recognize different endpoints provided in a connection…