Updated on 2024-04-03 GMT+08:00
Routing Read Requests to the Primary Node
- If there are SELECT statements in transactions, the transaction requests are routed to the primary node. If SET AUTOCOMMIT=0 is added before a SELECT statement, the transaction requests are routed to the primary node.
- If all read replicas are abnormal or the read weights allocated to the read replicas are 0, requests will be routed to the primary node. You can set read weights allocated to read replicas and primary node after read/write splitting is enabled.
- During the execution of SQL statements:
- If multi-statements (for example, insert xxx;select xxx) are executed, all subsequent requests will be routed to the primary node. To restore the read/write splitting function, disconnect the connection from your applications and establish a connection again.
- Read operations with locks (for example, SELECT for UPDATE) will be routed to the primary node.
- When /*FORCE_MASTER*/ is used, requests will be routed to the primary node.
- If the HANDLER statement is executed, all subsequent requests will be routed to the primary node by default. To restore read/write splitting, disconnect the connection and reestablish a connection.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot