This commit is contained in:
hailin 2025-11-24 03:43:25 -08:00
parent cf706d95a8
commit d09af9aa3e
1 changed files with 9 additions and 2 deletions

View File

@ -37,9 +37,16 @@ check_service() {
echo -e "${YELLOW}=== 数据库服务 ===${NC}"
check_service "PostgreSQL" "pg_isready -h localhost -p 5432" "sudo systemctl start postgresql"
# 检查 Redis
# 检查 Redis (支持 Docker 和本地)
echo -e "${YELLOW}=== 缓存服务 ===${NC}"
check_service "Redis" "redis-cli -h localhost -p 6379 ping" "redis-server --daemonize yes"
# 尝试使用 redis-cli如果失败则尝试 docker exec最后尝试 nc
if command -v redis-cli &> /dev/null; then
check_service "Redis" "redis-cli -h localhost -p 6379 ping" "docker start identity-service-redis-1 或 redis-server --daemonize yes"
elif command -v docker &> /dev/null; then
check_service "Redis" "docker exec identity-service-redis-1 redis-cli ping" "docker start identity-service-redis-1"
else
check_service "Redis" "nc -zv localhost 6379" "docker start identity-service-redis-1"
fi
# 检查 Kafka
echo -e "${YELLOW}=== 消息队列服务 ===${NC}"