我正在尝试通过 docker-compose.yml 文件安装 kibana 和 elasticsearch,我得到了 {"type":"log","@timestamp":"2024-01-09T18:24:14+00:00", "tags":["error","elasticsearch-service"],"pid":1,"message":"无法从 Elasticsearch 节点检索版本信息。getaddrinfo EAI_AGAIN elasticsearch"} 从 kibana 容器的日志中。 elasticsearch 容器工作正常。你能帮我找出问题所在吗?
version: '3'
services:
web:
image: logex/web
build:
context: front
dockerfile: Dockerfile.dev
container_name: logex-front
ports:
- "3000:80"
networks:
- web-network
depends_on:
- server
server:
image: logex/server
build:
context: logex_app
dockerfile: Dockerfile.dev
args:
DATA_PATH: ${LOGEX_RECOVERY_BASE_DIR}
container_name: logex-app
command: "api"
volumes:
- logex-data:${LOGEX_RECOVERY_BASE_DIR}
networks:
- server-network
ports:
- "${LOGEX_API_PORT}:8000"
env_file:
- .env
depends_on:
- mongo
- rabbit
- elastic
mongo:
container_name: logex-mongo
image: "bitnami/mongodb:6.0"
restart: always
env_file:
- .env
environment:
- MONGODB_DATABASE=${LOGEX_DB_NAME}
- MONGODB_ROOT_USER=${LOGEX_DB_USERNAME}
- MONGODB_ROOT_PASSWORD=${LOGEX_DB_PASSWORD}
ports:
- "${LOGEX_DB_PORT}:27017"
networks:
- server-network
volumes:
- "mongo-data:/bitnami/mongodb"
elastic:
container_name: logex-elastic
image: "bitnami/elasticsearch:7.17.10"
restart: always
env_file:
- .env
environment:
- ELASTICSEARCH_PORT_NUMBER=${LOGEX_SE_PORT}
ports:
- "${LOGEX_SE_PORT}:${LOGEX_SE_PORT}"
networks:
- server-network
volumes:
- "elastic-data:/bitnami/elasticsearch/data"
depends_on:
- mongo
rabbit:
container_name: logex-rabbit
image: "bitnami/rabbitmq:3.10.5-debian-11-r11"
restart: always
env_file:
- .env
environment:
- RABBITMQ_USERNAME=${LOGEX_MQ_USERNAME}
- RABBITMQ_PASSWORD=${LOGEX_MQ_PASSWORD}
- RABBITMQ_VHOST=${LOGEX_MQ_VIRTUAL_HOST}
ports:
- "${LOGEX_MQ_PORT}:5672"
networks:
- server-network
volumes:
- "rabbit-data:/bitnami/rabbitmq/mnesia"
kibana:
container_name: logex-kibana
image: "bitnami/kibana:7.17.10"
restart: always
env_file:
- .env
environment:
- ELASTICSEARCH_HOSTS=http://logex-elastic:${LOGEX_SE_PORT}
ports:
- "${LOGEX_KIBANA_PORT}:${LOGEX_KIBANA_PORT}"
networks:
- server-network
depends_on:
- elastic
volumes:
mongo-data:
elastic-data:
driver: local
kibana-data:
driver: local
rabbit-data:
logex-data:
networks:
server-network:
driver: bridge
driver_opts:
com.docker.network.bridge.enable_icc: "true"
web-network:
driver: bridge
我已经检查了 kibana 和 elasticsearch 容器的日志。 Elastic Search 容器工作正常,但 kibana 容器不工作。
在这种情况下Kibana与elasticsearch存在连接问题。我遇到过类似的问题三次(不是容器化的)。
第一个罪魁祸首是 ELASTICSEARCH_HOST。我打错字了。
在第二个中,它是我的服务器之间的防火墙。
在第三个中,罪魁祸首是内置的 kibana 用户。