SpringBoot+Mybayis+ShardingJDBC实现分库分表,动态切换数据库

 摘自:https://blog.csdn.net/mianyao1004/article/details/104662018/

 

 

这几天一直在搞分库分表,由于使用场景特殊,一直搞不定,记录一下,sharding官方文档特别全,其实这个文档就够了。

ShardingSphere官网:https://shardingsphere.apache.org/document/current/cn/overview/

配置说明:https://shardingsphere.apache.org/document/current/cn/manual/sharding-jdbc/configuration/

官网配置:https://shardingsphere.apache.org/document/current/cn/manual/sharding-jdbc/configuration/config-spring-boot/

GitHub地址:https://github.com/apache/incubator-shardingsphere

官方实例:https://github.com/geomonlin/incubator-shardingsphere-example

ShardingJDBC的几个例子:

https://www.liangzl.com/get-article-detail-163740.html

https://www.jianshu.com/p/3b2ab87b0de7

注意点:

1.分表规则需要配置tableRuleConfigs,而tableRuleConfigs需要配置分库规则,一定要配置分库规则,一定要!一定要!

2.一个数据源分库分表,另一个没有,貌似需要配置mybatis,不然有问题。

3.看官方文档真的够了!!!别把时间浪费在其他博客上。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章