Common problems and resolutions
502 errors - Chat API unreachable or unhealthy behind NGINX- Check service health:
docker service ps <chat-api-service> - Review NGINX upstreams and logs for routing errors.
- Inspect lag:
kafka-consumer-groups --describe --group <group> --bootstrap-server <broker> - Increase partitions if needed:
kafka-topics --alter --partitions <count> --topic <topic> --bootstrap-server <broker>.
- Inspect memory settings:
redis-cli config get maxmemoryandredis-cli config get maxmemory-policy - Apply an eviction policy such as
redis-cli config set maxmemory-policy allkeys-lru.
- Check cluster status:
tiup cluster display - Rebalance if required:
tiup cluster restart <cluster-name> --force.
Debugging commands
Container and Swarm diagnostics:Log locations
- NGINX:
/var/log/nginx/ - Application logs: via
docker logsper container - TiDB:
/logs/tidb/ - Kafka:
/logs/kafka/