108 lines
3.0 KiB
YAML
108 lines
3.0 KiB
YAML
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: ljwx-boot-config
|
|
namespace: ljwx-health
|
|
labels:
|
|
app: ljwx-boot
|
|
data:
|
|
# 数据库配置
|
|
database.url: "jdbc:mysql://mysql-service.ljwx-health.svc.cluster.local:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true"
|
|
database.driver: "com.mysql.cj.jdbc.Driver"
|
|
|
|
# Redis配置
|
|
redis.host: "redis-service.ljwx-health.svc.cluster.local"
|
|
redis.port: "6379"
|
|
|
|
# 应用配置
|
|
application-prod.yml: |
|
|
server:
|
|
port: 9998
|
|
tomcat:
|
|
threads:
|
|
max: 200
|
|
min-spare: 20
|
|
max-connections: 10000
|
|
accept-count: 100
|
|
|
|
spring:
|
|
application:
|
|
name: ljwx-boot
|
|
|
|
datasource:
|
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
|
type: com.zaxxer.hikari.HikariDataSource
|
|
hikari:
|
|
minimum-idle: 10
|
|
maximum-pool-size: 30
|
|
connection-timeout: 30000
|
|
idle-timeout: 600000
|
|
max-lifetime: 1800000
|
|
|
|
redis:
|
|
# Redis Service DNS 名称(K8s 集群内部)
|
|
host: redis-service.ljwx-health.svc.cluster.local
|
|
port: 6379
|
|
database: 1
|
|
timeout: 10000
|
|
lettuce:
|
|
pool:
|
|
max-active: 200
|
|
max-idle: 50
|
|
min-idle: 10
|
|
max-wait: 10000
|
|
|
|
# Actuator配置
|
|
management:
|
|
endpoints:
|
|
web:
|
|
exposure:
|
|
include: "*" # 暴露所有端点(生产环境可限制)
|
|
base-path: /actuator
|
|
endpoint:
|
|
health:
|
|
show-details: always # 生产环境改为when-authorized
|
|
show-components: always
|
|
probes:
|
|
enabled: true
|
|
metrics:
|
|
enabled: true
|
|
prometheus:
|
|
enabled: true
|
|
metrics:
|
|
export:
|
|
prometheus:
|
|
enabled: true
|
|
step: 30s # 30秒数据间隔
|
|
tags:
|
|
application: ljwx-boot
|
|
environment: kubernetes # K8s环境标识
|
|
|
|
# P0-3 健康数据去重配置
|
|
health:
|
|
dedup:
|
|
use-redis: true # 使用Redis去重(推荐)
|
|
ttl-hours: 24 # Redis Key TTL 24小时
|
|
use-content-hash: true # 启用内容哈希去重
|
|
memory-cleanup-interval-ms: 3600000 # 内存模式清理间隔(1小时)
|
|
memory-warning-threshold: 100000 # 内存Key数量告警阈值
|
|
|
|
# P0-4 缓存自动失效配置
|
|
cache:
|
|
auto-invalidation: true # 启用自动缓存失效
|
|
invalidation-delay-ms: 1000 # 失效延迟1秒,避免并发问题
|
|
|
|
# 日志配置
|
|
logging:
|
|
level:
|
|
root: INFO
|
|
com.ljwx: INFO
|
|
com.ljwx.modules.health: DEBUG
|
|
pattern:
|
|
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
|
|
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
|
|
file:
|
|
name: /app/logs/ljwx-boot.log
|
|
max-size: 100MB
|
|
max-history: 30
|