From 075ef635c6214ec34a4fd068e8705d37d362d713 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期三, 01 二月 2023 17:34:58 +0800
Subject: [PATCH] update 调整 优化连接池默认参数

---
 ruoyi-admin/src/main/resources/application-dev.yml |  244 +++++++++++++++++++++++++++++++++---------------
 1 files changed, 168 insertions(+), 76 deletions(-)

diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml
index 37d4e89..081b1d1 100644
--- a/ruoyi-admin/src/main/resources/application-dev.yml
+++ b/ruoyi-admin/src/main/resources/application-dev.yml
@@ -1,77 +1,169 @@
-# 鏁版嵁婧愰厤缃�
+--- # 鐩戞帶涓績閰嶇疆
+spring.boot.admin.client:
+  # 澧炲姞瀹㈡埛绔紑鍏�
+  enabled: true
+  url: http://localhost:9090/admin
+  instance:
+    service-host-type: IP
+  username: ruoyi
+  password: 123456
+
+--- # xxl-job 閰嶇疆
+xxl.job:
+  # 鎵ц鍣ㄥ紑鍏�
+  enabled: true
+  # 璋冨害涓績鍦板潃锛氬璋冨害涓績闆嗙兢閮ㄧ讲瀛樺湪澶氫釜鍦板潃鍒欑敤閫楀彿鍒嗛殧銆�
+  admin-addresses: http://localhost:9100/xxl-job-admin
+  # 鎵ц鍣ㄩ�氳TOKEN锛氶潪绌烘椂鍚敤
+  access-token: xxl-job
+  executor:
+    # 鎵ц鍣ˋppName锛氭墽琛屽櫒蹇冭烦娉ㄥ唽鍒嗙粍渚濇嵁锛涗负绌哄垯鍏抽棴鑷姩娉ㄥ唽
+    appname: xxl-job-executor
+    # 鎵ц鍣ㄧ鍙e彿 鎵ц鍣ㄤ粠9101寮�濮嬪線鍚庡啓
+    port: 9101
+    # 鎵ц鍣ㄦ敞鍐岋細榛樿IP:PORT
+    address:
+    # 鎵ц鍣↖P锛氶粯璁よ嚜鍔ㄨ幏鍙朓P
+    ip:
+    # 鎵ц鍣ㄨ繍琛屾棩蹇楁枃浠跺瓨鍌ㄧ鐩樿矾寰�
+    logpath: ./logs/xxl-job
+    # 鎵ц鍣ㄦ棩蹇楁枃浠朵繚瀛樺ぉ鏁帮細澶т簬3鐢熸晥
+    logretentiondays: 30
+
+--- # 鏁版嵁婧愰厤缃�
 spring:
