问题描述:
18年订单表分片配置:
<sharding:table-rules> <sharding:table-rule logic-table="t_trade_order" actual-data-nodes="axolotl_ds_ms_0.t_trade_order_20180${1..9},axolotl_ds_ms_0.t_trade_order_2018${10..12}" table-strategy-ref="orderTableStrategy"/> </sharding:table-rules>
19年不想在手动的修改配置文件了eg:
<sharding:table-rules> <sharding:table-rule logic-table="t_trade_order" actual-data-nodes="axolotl_ds_ms_0.t_trade_order_20180${1..9},axolotl_ds_ms_0.t_trade_order_2018${10..12}, axolotl_ds_ms_0.t_trade_order_20190${1..9},axolotl_ds_ms_0.t_trade_order_2019${10..12}" table-strategy-ref="orderTableStrategy"/> </sharding:table-rules> </sharding:sharding-rule>
请问大神,你们是如何实现的
已初步解决,接下来看下分表规则如何统一配置,就不用在2020年的时候在添加配置了。
actual.record.nodes=ds_ms_0.common_record_openaccount_${2019..2030}${(1..12).collect{t ->t.toString().padLeft(2,'0')}}