Endpoint 故障排查
本文档详细介绍 FluxMQ 2.1.1 版本中 Endpoint 常见问题的诊断和解决方法。
常见问题分类
1. 连接问题
- 端口冲突
- 网络连接失败
- 认证失败
- 连接超时
2. 配置问题
- 配置不生效
- 参数错误
- 权限不足
- 存储问题
3. 性能问题
- 连接 数过多
- 消息处理慢
- 内存使用高
- CPU 使用率高
4. 集群问题
- 配置同步失败
- 节点通信异常
- 数据不一致
- 故障转移问题
连接问题排查
端口冲突
问题现象:
ERROR: Port 1883 is already in use
排查步骤:
- 检查端口占用情况
# Linux/macOS
netstat -tulpn | grep :1883
lsof -i :1883
# Windows
netstat -ano | findstr :1883
- 检查 FluxMQ 进程
ps aux | grep fluxmq
- 使用 API 检查端口状态
curl -X GET "http://localhost:8080/api/endpoints/check-port?port=1883"
解决方案:
- 停止占用端口的进程
- 使用其他可用端口
- 配置端口复用
网络连接失败
问题现象:
ERROR: Failed to bind to address 0.0.0.0:1883
排查步骤:
- 检查网络接口
ip addr show
ifconfig
- 检查防火墙设置
# Linux
iptables -L
ufw status
# Windows
netsh advfirewall firewall show rule name=all
- 检查端口监听
ss -tulpn | grep :1883
解决方案:
- 配置防火墙规则
- 检查网络接口状态
- 验证 IP 地址配置
认证失败
问题现象:
ERROR: Authentication failed for client
排查步骤:
- 检查认证配置
curl -X GET "http://localhost:8080/api/endpoints/get?port=1883"
- 验证认证数据源
# 检查数据库连接
mysql -h localhost -u root -p -e "SELECT * FROM users;"
# 检查 Redis 连接
redis-cli ping
- 查看认证日志
tail -f logs/fluxmq.log | grep "Auth"
解决方案:
- 验证认证配置
- 检查数据源连接
- 确认用户凭据
配置问题排查
配置不生效
问题现象:
WARN: Configuration not applied
排查步骤:
- 检查配置语法
curl -X POST "http://localhost:8080/api/endpoints/validate" \
-H "Content-Type: application/json" \
-d '{"port": 1883, "enableAuth": true}'
- 验证集群状态
curl -X GET "http://localhost:8080/api/cluster/status"
- 检查 Ignite 缓存
# 查看 Ignite 缓存状态
curl -X GET "http://localhost:8080/api/ignite/status"
解决方案:
- 修正配置语法错误
- 重启相关服务
- 检查集群同步状态