5.0.0和之前的4.1.1配置格式上有了一定的出入,算是一个比较大的更新了,坑爹的是yml格式的配置还运行失败,properties的就可以,无语中,调试好yml的可以交流下哈。
maven:
org.apache.shardingsphere shardingsphere-jdbc-core5.0.0 org.apache.shardingsphere shardingsphere-jdbc-core-spring-boot-starter5.0.0 org.apache.shardingsphere shardingsphere-sharding-spring-boot-starter5.0.0 org.apache.shardingsphere shardingsphere-shadow-spring-boot-starter5.0.0
properties:
server.port=8081 spring.main.allow-bean-definition-overriding=true spring.shardingsphere.mode.type=Memory spring.shardingsphere.datasource.names=ds0 spring.shardingsphere.datasource.ds0.type=com.alibaba.druid.pool.DruidDataSource spring.shardingsphere.datasource.ds0.driver-class-name=com.mysql.cj.jdbc.Driver spring.shardingsphere.datasource.ds0.url=jdbc:mysql://xxxx:30037/oms?characterEncoding=UTF-8&useSSL=false&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai spring.shardingsphere.datasource.ds0.username=root spring.shardingsphere.datasource.ds0.password=xxxx spring.shardingsphere.rules.sharding.tables.t_order.actual-data-nodes=ds0.t_order$->{0..1} spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-column=order_id spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-algorithm-name=t-order-inline spring.shardingsphere.rules.sharding.tables.t_order.key-generate-strategy.column=order_id spring.shardingsphere.rules.sharding.tables.t_order.key-generate-strategy.key-generator-name=orderSnowflake spring.shardingsphere.rules.sharding.tables.t_order_item.actual-data-nodes=ds0.t_order_item$->{0..1} spring.shardingsphere.rules.sharding.tables.t_order_item.table-strategy.standard.sharding-column=order_id spring.shardingsphere.rules.sharding.tables.t_order_item.table-strategy.standard.sharding-algorithm-name=t-order-item-inline spring.shardingsphere.rules.sharding.tables.t_order_item.key-generate-strategy.column=id spring.shardingsphere.rules.sharding.tables.t_order_item.key-generate-strategy.key-generator-name=orderItemSnowflake spring.shardingsphere.rules.sharding.binding-tables[0]=t_order,t_order_item #spring.shardingsphere.rules.sharding.broadcast-tables=t_address spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-inline.type=INLINE spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-inline.props.algorithm-expression=t_order$->{order_id % 2} spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-item-inline.type=INLINE spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-item-inline.props.algorithm-expression=t_order_item$->{order_id % 2} spring.shardingsphere.rules.sharding.key-generators.orderSnowflake.type=SNOWFLAKE spring.shardingsphere.rules.sharding.key-generators.orderSnowflake.props.worker-id=${workerId} spring.shardingsphere.rules.sharding.key-generators.orderSnowflake.props.max.vibration.offset=1 spring.shardingsphere.rules.sharding.key-generators.orderItemSnowflake.type=SNOWFLAKE spring.shardingsphere.rules.sharding.key-generators.orderItemSnowflake.props.worker-id=${workerId} spring.shardingsphere.rules.sharding.key-generators.orderItemSnowflake.props.max.vibration.offset=1 spring.shardingsphere.props.sql-show=true #spring.shardingsphere.props.sql-simple=true context.listener.classes=com.example.skywalkingtest.customerListener.ConfigApplicationListener mybatis-plus.type-aliases-package=com.example.skywalkingtest.po mybatis-plus.mapper-locations=classpath*:com/example/skywalkingtest/mapper/xml/*Mapper.xml mybatis-plus.configuration.map-underscore-to-camel-case=true mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
分片表达式的配置方式改变了,仔细看下配置,自定义算法也有一定改变,使用时要自己看看,有坑,慎踩。对于inline分片的code部分可以不做改动,已测试过,运行正常,代码前面有,想看往前翻 inline分片。
后续有时间在继续交流~~~
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)