sharding.yaml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. dataSources:
  2. cpp:
  3. dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
  4. driverClassName: com.mysql.cj.jdbc.Driver
  5. url: jdbc:mysql://192.168.1.205:3306/cpp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
  6. username: root
  7. password: '!QAZ2root'
  8. # 初始连接数
  9. initialSize: 5
  10. # 最小连接池数量
  11. minIdle: 10
  12. # 最大连接池数量
  13. maxActive: 20
  14. # 配置获取连接等待超时的时间
  15. maxWait: 60000
  16. # 配置连接超时时间
  17. connectTimeout: 30000
  18. # 配置网络超时时间
  19. socketTimeout: 60000
  20. # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
  21. timeBetweenEvictionRunsMillis: 60000
  22. # 配置一个连接在池中最小生存的时间,单位是毫秒
  23. minEvictableIdleTimeMillis: 300000
  24. # 配置一个连接在池中最大生存的时间,单位是毫秒
  25. maxEvictableIdleTimeMillis: 900000
  26. # 配置检测连接是否有效
  27. validationQuery: SELECT 1 FROM DUAL
  28. testWhileIdle: true
  29. testOnBorrow: false
  30. testOnReturn: false
  31. webStatFilter:
  32. enabled: true
  33. statViewServlet:
  34. enabled: true
  35. # 设置白名单,不填则允许所有访问
  36. allow:
  37. url-pattern: /druid/*
  38. # 控制台管理用户名和密码
  39. login-username: ruoyi
  40. login-password: 123456
  41. filter:
  42. stat:
  43. enabled: true
  44. # 慢SQL记录
  45. log-slow-sql: true
  46. slow-sql-millis: 1000
  47. merge-sql: true
  48. wall:
  49. config:
  50. multi-statement-allow: true
  51. # cpp:
  52. # dataSourceClassName: com.zaxxer.hikari.HikariDataSource
  53. # driverClassName: com.mysql.jdbc.Driver
  54. # jdbcUrl: jdbc:mysql://192.168.1.205:3306/cpp?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
  55. # username: root
  56. # password: '!QAZ2root'
  57. # hikari:
  58. # minimum-idle: 5 # 最小空闲连接数量
  59. # idle-timeout: 600000 # 空闲连接存活最大时间,默认为10分钟(600000毫秒),此处设置为3分钟(180000毫秒)
  60. # maximum-pool-size: 20 # 连接池最大连接数,默认为10
  61. # auto-commit: true # 自动提交事务,默认为true
  62. # max-lifetime: 1800000 # 连接最大生命周期,默认为30分钟(1800000毫秒)
  63. # connection-timeout: 30000 # 数据库连接超时时间,默认为30秒(30000毫秒)
  64. rules:
  65. - !SHARDING
  66. tables:
  67. cpp_forecast_power_ultra_short_term_regulation:
  68. actualDataNodes: cpp.cpp_forecast_power_ultra_short_term_regulation
  69. tableStrategy:
  70. standard:
  71. shardingColumn: time
  72. shardingAlgorithmName: auto-custom
  73. cpp_forecast_power_ultra_short_term_station:
  74. actualDataNodes: cpp.cpp_forecast_power_ultra_short_term_station
  75. tableStrategy:
  76. standard:
  77. shardingColumn: time
  78. shardingAlgorithmName: auto-custom
  79. cpp_forecast_power_ultra_short_term_cloud:
  80. actualDataNodes: cpp.cpp_forecast_power_ultra_short_term_cloud
  81. tableStrategy:
  82. standard:
  83. shardingColumn: time
  84. shardingAlgorithmName: auto-custom
  85. cpp_forecast_power_short_term_station:
  86. actualDataNodes: cpp.cpp_forecast_power_short_term_station
  87. tableStrategy:
  88. standard:
  89. shardingColumn: time
  90. shardingAlgorithmName: auto-custom
  91. cpp_forecast_power_short_term_send:
  92. actualDataNodes: cpp.cpp_forecast_power_short_term_send
  93. tableStrategy:
  94. standard:
  95. shardingColumn: time
  96. shardingAlgorithmName: auto-custom
  97. cpp_forecast_power_short_term_regulation:
  98. actualDataNodes: cpp.cpp_forecast_power_short_term_regulation
  99. tableStrategy:
  100. standard:
  101. shardingColumn: time
  102. shardingAlgorithmName: auto-custom
  103. cpp_forecast_power_short_term_cloud:
  104. actualDataNodes: cpp.cpp_forecast_power_short_term_cloud
  105. tableStrategy:
  106. standard:
  107. shardingColumn: time
  108. shardingAlgorithmName: auto-custom
  109. cpp_power_station_status_data:
  110. actualDataNodes: cpp.cpp_power_station_status_data
  111. tableStrategy:
  112. standard:
  113. shardingColumn: time
  114. shardingAlgorithmName: auto-custom
  115. cpp_parsing_log:
  116. actualDataNodes: cpp.cpp_parsing_log
  117. tableStrategy:
  118. standard:
  119. shardingColumn: create_time
  120. shardingAlgorithmName: auto-custom
  121. cpp_weather_station_status_data:
  122. actualDataNodes: cpp.cpp_weather_station_status_data
  123. tableStrategy:
  124. standard:
  125. shardingColumn: time
  126. shardingAlgorithmName: auto-custom
  127. cpp_wind_tower_status_data:
  128. actualDataNodes: cpp.cpp_wind_tower_status_data
  129. tableStrategy:
  130. standard:
  131. shardingColumn: time
  132. shardingAlgorithmName: auto-custom
  133. cpp_wind_turbine_status_data:
  134. actualDataNodes: cpp.cpp_wind_turbine_status_data
  135. tableStrategy:
  136. standard:
  137. shardingColumn: time
  138. shardingAlgorithmName: auto-custom
  139. cpp_inverter_status_data:
  140. actualDataNodes: cpp.cpp_inverter_status_data
  141. tableStrategy:
  142. standard:
  143. shardingColumn: time
  144. shardingAlgorithmName: auto-custom
  145. cpp_nwp_cloud:
  146. actualDataNodes: cpp.cpp_nwp_cloud
  147. tableStrategy:
  148. standard:
  149. shardingColumn: time
  150. shardingAlgorithmName: auto-custom
  151. cpp_nwp_station:
  152. actualDataNodes: cpp.cpp_nwp_station
  153. tableStrategy:
  154. standard:
  155. shardingColumn: time
  156. shardingAlgorithmName: auto-custom
  157. shardingAlgorithms:
  158. auto-custom:
  159. type: CLASS_BASED
  160. props:
  161. strategy: standard
  162. algorithmClassName: com.cpp.web.core.config.sharding.TimeShardingAlgorithm
  163. interval:
  164. type: INTERVAL
  165. props:
  166. datetime-pattern: 'yyyy-MM'
  167. datetime-lower: '2024-01'
  168. datetime-upper: '2025-12'
  169. sharding-suffix-pattern: 'yyyyMM'
  170. # 间隔大小
  171. datetime-interval-amount: 1
  172. datetime-interval-unit: 'Months'
  173. props:
  174. sql-show: false
  175. allow-range-query-with-inline-sharding: true