# 风七六本地生活服务平台 - 运维手册

## 1. 服务管理

### 1.1 启动服务

```bash
# 启动所有服务
podman-compose up -d

# 启动指定服务
podman-compose up -d user-service
```

### 1.2 停止服务

```bash
# 停止所有服务
podman-compose down

# 停止指定服务
podman-compose stop user-service
```

### 1.3 查看服务状态

```bash
# 查看所有容器状态
podman ps

# 查看服务日志
podman logs -f fzx-user-service
```

## 2. 备份与恢复

### 2.1 执行备份

```bash
# 手动执行备份
/opt/fzx/backup.sh

# 查看备份文件
ls -la /backup/fzx/
```

### 2.2 恢复数据

```bash
# 恢复 MariaDB
podman exec -i mariadb-aliyun-dev mysql -u root -p fzx_db < /backup/fzx/mysql/backup_xxx.sql

# 恢复 Redis
podman cp /backup/fzx/redis/backup_xxx.rdb redis-aliyun-dev:/data/dump.rdb
podman restart redis-aliyun-dev
```

## 3. 监控与告警

### 3.1 访问监控面板

- Grafana: http://localhost:3000
- Prometheus: http://localhost:9090

### 3.2 查看告警

```bash
# 查看 Prometheus 告警
curl http://localhost:9090/api/v1/alerts
```

## 4. 故障排查

### 4.1 检查服务健康

```bash
# 检查服务健康状态
curl http://localhost:8080/actuator/health
```

### 4.2 查看慢查询

```bash
# 查看 MySQL 慢查询日志
podman exec mariadb-aliyun-dev cat /var/log/mariadb/slow.log
```

## 5. 性能优化

### 5.1 运行基准测试

```bash
infrastructure/performance/benchmark.sh
```

### 5.2 资源监控

```bash
infrastructure/optimization/resource-monitor.sh
```

## 6. 安全扫描

### 6.1 镜像安全扫描

```bash
infrastructure/images/image-scan.sh
```

## 附录：端口映射

| 服务         | 端口        |
|------------|-----------|
| Jenkins    | 8080      |
| Nexus      | 8081      |
| Prometheus | 9090      |
| Grafana    | 3000      |
| Kong       | 8000/8001 |
| MariaDB    | 3306      |
| Redis      | 6379      |
