gpt4 book ai didi

elasticsearch - 如何在一个 docker compose 文件中包含 Elastic Search(具有多个节点)和 Kibana?

转载 作者:行者123 更新时间:2023-12-05 02:01:57 26 4
gpt4 key购买 nike

我已经从 Elastic Search 网站成功安装了一个 3 节点 Elastic Search 集群,其中包含一个 docker compose 文件,没有任何问题 elastic search link .我正在尝试将 Kibana 添加到 .yml 文件中,以便我可以使用 docker-compose up 运行它,并且正在查看这个 Elastic Search Kibana 安装站点以尝试弄清楚要添加什么 Kibana install site .当我尝试启动我创建的文件时,出现此错误 kibana_1 | {"type":"log","@timestamp":"2021-02-13T11:20:31Z","tags":["error","elasticsearch","data"],"pid":8, “消息”:[ConnectionError]:getaddrinfo ENOTFOUND elasticsearch elasticsearch:9200”。当我打开 http://localhost:5601 时,它显示 Kibana server not ready yet。有人可以帮我解决这个问题吗?我在 .yml 文件中标记了我添加的部分。

version: '2.2'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.11.0
container_name: es01
environment:
- node.name=es01
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es02,es03
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data01:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- elastic
es02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.11.0
container_name: es02
environment:
- node.name=es02
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es01,es03
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data02:/usr/share/elasticsearch/data
networks:
- elastic
es03:
image: docker.elastic.co/elasticsearch/elasticsearch:7.11.0
container_name: es03
environment:
- node.name=es03
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es01,es02
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data03:/usr/share/elasticsearch/data
networks:
- elastic

##############################
# My attempt at adding Kibana to the docker file. This file works
# fine if commenting out this whole section.
kibana:
image: docker.elastic.co/kibana/kibana:7.10.2
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
ports:
- 5601:5601
##############################

volumes:
data01:
driver: local
data02:
driver: local
data03:
driver: local

networks:
elastic:
driver: bridge

最佳答案

确保为 Docker Engine 分配至少 4GiB 的内存。

docker-compose.yml

version: '3.7'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
container_name: es01
environment:
- node.name=es01
- cluster.name=docker-cluster
- discovery.seed_hosts=es02,es03
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- xpack.security.enabled=true
- ELASTIC_PASSWORD=password
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"

ulimits:
memlock:
soft: -1
hard: -1
ports:
- 9200:9200
networks:
- elastic
es02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
container_name: es02
environment:
- node.name=es02
- cluster.name=docker-cluster
- discovery.seed_hosts=es01,es03
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- xpack.security.enabled=true
- ELASTIC_PASSWORD=password
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
networks:
- elastic
es03:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
container_name: es03
environment:
- node.name=es03
- cluster.name=docker-cluster
- discovery.seed_hosts=es01,es02
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- xpack.security.enabled=true
- ELASTIC_PASSWORD=password
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
networks:
- elastic

kibana:
image: kibana:7.9.2
ports:
- '5601:5601'
volumes:
- ./kibana.yml:/usr/share/kibana/config/kibana.yml




logstash:
image: logstash:7.9.2
ports:
- '5000:5000'
volumes:
- type: bind
source: ./logstash_pipeline/
target: /usr/share/logstash/pipeline
read_only: true


networks:
elastic:
driver: bridge

kiban.yml

server.name: kibana
server.host: 0.0.0.0
server.port: 5601
elasticsearch.hosts: [ "http://<ELK server ip>:9200" ]
monitoring.ui.container.elasticsearch.enabled: true

## X-Pack security credentials
#
elasticsearch.username: elastic
elasticsearch.password: password

创建一个名为 logstash_pipeline 的目录并在该目录中创建一个文件 beats.conf

beats.conf

input {
beats {
port => 5044
}

}

## Add your filters / logstash plugins configuration here

output {
elasticsearch {
hosts => "127.0.0.1:9200"
index => "filebeat-%{+yyyy.MM.dd}"
user => "elastic"
password => "password"
ecs_compatibility => disabled
}
}

在生产中的 Docker 中运行 Elasticsearch 时,以下要求和建议适用。

将 vm.max_map_count 至少设置为 262144edit vm.max_map_count 内核设置必须至少设置为 262144 才能用于生产。

如何设置 vm.max_map_count 取决于您的平台:

vm.max_map_count 设置应该在/etc/sysctl.conf 中永久设置:

grep vm.max_map_count /etc/sysctl.conf
vm.max_map_count=262144

要在实时系统上应用设置,请运行:

sysctl -w vm.max_map_count=262144

运行 docker compose 启动三节点 Elasticsearch 集群和 Kibana

docker-compose up

关于elasticsearch - 如何在一个 docker compose 文件中包含 Elastic Search(具有多个节点)和 Kibana?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66184415/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com