tencent cloud

Accessing a Read-Only Analysis Engine
Last updated:2025-12-03 09:51:43
Accessing a Read-Only Analysis Engine
Last updated: 2025-12-03 09:51:43
When the read-only analysis engine feature is enabled, you can access read-only analysis engines from any MySQL database client/JDBC/ODBC. This document describes several common access methods.

Accessing via the Address of a Read-Only Analysis Engine

You can connect to a cluster in any of the following ways and access a read-only analysis engine via its address.
Connection Method
Description
Connecting to a cluster via DMC is easy. DMC provides database management services that integrate database/table-level operations, real-time monitoring, instance session management, SQL window, and data management.
Note:
Only the new version of DMC supports accessing read-only analysis engines. For the login address of the new version of DMC, go to the login page.
Developers using Linux CVM instances can use this connection method.
Developers using Windows CVM instances can use this connection method.

Accessing the Database via the CCN Address

For detailed operations on accessing the database via the CCN address, see Connecting Through CCN.

Accessing Through SQL Forwarding by the Database Proxy

You can use any MySQL database client to access a read-only analysis engine added to the database proxy.
You can see Enabling Database Proxy to enable the database proxy. Currently, only database proxy of version 1.3.15 and the latest version support adding read-only analysis engines. If your database proxy kernel version is earlier than 1.3.15, you cannot add read-only analysis engines to the database proxy. In this case, you can see Upgrading Kernel Minor Version of Database Proxy to upgrade the database proxy version to 1.3.15 or the latest version.
Database proxy of a version earlier than 1.4.4 only supports forwarding SQL statements to a read-only analysis engine in the database proxy for execution by using the /* to server instance ID */ syntax in Hint Syntax Usage.
Database proxy of the version 1.4.4 and later supports forwarding SQL statements to a read-only analysis engine in the database proxy for execution by using the /*to ap*/ Hint syntax. If there are multiple read-only analysis engine instances, load balancing will be performed for SQL statements according to the weight of read-only analysis engines.
Starting from version 1.4.5, the database proxy supports the unified weight management feature, which treats the read-only analysis engine and the standard read-only instances equally. SQL queries can be assigned to the analysis engine for execution based on the weight.
Note:
If the instance ID or read-only analysis engine specified in the /*to server instance ID*/ syntax and the /*to ap*/ syntax does not exist, SQL statements will be forwarded to an existing read-only instance or the read-write instance in the database proxy by default for execution.
If you use a MySQL client to access the database proxy, add the "-c" parameter to the connection parameters. Otherwise, the hint syntax added to SQL statements will not take effect.
# mysql -h172.16.0.12 -P3306 -utest -p -c -A

mysql> /* to server libradb-ins-hw0af2zi */ show databases;
+---------------------+
| Database |
+---------------------+
| INFORMATION_SCHEMA |
| Test1 |
| Test2 |
| __cdb_recycle_bin__ |
| haha |
| libra_system |
| test |
+---------------------+
7 rows in set (0.01 sec)
The /*to ap*/ syntax is supported for 1.4.4 and later versions.
mysql> select /* to ap */ * from haha.t;
+----+------+
| id | haha |
+----+------+
| 1 | 1 |
| 2 | 2 |
+----+------+
2 rows in set (0.01 sec)
The hint can be added to the middle of SQL statements.
mysql> select /* to server libradb-ins-hw0af2zi */ * from haha.t;
+----+------+
| id | haha |
+----+------+
| 1 | 1 |
| 2 | 2 |
+----+------+
2 rows in set (0.01 sec)
The hints for specifying the route and the SQL execution plan can be added at the same time
mysql> select /* to server libradb-ins-hw0af2zi */ /*+ set_var(libra_enable_late_materialization=1) */ * from haha.t;
+----+------+
| id | haha |
+----+------+
| 1 | 1 |
| 2 | 2 |
+----+------+
2 rows in set (0.01 sec)
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback