I' having issues setting up my docker-compose.yml file to get 2 Elasticsearch nodes running with Kibana.
Getting the error 'Kibana server is not ready yet'
In the container logs I'm getting
{"type":"log","@timestamp":"2020-04-11T13:19:45Z","tags":["warning","elasticsearch","data"],"pid":7,"message":"No living connections"}
{"type":"log","@timestamp":"2020-04-11T13:19:45Z","tags":["warning","plugins","licensing"],"pid":7,"message":"License information could not be obtained from Elasticsearch due to Error: No Living connections error"}
{"type":"log","@timestamp":"2020-04-11T13:19:45Z","tags":["warning","elasticsearch","admin"],"pid":7,"message":"Unable to revive connection: http://elasticsearch:9200/"}
My docker-compose.yml file looks as follows:
version: '3'
services:
#PHP Service
app:
build:
context: .
dockerfile: Dockerfile
image: digitalocean.com/php
container_name: app
restart: unless-stopped
tty: true
environment:
SERVICE_NAME: app
SERVICE_TAGS: dev
working_dir: /var/www
volumes:
- ./:/var/www
- ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
ports:
- "9000:9000"
networks:
- app-network
#Nginx Service
webserver:
image: nginx:alpine
container_name: webserver
restart: unless-stopped
tty: true
ports:
- "80:80"
- "443:443"
volumes:
- ./:/var/www
- ./nginx/conf.d/:/etc/nginx/conf.d/
networks:
- app-network
#MySQL Service
db:
image: mysql:5.7.29
container_name: db
restart: unless-stopped
tty: true
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: pipeup
MYSQL_USER: pu_admin
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: secret
SERVICE_TAGS: dev
SERVICE_NAME: mysql
volumes:
- dbdata:/var/lib/mysql/
- ./mysql/my.cnf:/etc/mysql/my.cnf
networks:
- app-network
#Redis
cache:
image: redis:rc-alpine3.11
container_name: cache
ports:
- "6382:6379"
networks:
- app-network
# Elasticsearch
elasticsearch01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: elasticsearch01
environment:
- cluster.name=docker-cluster
- discovery.seed_hosts=elasticsearch02
- cluster.initial_master_nodes=elasticsearch01,elasticsearch02
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- node.name=elasticsearch01
ulimits:
memlock:
soft: -1
hard: -1
ports:
- "9200:9200"
volumes:
- esdata01:/usr/share/elasticsearch/data
networks:
- app-network
elasticsearch02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: elasticsearch02
environment:
- cluster.name=docker-cluster
- discovery.seed_hosts=elasticsearch01
- cluster.initial_master_nodes=elasticsearch01,elasticsearch02
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- node.name=elasticsearch02
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata02:/usr/share/elasticsearch/data
networks:
- app-network
kibana:
image: docker.elastic.co/kibana/kibana:7.6.2
container_name: kibana
environment:
- "elasticsearch.hosts=http://elasticsearch:9200"
ports:
- "5601:5601"
networks:
- app-network
#Docker Networks
networks:
app-network:
driver: bridge
#Volumes
volumes:
dbdata:
driver: local
esdata01:
driver: local
esdata02:
driver: local
You need to set the host like this and point to one of the containers.
Change your docker-compose.yml to this:
kibana:
image: docker.elastic.co/kibana/kibana:7.6.2
container_name: kibana
environment:
- "ELASTICSEARCH_HOSTS=http://elasticsearch01:9200" # Change this
ports:
- "5601:5601"
networks:
- app-network
To make this work you should set the ELASTICSEARCH_HOSTS
environment variable correctly:
kibana:
image: docker.elastic.co/kibana/kibana:7.6.2
container_name: kibana
environment:
- ELASTICSEARCH_HOSTS=["http://elasticsearch01:9200","http://elasticsearch02:9200"]
This shows how to set this environment varibale to be picked by Kibana container for multiple elasticsearch hosts (I have just tested it).
If you just want one host then use:
kibana:
image: docker.elastic.co/kibana/kibana:7.6.2
container_name: kibana
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch01:9200
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.