You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "gg1myn (via GitHub)" <gi...@apache.org> on 2025/11/25 11:18:04 UTC

[I] Dynamic routing for new writes based on shard health status ## Question [shardingsphere]

gg1myn opened a new issue, #37179:
URL: https://github.com/apache/shardingsphere/issues/37179

   ## Question
   
   **For English only**, other languages will not accept.
   
   Before asking a question, make sure you have:
   
   - Googled your question.  Yes
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).  Yes
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview). Yes
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   ----------------------------------------------------------------------------------------------------------------
   
   **Problem:**
   
   We see a black out today if our database is down as it has single master node. We do have a innodb cluster setup but we face 2 problems:
   1. Failover takes 3-4 minutes in some cases where applications keep in retrying before becoming stable again even though failover finishes faster.
   2. Malicious config application/schema change results in downtime for complete cluster. 
   
   **Solution:** 
   We are working on a solution to improve the availability of our mysql databases. We are thinking of applying sharding to achieve this. We are exploring sharding sphere for the same. 
   
   **Proposal:**
   We will have 2 shards in a database and we want to route new writes to a single healthy cluster shard in case one of the shard cluster is down/unresponsive. The health of shards will be queries periodically and maintained in a registry. 
   The sharding key will be generated and will be appended with the information of shard id it is being written to. Identification of the shard will be dynamic at runtime based on shard health status.
   Query routing will extract this shard id from the key and will call the right shard.
   
   This dynamic routing strategy is not available out of the box in the sharding sphere and we could not find discussions on the same. We wanted to understand thoughts on this approach and pros/cons aroud it. We are thinking of extending the interfaces to implement this custom strategy for our usecase. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dynamic routing for new writes based on shard health status ## Question [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #37179:
URL: https://github.com/apache/shardingsphere/issues/37179#issuecomment-3582402839

   ##  Problem Understanding
   
     The asks split into two: (1) change shard count with automatic data redistribution; (2) have ShardingSphere sense DB high availability and auto switch / service discovery.
   
   ##  Problem Root Cause
   
     ShardingSphere is positioned as a database traffic management layer with fixed sharding-key mapping. It does not manage data redistribution, nor does it manage or sense database HA status. This is a scoped design choice, not a defect.
   
   ##  Problem Analysis
   
     - Automatic data redistribution: The community edition does not provide automatic re-sharding/rebalancing. Changing shard count requires an explicit migration/scale process (see official Data Pipeline docs: https://shardingsphere.apache.org/document/current/en/features/
       data-migration/).
     - Database HA discovery: ShardingSphere does not handle instance health or failover; that’s handled by the database’s own HA (e.g., MySQL GR/primary-standby) or external components. ShardingSphere focuses on rule-driven routing/traffic governance and keeps HA detection
       and write drift out of scope for lightness.
     - If you need both automatic redistribution and HA sensing together, consider SphereEx DBPlusEngine (built on ShardingSphere) which claims to implement both. Website: https://www.sphere-ex.com/.
   
   ##  Problem Conclusion
   
     This is an out-of-scope feature request, not a known bug. ShardingSphere keeps fixed sharding mapping and a lightweight scope, so it will not add automatic data redistribution or built-in DB HA detection/switching. If you need these:
   
         1. Use the database’s HA for failover;
         2. Use external data migration for shard changes;
         3. Or evaluate SphereEx DBPlusEngine for integrated support.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dynamic routing for new writes based on shard health status ## Question [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #37179: Dynamic routing for new writes based on shard health status


## Question
URL: https://github.com/apache/shardingsphere/issues/37179


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dynamic routing for new writes based on shard health status ## Question [shardingsphere]

Posted by "gg1myn (via GitHub)" <gi...@apache.org>.
gg1myn commented on issue #37179:
URL: https://github.com/apache/shardingsphere/issues/37179#issuecomment-3589345774

   Thank you for providing the comprehensive details and resources. We will go through this information to finalize our selection.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dynamic routing for new writes based on shard health status ## Question [shardingsphere]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #37179:
URL: https://github.com/apache/shardingsphere/issues/37179#issuecomment-3618905497

   There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org