This commit is contained in:
2025-11-01 15:24:04 +08:00
parent 68d434e3c4
commit fb590926e7
10 changed files with 365 additions and 13 deletions

View File

@@ -73,6 +73,22 @@ else
echo -e "${YELLOW}请确保Redis容器已连接到 ${NETWORK_NAME} 网络${NC}"
fi
# 检查Elasticsearch容器是否在proxy网络中
echo -e "${YELLOW}检查Elasticsearch容器...${NC}"
ES_CONTAINERS=$(docker network inspect ${NETWORK_NAME} --format '{{range .Containers}}{{.Name}} {{end}}' | tr ' ' '\n' | grep -i elasticsearch || true)
if [ ! -z "$ES_CONTAINERS" ]; then
echo -e "${GREEN}找到Elasticsearch容器:${NC}"
echo "$ES_CONTAINERS" | while read container; do
if [ ! -z "$container" ]; then
echo -e "${GREEN} - ${container}${NC}"
fi
done
else
echo -e "${RED}未找到Elasticsearch容器${NC}"
echo -e "${YELLOW}请确保Elasticsearch容器已连接到 ${NETWORK_NAME} 网络${NC}"
fi
# 测试网络连通性
echo -e "${YELLOW}测试网络连通性...${NC}"
if docker run --rm --network ${NETWORK_NAME} alpine ping -c 1 mysql &> /dev/null; then
@@ -87,4 +103,10 @@ else
echo -e "${RED}无法ping通redis容器${NC}"
fi
if docker run --rm --network ${NETWORK_NAME} alpine ping -c 1 elasticsearch &> /dev/null; then
echo -e "${GREEN}可以ping通elasticsearch容器${NC}"
else
echo -e "${RED}无法ping通elasticsearch容器${NC}"
fi
echo -e "${GREEN}网络检查完成!${NC}"