diff --git a/viewsh-module-video/viewsh-module-video-server/src/main/resources/application-local.yaml b/viewsh-module-video/viewsh-module-video-server/src/main/resources/application-local.yaml index b191dfeb..88b8746d 100644 --- a/viewsh-module-video/viewsh-module-video-server/src/main/resources/application-local.yaml +++ b/viewsh-module-video/viewsh-module-video-server/src/main/resources/application-local.yaml @@ -49,12 +49,18 @@ spring: max-active: 20 # 最大连接池数量 max-wait: 60000 # 配置获取连接等待超时的时间,单位:毫秒(1 分钟) time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒(1 分钟) - min-evictable-idle-time-millis: 600000 # 配置一个连接在池中最小生存的时间,单位:毫秒(10 分钟) + # 远程 MySQL(124.222.218.x)经 NAT/云防火墙,空闲 60~80s 会被中间层静默断开。 + # 从 10 分钟改为 5 分钟:连接空闲达到这个阈值后开始走 keepAlive/回收逻辑。 + min-evictable-idle-time-millis: 300000 # 连接在池中最小生存时间(5 分钟) max-evictable-idle-time-millis: 1800000 # 配置一个连接在池中最大生存的时间,单位:毫秒(30 分钟) validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效 test-while-idle: true test-on-borrow: false test-on-return: false + # keep-alive: 每次 eviction 扫描(60s)时主动 ping 空闲超过 min-evictable-idle 的连接, + # 死连接直接剔除,避免 @Scheduled 任务低频借连接时踩上被中间层静默断开的死连接, + # 症状:RecoverableDataAccessException / Communications link failure / last packet received X ms ago + keep-alive: true pool-prepared-statements: true # 是否开启 PreparedStatement 缓存 max-pool-prepared-statement-per-connection-size: 20 # 每个连接缓存的 PreparedStatement 数量 primary: master @@ -115,6 +121,15 @@ spring: username: admin password: admin +--- #################### 本地开发专用:ZLM 媒体服务器配置 #################### +# 生产/测试环境请通过环境变量 ZLM_* 覆盖,不要直接把本地值改进 application.yaml +media: + id: ${ZLM_SERVER_ID:zlmediakit-local} + ip: ${ZLM_IP:192.168.0.104} + http-port: ${ZLM_HTTP_PORT:9092} + secret: ${ZLM_SECRET:u3UapOhmZa9er7S37Hc2k695NlZOBYdB} + auto-config: ${ZLM_AUTO_CONFIG:false} + # 日志文件配置 logging: level: diff --git a/viewsh-module-video/viewsh-module-video-server/src/main/resources/application.yaml b/viewsh-module-video/viewsh-module-video-server/src/main/resources/application.yaml index 876be774..5f9f6baa 100644 --- a/viewsh-module-video/viewsh-module-video-server/src/main/resources/application.yaml +++ b/viewsh-module-video/viewsh-module-video-server/src/main/resources/application.yaml @@ -108,6 +108,10 @@ viewsh: web: admin-ui: url: http://dashboard.viewsh.iocoder.cn # Admin 管理后台 UI 的地址 + # 访问日志:关掉 ZLM 每 10s 一次的心跳刷屏;出现异常或 4xx/5xx 时仍会打 WARN + access-log: + exclude-paths: + - /index/hook/on_server_keepalive xss: enable: false exclude-urls: @@ -149,17 +153,19 @@ sip: register-time-interval: 60 # ZLMediaKit 默认服务器配置 +# 真实连接参数(ip/http-port/secret)请通过环境变量或 application-{profile}.yaml 覆盖, +# 不要把具体环境的 secret 提交到默认 yaml。参考 application-local.yaml 里 MYSQL_* 的写法。 media: # ZLM 服务器唯一 ID(对应 ZLM general.mediaServerId) - id: your-zlm-server-id + id: ${ZLM_SERVER_ID:your-zlm-server-id} # ZLM 服务器内网 IP - ip: 127.0.0.1 + ip: ${ZLM_IP:127.0.0.1} # ZLM HTTP 端口 - http-port: 80 - # ZLM Hook 鉴权 secret(对应 ZLM hook.admin_params=secret) - secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc + http-port: ${ZLM_HTTP_PORT:80} + # ZLM Hook 鉴权 secret(对应 ZLM hook.admin_params=secret)——必须通过环境/profile 覆盖 + secret: ${ZLM_SECRET:please-override-in-env} # 是否自动配置 ZLM - auto-config: true + auto-config: ${ZLM_AUTO_CONFIG:true} # 录像路径 record-path: ./www/record # 录像保存天数 @@ -226,4 +232,12 @@ user-settings: # SIP 保持服务器连接(false 可防止 TCP DoS 攻击,但降低性能) sip-cache-server-connections: true +# Video 模块定时任务统一配置 +# 项目的业务级定时任务走 xxl-job(xxl.job.*),此处管控 video 模块内高频 SIP 消息队列轮询 +# 这类轮询频率(50ms/100ms/200ms)远低于 xxl-job 的秒级调度精度,仅靠 Spring @Scheduled 承载 +video: + sip-queue: + # 是否开启 SIP 消息队列消费调度器(目录同步/心跳/报警)。关闭后 SIP 消息将堆积在内存队列,不落库,慎用 + enabled: true + debug: false