zjcnb commented on issue #12426:
URL:
https://github.com/apache/shardingsphere/issues/12426#issuecomment-919085844
You can try it with this config:
```
spring.shardingsphere.datasource.names=ds2021,ds2022
spring.shardingsphere.datasource.ds2021.username=root
spring.shardingsphere.datasource.ds2021.password=123456
spring.shardingsphere.datasource.ds2021.url=jdbc:mysql://localhost:3306/imsinspect_2021?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
spring.shardingsphere.datasource.ds2021.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.ds2021.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.ds2022.username=root
spring.shardingsphere.datasource.ds2022.password=123456
spring.shardingsphere.datasource.ds2022.url=jdbc:mysql://localhost:3306/imsinspect_2022?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
spring.shardingsphere.datasource.ds2022.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.ds2022.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-column=create_time
spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-algorithm-name=year-sharding
spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.type=INTERVAL
spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-pattern=yyyy-MM-dd
HH:mm:ss
spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-lower=2021-09-14
00:00:00
spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-upper=2022-12-31
23:59:59
spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-interval-amount=1
spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.sharding-suffix-pattern=yyyy
spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.sharding-datetime-interval-unit=YEARS
spring.shardingsphere.rules.sharding.tables.ainews_user_.table-strategy.standard.sharding-column=create_time
spring.shardingsphere.rules.sharding.tables.ainews_user_.table-strategy.standard.sharding-algorithm-name=day-sharding
spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.type=INTERVAL
spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.datetime-pattern=yyyy-MM-dd
HH:mm:ss
spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.datetime-lower=2021-09-14
00:00:00
spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.datetime-upper=2022-12-31
23:59:59
spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.datetime-interval-amount=1
spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.sharding-suffix-pattern=MMdd
spring.shardingsphere.rules.sharding.tables.ainews_user_.actual-data-nodes=ds$->{2021..2022}.ainews_user_$->{20210914..20210916}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]