Enabling Read/Write Splitting
DDM optimizes its read/write splitting function. In earlier versions, read/write splitting is automatically enabled after read replicas are added. From this version on, read/write splitting needs to be manually enabled after read replicas are added, and you can set read weights for your primary instance and read replicas.
You can enable or disable read/write splitting based as needed.
Precautions
The DDM kernel version must be 3.1.0 or later.
Enabling Read/Write Splitting
- Log in to the DDM console.
- On the Instances page, locate the DDM instance that you want to enable read/write splitting for.
- Click the instance name and go to the Basic Information page.
- Choose Data Nodes in the left navigation pane and click Enable Read/Write Splitting.
- In the displayed dialog box, click OK.
- For an RDS for MySQL instance, enabling read/write splitting will set the read weight of the primary instance to 100. You can adjust read weights of the primary instance and its read replicas based on your service requirements.
- There may be a noticeable latency in the data because read replica data is asynchronously replicated from the primary instance.
- After read/write splitting is enabled, read queries will be distributed to the primary or a read replica based on the configured read weight. There may be a replication delay for queries distributed to the read replica. For query statements that are not in the same transaction but logically depend on the data written in the previous transaction, you can add /*+ db_type=master*/ to the query statement. This hint forcibly enables the the primary node to process the query, ensuring that the latest data written by the previous transaction can be queried.
Disabling Read/Write Splitting
- Log in to the DDM console.
- On the Instances page, locate the DDM instance that you want to disable read/write splitting for.
- Click the instance name and go to the Basic Information page.
- In the navigation pane on the left, choose Data Nodes.
- Click Disable Read/Write Splitting.
After read/write splitting is disabled, the preset weights will not work any more. Read/Write requests are processed only on the primary instance, so workloads using the primary instance may be affected.
- In the displayed dialog box, click OK.
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.
For any further questions, feel free to contact us through the chatbot.
Chatbot