From a836652453e08cf9e115c39de291bb7e66cb7ebb Mon Sep 17 00:00:00 2001 From: passage2016 Date: Sun, 26 Feb 2023 22:47:12 -0500 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=B1=A0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources-prod/application-prod.yml | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/genshin-map-config/src/main/resources-prod/application-prod.yml b/genshin-map-config/src/main/resources-prod/application-prod.yml index 98a6b15d..f3540009 100644 --- a/genshin-map-config/src/main/resources-prod/application-prod.yml +++ b/genshin-map-config/src/main/resources-prod/application-prod.yml @@ -4,26 +4,31 @@ spring: - nacos-prod - datasource-prod datasource: - driver-class-name: com.mysql.cj.jdbc.Driver - type: com.alibaba.druid.pool.DruidDataSource - datasource: druid: - time-between-eviction-runs-millis: 10000 - min-evictable-idle-time-millis: 30000 - max-evictable-idle-time-millis: 7200000 - validation-query-timeout: 3 + # 池中某个连接的空闲时长达到 N 毫秒后, 连接池在下次检查空闲连接时,将回收该连接 + min-evictable-idle-time-millis: 300000 + # 检测超时 + validation-query-timeout: 1 validation-query: SELECT 1 + # 申请连接时检测有效,影响性能 test-on-borrow: false + # 归还连接时检测有效,影响性能 test-on-return: false + # 循环检测有效,不影响性能 test-while-idle: true - max-active: 20 - max-pool-prepared-statement-per-connection-size: 20 - initial-size: 2 - max-wait: 6000 - min-idle: 2 - pool-prepared-statements: true - max-open-prepared-statements: 20 - async-init: true + # 检查空闲连接的频率,单位毫秒 + time-between-eviction-runs-millis: 10000 + # 是否缓存preparedStatement, mysql下关闭,支持游标的数据库开启 + pool-prepared-statements: false + # 缓存preparedStatement大小,开启后建议100,-1关闭 + max-pool-prepared-statement-per-connection-size: -1 + # 初始连接数 + initial-size: 50 + #最大连接数 + max-active: 100 + # 最小保持连接数 + min-idle: 50 + async-init: false springdoc: api-docs: From 861015704f9fef33756cba9ee6b4911d1321e525 Mon Sep 17 00:00:00 2001 From: passage2016 Date: Sun, 26 Feb 2023 23:59:31 -0500 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=B1=A0=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/auth/WebSecurityConfiguration.java | 3 +- .../main/resources-dev/application-dev.yml | 28 +++++++++---- .../main/resources-prod/application-prod.yml | 37 ++++++---------- .../src/main/resources/application-common.yml | 42 +++++++++++++++++++ .../src/main/resources/application.yml | 0 5 files changed, 77 insertions(+), 33 deletions(-) create mode 100644 genshin-map-config/src/main/resources/application-common.yml delete mode 100644 genshin-map-config/src/main/resources/application.yml diff --git a/genshin-map-api/genshin-map-api-core/genshin-map-api-core-core/src/main/java/site/yuanshen/genshin/core/auth/WebSecurityConfiguration.java b/genshin-map-api/genshin-map-api-core/genshin-map-api-core-core/src/main/java/site/yuanshen/genshin/core/auth/WebSecurityConfiguration.java index 1175eb3a..16583776 100644 --- a/genshin-map-api/genshin-map-api-core/genshin-map-api-core-core/src/main/java/site/yuanshen/genshin/core/auth/WebSecurityConfiguration.java +++ b/genshin-map-api/genshin-map-api-core/genshin-map-api-core-core/src/main/java/site/yuanshen/genshin/core/auth/WebSecurityConfiguration.java @@ -44,7 +44,8 @@ protected void configure(HttpSecurity http) throws Exception { "/api/**", "/system/**", "/v3/**", - "/swagger-ui/**" + "/swagger-ui/**", + "/druid/**" ).permitAll() .anyRequest().authenticated() .and() diff --git a/genshin-map-config/src/main/resources-dev/application-dev.yml b/genshin-map-config/src/main/resources-dev/application-dev.yml index 674691c7..9ab17dd7 100644 --- a/genshin-map-config/src/main/resources-dev/application-dev.yml +++ b/genshin-map-config/src/main/resources-dev/application-dev.yml @@ -1,19 +1,33 @@ spring: profiles: include: + - common - nacos-dev - datasource-dev datasource: - driver-class-name: com.mysql.cj.jdbc.Driver - type: com.alibaba.druid.pool.DruidDataSource + datasource: + druid: + # 初始连接数 + initial-size: 8 + #最大连接数 + max-active: 20 + # 最小保持连接数 + min-idle: 8 + async-init: false + ########## 配置StatViewServlet(监控页面),用于展示Druid的统计信息 ########## + stat-view-servlet: + login-username: root # 配置监控页面访问密码 + login-password: 123 + reset-enable: false # 不允许清空统计数据,重新计算 logging: level: site: - yuanshen: - genshin: + @@ -21,4 +28,8 @@ logging: core: debug - site.yuanshen.data.mapper: debug -# org.springframework: + data: + mapper: debug + org: + springframework: # security: debug -# cache: debug + cache: debug \ No newline at end of file diff --git a/genshin-map-config/src/main/resources-prod/application-prod.yml b/genshin-map-config/src/main/resources-prod/application-prod.yml index f3540009..ba354863 100644 --- a/genshin-map-config/src/main/resources-prod/application-prod.yml +++ b/genshin-map-config/src/main/resources-prod/application-prod.yml @@ -1,34 +1,21 @@ spring: profiles: include: + - common - nacos-prod - datasource-prod datasource: - druid: - # 池中某个连接的空闲时长达到 N 毫秒后, 连接池在下次检查空闲连接时,将回收该连接 - min-evictable-idle-time-millis: 300000 - # 检测超时 - validation-query-timeout: 1 - validation-query: SELECT 1 - # 申请连接时检测有效,影响性能 - test-on-borrow: false - # 归还连接时检测有效,影响性能 - test-on-return: false - # 循环检测有效,不影响性能 - test-while-idle: true - # 检查空闲连接的频率,单位毫秒 - time-between-eviction-runs-millis: 10000 - # 是否缓存preparedStatement, mysql下关闭,支持游标的数据库开启 - pool-prepared-statements: false - # 缓存preparedStatement大小,开启后建议100,-1关闭 - max-pool-prepared-statement-per-connection-size: -1 - # 初始连接数 - initial-size: 50 - #最大连接数 - max-active: 100 - # 最小保持连接数 - min-idle: 50 - async-init: false + druid: + # 初始连接数 + initial-size: 50 + #最大连接数 + max-active: 100 + # 最小保持连接数 + min-idle: 50 + ########## 配置StatViewServlet(监控页面),用于展示Druid的统计信息 ########## + stat-view-servlet: + enabled: true # 启用StatViewServlet + reset-enable: false # 清空统计数据 springdoc: api-docs: diff --git a/genshin-map-config/src/main/resources/application-common.yml b/genshin-map-config/src/main/resources/application-common.yml new file mode 100644 index 00000000..719f523e --- /dev/null +++ b/genshin-map-config/src/main/resources/application-common.yml @@ -0,0 +1,42 @@ +spring: + datasource: + driver-class-name: org.postgresql.Driver + type: com.alibaba.druid.pool.DruidDataSource + druid: + # 池中某个连接的空闲时长达到 N 毫秒后, 连接池在下次检查空闲连接时,将回收该连接 + min-evictable-idle-time-millis: 300000 + # 检测超时 + validation-query-timeout: 1 + validation-query: SELECT 1 + # 申请连接时检测有效,影响性能 + test-on-borrow: false + # 归还连接时检测有效,影响性能 + test-on-return: false + # 循环检测有效,不影响性能 + test-while-idle: true + # 检查空闲连接的频率,单位毫秒 + time-between-eviction-runs-millis: 10000 + # 是否缓存preparedStatement, mysql下关闭,支持游标的数据库开启 + pool-prepared-statements: true + # 缓存preparedStatement大小,开启后建议100,-1关闭 + max-pool-prepared-statement-per-connection-size: 100 + async-init: false + filter: + # 开启druiddatasource的状态监控 + stat: + enabled: true + db-type: postgresql + log-slow-sql: true + slow-sql-millis: 1000 + connection-stack-trace-enable: true + merge-sql: true + ########## 配置WebStatFilter,用于采集web关联监控的数据 ########## + web-stat-filter: + enabled: true # 启动 StatFilter + url-pattern: /* # 过滤所有url + exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" # 排除一些不必要的url + session-stat-enable: false # 开启session统计功能 + ########## 配置StatViewServlet(监控页面),用于展示Druid的统计信息 ########## + stat-view-servlet: + enabled: true # 启用StatViewServlet + reset-enable: true # 不允许清空统计数据,重新计算 \ No newline at end of file diff --git a/genshin-map-config/src/main/resources/application.yml b/genshin-map-config/src/main/resources/application.yml deleted file mode 100644 index e69de29b..00000000 From e600ad1afaabdccf09b0f38d697649dd737d7a6a Mon Sep 17 00:00:00 2001 From: passage2016 Date: Mon, 27 Feb 2023 00:07:37 -0500 Subject: [PATCH 3/3] =?UTF-8?q?merge=20sql=20=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- genshin-map-config/src/main/resources/application-common.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/genshin-map-config/src/main/resources/application-common.yml b/genshin-map-config/src/main/resources/application-common.yml index 719f523e..ccd9cc46 100644 --- a/genshin-map-config/src/main/resources/application-common.yml +++ b/genshin-map-config/src/main/resources/application-common.yml @@ -29,7 +29,6 @@ spring: log-slow-sql: true slow-sql-millis: 1000 connection-stack-trace-enable: true - merge-sql: true ########## 配置WebStatFilter,用于采集web关联监控的数据 ########## web-stat-filter: enabled: true # 启动 StatFilter