configmap.yaml
3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
apiVersion: v1
kind: ConfigMap
metadata:
name: product-service-config
namespace: ecommerce
labels:
app: product-service
data:
application.yml: |
server:
port: 8080
servlet:
context-path: /api/products
spring:
application:
name: product-service
profiles:
active: production
# PostgreSQL 数据库配置
datasource:
# ========== 修改点1:修复数据库主机名 ==========
url: jdbc:postgresql://postgresql:5432/ecommerce # 修改:postgresql-service → postgresql
username: admin
password: ${POSTGRES_PASSWORD}
driver-class-name: org.postgresql.Driver
hikari:
maximum-pool-size: 10
minimum-idle: 2
connection-timeout: 30000
idle-timeout: 600000
max-lifetime: 1800000
# JPA 配置
jpa:
hibernate:
ddl-auto: update
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
# ========== 修改点2:临时开启SQL日志便于调试 ==========
show-sql: true # 修改:false → true (调试完成后可改回false)
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: true
jdbc:
batch_size: 20
order_inserts: true
order_updates: true
# MongoDB 配置
data:
mongodb:
# ========== 修改点3:修复MongoDB主机名和数据库名 ==========
uri: mongodb://admin:${MONGO_PASSWORD}@mongodb:27017/product_db?authSource=admin # 修改:ecommerce → product_db
database: product_db # 修改:ecommerce → product_db
auto-index-creation: true
# Redis 配置
redis:
# ========== 修改点4:修复Redis主机名 ==========
host: redis # 修改:redis-service → redis
port: 6379
password: ${REDIS_PASSWORD}
timeout: 2000
lettuce:
pool:
max-active: 10
max-idle: 5
min-idle: 2
max-wait: 1000
# 缓存配置
cache:
type: redis
redis:
time-to-live: 3600000
cache-null-values: false
# 禁用 Eureka 服务发现
eureka:
client:
enabled: false
register-with-eureka: false
fetch-registry: false
instance:
enabled: false
# Elasticsearch 配置
elasticsearch:
# ========== 修改点5:修复Elasticsearch主机名 ==========
host: elasticsearch # 修改:elasticsearch-service → elasticsearch
port: 9200
# 功能标志配置
feature:
flags:
cache-enabled: true
search-enabled: true
# 日志配置
logging:
level:
com.ecommerce.productservice: DEBUG
org.springframework.data.mongodb.core: WARN
# ========== 修改点6:临时调整Hibernate日志级别便于调试 ==========
org.hibernate.SQL: DEBUG # 修改:WARN → DEBUG (调试数据库问题)
org.hibernate.type.descriptor.sql.BasicBinder: DEBUG # 修改:WARN → DEBUG
# ========== 新增:添加数据库连接相关日志 ==========
org.hibernate.engine.jdbc.connections: DEBUG
com.zaxxer.hikari: DEBUG
# Actuator 配置
management:
endpoints:
web:
exposure:
include: health,info,metrics,prometheus
endpoint:
health:
show-details: always
probes:
enabled: true