-    datasource:
-        type: com.alibaba.druid.pool.DruidDataSource
-        driverClassName: com.mysql.cj.jdbc.Driver
-        druid:
-            # 涓诲簱鏁版嵁婧�
-            master:
-                url: jdbc:mysql://192.168.0.222:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
-                username: root
-                password: root
-            # 浠庡簱鏁版嵁婧�
-            slave:
-                # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴
-                enabled: false
-                url: 
-                username: 
-                password: 
-            # 鍒濆杩炴帴鏁�
-            initialSize: 5
-            # 鏈�灏忚繛鎺ユ睜鏁伴噺
-            minIdle: 10
-            # 鏈�澶ц繛鎺ユ睜鏁伴噺
-            maxActive: 20
-            # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
-            maxWait: 60000
-            # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣
-            timeBetweenEvictionRunsMillis: 60000
-            # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
-            minEvictableIdleTimeMillis: 300000
-            # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
-            maxEvictableIdleTimeMillis: 900000
-            # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
-            validationQuery: SELECT 1 FROM DUAL
-            testWhileIdle: true
-            testOnBorrow: false
-            testOnReturn: false
-            webStatFilter: 
-                enabled: true
-            statViewServlet:
-                enabled: true
-                # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂�
-                allow:
-                url-pattern: /druid/*
-                # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮�
-                login-username: 
-                login-password: 
-            filter:
-                stat:
-                    enabled: true
-                    # 鎱QL璁板綍
-                    log-slow-sql: true
-                    slow-sql-millis: 1000
-                    merge-sql: true
-                wall:
-                    config:
-                        multi-statement-allow: true
-    # redis 閰嶇疆
-    redis:
-        # 鍦板潃
-        host: 192.168.0.222
-        # 绔彛锛岄粯璁や负6379
-        port: 6379
-        # 瀵嗙爜
-        password:
-        # 杩炴帴瓒呮椂鏃堕棿
-        timeout: 10s
-        lettuce:
-            pool:
-                # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺�
-                min-idle: 0
-                # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺�
-                max-idle: 8
-                # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁�
-                max-active: 8
-                # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級
-                max-wait: -1ms
\ No newline at end of file
+  datasource:
+    type: com.zaxxer.hikari.HikariDataSource
+    # 鍔ㄦ�佹暟鎹簮鏂囨。 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
+    dynamic:
+      # 鎬ц兘鍒嗘瀽鎻掍欢(鏈夋�ц兘鎹熻�� 涓嶅缓璁敓浜х幆澧冧娇鐢�)
+      p6spy: true
+      # 璁剧疆榛樿鐨勬暟鎹簮鎴栬�呮暟鎹簮缁�,榛樿鍊煎嵆涓� master
+      primary: master
+      # 涓ユ牸妯″紡 鍖归厤涓嶅埌鏁版嵁婧愬垯鎶ラ敊
+      strict: true
+      datasource:
+        # 涓诲簱鏁版嵁婧�
+        master:
+          type: ${spring.datasource.type}
+          driverClassName: com.mysql.cj.jdbc.Driver
+          # jdbc 鎵�鏈夊弬鏁伴厤缃弬鑰� https://lionli.blog.csdn.net/article/details/122018562
+          # rewriteBatchedStatements=true 鎵瑰鐞嗕紭鍖� 澶у箙鎻愬崌鎵归噺鎻掑叆鏇存柊鍒犻櫎鎬ц兘(瀵规暟鎹簱鏈夋�ц兘鎹熻�� 浣跨敤鎵归噺鎿嶄綔搴旇�冭檻鎬ц兘闂)
+          url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
+          username: root
+          password: root
+        # 浠庡簱鏁版嵁婧�
+        slave:
+          lazy: true
+          type: ${spring.datasource.type}
+          driverClassName: com.mysql.cj.jdbc.Driver
+          url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
+          username:
+          password:
+#        oracle:
+#          type: ${spring.datasource.type}
+#          driverClassName: oracle.jdbc.OracleDriver
+#          url: jdbc:oracle:thin:@//localhost:1521/XE
+#          username: ROOT
+#          password: root
+#          hikari:
+#            connectionTestQuery: SELECT 1 FROM DUAL
+#        postgres:
+#          type: ${spring.datasource.type}
+#          driverClassName: org.postgresql.Driver
+#          url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
+#          username: root
+#          password: root
+#        sqlserver:
+#          type: ${spring.datasource.type}
+#          driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
+#          url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
+#          username: SA
+#          password: root
+      hikari:
+        # 鏈�澶ц繛鎺ユ睜鏁伴噺
+        maxPoolSize: 20
+        # 鏈�灏忕┖闂茬嚎绋嬫暟閲�
+        minIdle: 10
+        # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂�
+        connectionTimeout: 30000
+        # 鏍¢獙瓒呮椂鏃堕棿
+        validationTimeout: 5000
+        # 绌洪棽杩炴帴瀛樻椿鏈�澶ф椂闂达紝榛樿10鍒嗛挓
+        idleTimeout: 600000
+        # 姝ゅ睘鎬ф帶鍒舵睜涓繛鎺ョ殑鏈�闀跨敓鍛藉懆鏈燂紝鍊�0琛ㄧず鏃犻檺鐢熷懡鍛ㄦ湡锛岄粯璁�30鍒嗛挓
+        maxLifetime: 900000
+        # 杩炴帴娴嬭瘯query锛堥厤缃娴嬭繛鎺ユ槸鍚︽湁鏁堬級
+        connectionTestQuery: SELECT 1
+
+--- # redis 鍗曟満閰嶇疆(鍗曟満涓庨泦缇ゅ彧鑳藉紑鍚竴涓彟涓�涓渶瑕佹敞閲婃帀)
+spring.data:
+  redis:
+    # 鍦板潃
+    host: localhost
+    # 绔彛锛岄粯璁や负6379
+    port: 6379
+    # 鏁版嵁搴撶储寮�
+    database: 0
+    # 瀵嗙爜(濡傛病鏈夊瘑鐮佽娉ㄩ噴鎺�)
+    # password:
+    # 杩炴帴瓒呮椂鏃堕棿
+    timeout: 10s
+    # 鏄惁寮�鍚痵sl
+    ssl: false
+
+redisson:
+  # redis key鍓嶇紑
+  keyPrefix:
+  # 绾跨▼姹犳暟閲�
+  threads: 4
+  # Netty绾跨▼姹犳暟閲�
+  nettyThreads: 8
+  # 鍗曡妭鐐归厤缃�
+  singleServerConfig:
+    # 瀹㈡埛绔悕绉�
+    clientName: ${ruoyi.name}
+    # 鏈�灏忕┖闂茶繛鎺ユ暟
+    connectionMinimumIdleSize: 8
+    # 杩炴帴姹犲ぇ灏�
+    connectionPoolSize: 32
+    # 杩炴帴绌洪棽瓒呮椂锛屽崟浣嶏細姣
+    idleConnectionTimeout: 10000
+    # 鍛戒护绛夊緟瓒呮椂锛屽崟浣嶏細姣
+    timeout: 3000
+    # 鍙戝竷鍜岃闃呰繛鎺ユ睜澶у皬
+    subscriptionConnectionPoolSize: 50
+
+--- # mail 閭欢鍙戦��
+mail:
+  enabled: false
+  host: smtp.163.com
+  port: 465
+  # 鏄惁闇�瑕佺敤鎴峰悕瀵嗙爜楠岃瘉
+  auth: true
+  # 鍙戦�佹柟锛岄伒寰猂FC-822鏍囧噯
+  from: xxx@163.com
+  # 鐢ㄦ埛鍚嶏紙娉ㄦ剰锛氬鏋滀娇鐢╢oxmail閭锛屾澶剈ser涓簈q鍙凤級
+  user: xxx@163.com
+  # 瀵嗙爜锛堟敞鎰忥紝鏌愪簺閭闇�瑕佷负SMTP鏈嶅姟鍗曠嫭璁剧疆瀵嗙爜锛岃鎯呮煡鐪嬬浉鍏冲府鍔╋級
+  pass: xxxxxxxxxx
+  # 浣跨敤 STARTTLS瀹夊叏杩炴帴锛孲TARTTLS鏄绾枃鏈�氫俊鍗忚鐨勬墿灞曘��
+  starttlsEnable: true
+  # 浣跨敤SSL瀹夊叏杩炴帴
+  sslEnable: true
+  # SMTP瓒呮椂鏃堕暱锛屽崟浣嶆绉掞紝缂虹渷鍊间笉瓒呮椂
+  timeout: 0
+  # Socket杩炴帴瓒呮椂鍊硷紝鍗曚綅姣锛岀己鐪佸�间笉瓒呮椂
+  connectionTimeout: 0
+
+--- # sms 鐭俊
+sms:
+  enabled: false
+  # 闃块噷浜� dysmsapi.aliyuncs.com
+  # 鑵捐浜� sms.tencentcloudapi.com
+  endpoint: "dysmsapi.aliyuncs.com"
+  accessKeyId: xxxxxxx
+  accessKeySecret: xxxxxx
+  signName: 娴嬭瘯
+  # 鑵捐涓撶敤
+  sdkAppId:

--
Gitblit v1.9.3