Files
zhuyongxin 3956426c97 docs(knowledge): 添加测试知识库文档
新增 6 个知识库文档,用于测试 L0+L1 混合检索功能:

API 类:
- payment-errors.md - 支付网关错误码定义

领域知识类:
- spring-ai-tool-best-practices.md - Spring AI 工具定义最佳实践

基础设施类:
- redis-config.md - Redis 缓存配置指南
- mysql-connection-pool.md - MySQL 连接池配置
- flyway-best-practices.md - Flyway 数据库迁移最佳实践

故障排查类:
- fault-diagnosis-process.md - 故障诊断流程规范

所有文档均包含:
- 标准 frontmatter 元数据 (title, keywords, summary, category)
- 实用配置示例和代码片段
- 支持 L0 精确匹配的关键词
2026-06-24 16:19:10 +08:00

65 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: Redis 缓存配置指南
keywords: [Redis, 缓存, 配置, 连接池, 超时]
summary: Redis 缓存的配置参数说明、连接池设置和常见问题排查
category: infrastructure
---
# Redis 缓存配置指南
## 基础配置
### 连接参数
```yaml
spring:
redis:
host: localhost
port: 6379
password: your_password
database: 0
timeout: 3000ms
```
### 连接池配置
```yaml
spring:
redis:
lettuce:
pool:
max-active: 8
max-idle: 8
min-idle: 0
max-wait: -1ms
```
## 常见问题
### 超时问题排查
**症状**:Redis 操作超时
**排查步骤**:
1. 检查网络连接:`ping redis_host`
2. 检查 Redis 服务状态:`redis-cli ping`
3. 查看慢查询日志:`redis-cli slowlog get 10`
4. 检查连接池状态
**解决方案**:
- 增加超时时间
- 优化慢查询
- 调整连接池大小
### 连接数过多
**症状**:达到 Redis 最大连接数限制
**排查**:
```bash
redis-cli info clients
```
**解决**:
- 调整 `maxclients` 参数
- 检查连接泄漏
- 启用连接池复用