jeecg-sharding-multi.yaml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. spring:
  2. shardingsphere:
  3. datasource:
  4. names: ds0,ds1
  5. ds0:
  6. driverClassName: com.mysql.cj.jdbc.Driver
  7. url: jdbc:mysql://jeecg-boot-mysql:3306/jeecg-boot?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
  8. type: com.alibaba.druid.pool.DruidDataSource
  9. username: root
  10. password: root
  11. ds1:
  12. driverClassName: com.mysql.cj.jdbc.Driver
  13. url: jdbc:mysql://jeecg-boot-mysql:3306/jeecg-boot2?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
  14. type: com.alibaba.druid.pool.DruidDataSource
  15. username: root
  16. password: root
  17. props:
  18. sql-show: true
  19. rules:
  20. replica-query:
  21. load-balancers:
  22. round-robin:
  23. type: ROUND_ROBIN
  24. props:
  25. default: 0
  26. data-sources:
  27. prds:
  28. primary-data-source-name: ds0
  29. replica-data-source-names: ds1
  30. load-balancer-name: round_robin
  31. sharding:
  32. binding-tables:
  33. - sys_log
  34. key-generators:
  35. snowflake:
  36. type: SNOWFLAKE
  37. props:
  38. worker-id: 123
  39. sharding-algorithms:
  40. table-classbased:
  41. props:
  42. strategy: standard
  43. algorithmClassName: org.jeecg.modules.test.sharding.algorithm.StandardModTableShardAlgorithm
  44. type: CLASS_BASED
  45. database-inline:
  46. type: INLINE
  47. props:
  48. algorithm-expression: ds$->{operate_type % 2}
  49. tables:
  50. sys_log:
  51. actual-data-nodes: ds$->{0..1}.sys_log$->{0..1}
  52. database-strategy:
  53. standard:
  54. sharding-column: operate_type
  55. sharding-algorithm-name: database-inline
  56. table-strategy:
  57. standard:
  58. sharding-algorithm-name: table-classbased
  59. sharding-column: log_type