application-prod.yml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. --- # 数据源配置
  2. spring:
  3. #数据源配置
  4. datasource:
  5. type: com.zaxxer.hikari.HikariDataSource
  6. # 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
  7. dynamic:
  8. # 性能分析插件(有性能损耗 不建议生产环境使用)
  9. p6spy: false
  10. # 设置默认的数据源或者数据源组,默认值即为 master
  11. primary: master
  12. # 严格模式 匹配不到数据源则报错
  13. strict: true
  14. datasource:
  15. # 主库数据源
  16. master:
  17. type: ${spring.datasource.type}
  18. driverClassName: com.mysql.cj.jdbc.Driver
  19. # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
  20. # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
  21. # 因为campus-server和mysql在同一个容器中,所以使用mysql作为host
  22. url: jdbc:mysql://mysql:3306/campus_imaotai?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
  23. username: root
  24. password: 123456789
  25. # 从库数据源
  26. # slave:
  27. # lazy: true
  28. # type: ${spring.datasource.type}
  29. # driverClassName: com.mysql.cj.jdbc.Driver
  30. # url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
  31. # username: root
  32. # password: 123456789
  33. hikari:
  34. # 最大连接池数量
  35. maxPoolSize: 20
  36. # 最小空闲线程数量
  37. minIdle: 10
  38. # 配置获取连接等待超时的时间
  39. connectionTimeout: 30000
  40. # 校验超时时间
  41. validationTimeout: 5000
  42. # 空闲连接存活最大时间,默认10分钟
  43. idleTimeout: 600000
  44. # 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟
  45. maxLifetime: 1800000
  46. # 连接测试query(配置检测连接是否有效)
  47. connectionTestQuery: SELECT 1
  48. # 多久检查一次连接的活性
  49. keepaliveTime: 30000
  50. --- # redis
  51. spring:
  52. redis:
  53. # 因为campus-server和redis在同一个容器中,所以使用redis作为host
  54. host: redis
  55. # 端口,默认为6379
  56. port: 6379
  57. # 数据库索引
  58. database: 0
  59. # 密码(如没有密码请注释掉)
  60. # password:
  61. # 连接超时时间
  62. timeout: 10s