Может быть, я потратил 6 часов на поиски ответа.Но я не мог найти никакого решения для этого.Я хочу увеличить 1 узелasticsearch +1 кибана с помощью nginx (для балансировки нагрузки, прокси-сервера и безопасности). Но когда докер создает ошибку в части kibana. Как я могу разместить узел эластичного поиска-кибана с nginx, используя приведенные ниже коды?
Error:Unable to revive connection: http://elasticsearch:9200/
Elasticsearch.yml:
network.host: localhost
http.port: 9200
xpack.security.enabled: false
xpack.monitoring.enabled: true
xpack.graph.enabled: false
xpack.watcher.enabled: false
ElasticSearch Dockerfile:
FROM docker.elastic.co/elasticsearch/elasticsearch:6.6.2
COPY ./config/elasticsearch.yml /usr/share/elasticsearch/config/elasticsearch.yml
RUN elasticsearch-plugin install analysis-kuromoji
kibana.yml:
---
# Default Kibana configuration from kibana-docker.
server.name: kibana
server.host: "0"
elasticsearch.url: http://elasticsearch:9200
elasticsearch.username: elastic
elasticsearch.password: changeme
xpack.monitoring.ui.container.elasticsearch.enabled: true
Kibana Dockerfile:
FROM docker.elastic.co/kibana/kibana:6.6.2
COPY ./config/kibana.yml /opt/kibana/config/kibana.yml
RUN apt-get update && apt-get install -y netcat
COPY entrypoint.sh /tmp/entrypoint.sh
RUN chmod +x /tmp/entrypoint.sh
RUN kibana plugin --install elastic/sense
CMD ["/tmp/entrypoint.sh"]
entrypoint.sh:
#!/usr/bin/env bash
# Wait for the Elasticsearch container to be ready before starting Kibana.
echo "Stalling for Elasticsearch"
while true; do
nc -q 1 elasticsearch 9200 2>/dev/null && break
done
echo "Starting Kibana"
exec kibana
nginx.conf:
upstream elasticsearch {
server 38.252.127.221:9200;
keepalive 15;
}
upstream kibana {
server 38.252.127.221:5601;
keepalive 15;
}
server {
listen 9200;
location / {
auth_basic "Protected Elasticsearch";
auth_basic_user_file /etc/nginx/htpasswd.users;
proxy_pass http://elasticsearch;
proxy_redirect off;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
}
}
server {
listen 5601;
location / {
auth_basic "Protected Kibana";
auth_basic_user_file /etc/nginx/htpasswd.users;
proxy_pass http://kibana;
proxy_redirect off;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
}
}
docker-compose.yml
version: '2'
services:
elasticsearch:
container_name: esc
image: esi:1.0.0
build: ./es
volumes:
- ./data/es:/usr/share/elasticsearch/data
ports:
- 9200:9200
expose:
- 9300
kibana:
container_name: kibanac
image: kibanai:1.0.0
build: ./kibana
links:
- elasticsearch
ports:
- 5601:5601
nginx:
image: nginx:latest
restart: unless-stopped
volumes:
- ./nginx/config:/etc/nginx/conf.d:ro,Z
- ./nginx/htpasswd.users:/etc/nginx/htpasswd.users:ro,Z
ports:
- "8900:5601"
- "8901:9200"
depends_on:
- elasticsearch
- kibana