When you use read/write splitting or high-concurrency read workloads, connect your application through a database proxy endpoint instead of directly to the primary instance. The proxy distributes incoming requests across the primary instance and read-only instances based on the read/write attributes and read weight configured for each proxy endpoint.
This topic describes how to find your proxy endpoint and use it to connect to ApsaraDB RDS for MySQL.
Prerequisites
Before you begin, ensure that you have:
-
Database proxy enabled on your ApsaraDB RDS for MySQL instance. For more information, see Enable the database proxy feature
Find the proxy endpoint and port
Two pages in the ApsaraDB RDS console display the proxy endpoint and port. Use the Database Proxy page if you also need to modify endpoint settings or apply for a public endpoint.
Via the Database Proxy page
-
Log on to the ApsaraDB RDS console. In the top navigation bar, select the region where your instance resides, then click the instance ID.
-
In the left-side navigation pane, click Database Proxy.
-
In the Connection Information section, note the proxy endpoint address and port.
To modify the endpoint prefix or port, or to apply for a public endpoint, see Manage database proxy endpoints. To configure read/write splitting rules and read weight, see Configure the connection settings for a database proxy endpoint.
Via the Database Connection page
-
Log on to the ApsaraDB RDS console. In the top navigation bar, select the region where your instance resides, then click the instance ID.
-
In the left-side navigation pane, click Database Connection.
-
In the Database Connection section, note the proxy endpoint address and port.
-
The Database Connection page supports modifying the proxy endpoint prefix, port, and public endpoint. For full endpoint management, go to the Database Proxy page. See Manage the dedicated proxy endpoints and Configure the connection settings for a database proxy endpoint.
Connect to your instance
After you obtain the proxy endpoint and port, connect to your ApsaraDB RDS for MySQL instance using any of the following methods.
| Method | Best for |
|---|---|
| Client or CLI | Ad-hoc queries, database administration tools (e.g., MySQL Workbench, mysql CLI) |
| Application code | Production applications using connection strings or SDKs |
The internal proxy endpoint cannot be used to connect from the Data Management (DMS) console. Use a client, CLI, or application instead.
What's next
API reference
| Operation | Description |
|---|---|
| DescribeDBProxy | Queries the details about the database proxy of an instance |
| DescribeDBProxyEndpoint | Queries the database proxy endpoint of an instance |
| ModifyDBProxyEndpoint | Modifies the connection settings for a database proxy endpoint of an instance |