services:
app1:
image: elasticsearch:8.4.2
container_name: elasticsearch
hostname: elasticsearch
volumes:
- ./elasticsearch/data:/usr/share/elasticsearch/data
- ./elasticsearch/plugins:/usr/share/elasticsearch/plugins
- ./elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
ports:
- 9200:9200
environment:
ELASTIC_PASSWORD: password
ES_JAVA_OPTS: -Xms128m -Xmx1024m
mem_limit: 1073741824
ulimits:
memlock:
soft: -1
hard: -1
healthcheck:
test:
[
"CMD-SHELL",
"curl -s https://localhost:9200 | grep -q 'missing authentication credentials'",
]
interval: 10s
timeout: 10s
retries: 120
app2:
image: kibana:8.4.2
container_name: kibana
hostname: kibana
command: "curl --user elastic:password -XPUT 'http://localhost:9200/_security/user/kibana_system/_password' -H 'Content-Type: application/json' -d'{ \"password\" : \"password\"}'"
volumes:
- ./kibana.yml:/usr/share/kibana/config/kibana.yml
ports:
- 5601:5601
environment:
ES_JAVA_OPTS: -Xms128m -Xmx1024m
mem_limit: 1073741824
healthcheck:
test:
[
"CMD-SHELL",
"curl -s https://localhost:5601 | grep -q 'missing authentication credentials'",
]
interval: 10s
timeout: 10s
retries: 120
depends_on:
- app1
mkdir -p elasticsearch/{config,data,plugins} && chmod 777 -R elasticsearch
echo vm.max_map_count=262144 >> /etc/sysctl.conf
sysctl -w vm.max_map_count=262144
curl --user elastic:password -XPUT 'http://localhost:9200/_security/user/kibana_system/_password' -H 'Content-Type: application/json' -d'{ "password" : "password"}'
docker exec -it elasticsearch elasticsearch-setup-passwords interactive
docker exec -it elasticsearch elasticsearch-reset-password -u kibana_system
# elasticsearch.yml
network.host: "0.0.0.0"
bootstrap.memory_lock: false
node.name: es01
cluster.name: es-cluster
discovery.type: single-node
xpack.security.enabled: true
xpack.security.http.ssl.enabled: false
xpack.security.transport.ssl.enabled: false
xpack.license.self_generated.type: basic
ingest.geoip.downloader.enabled: false
http.cors.enabled: true
http.cors.allow-origin: "*"
# kibana.yml
network.host: "0.0.0.0"
server.port: 5601
server.host: "kibana"
server.name: "kibana"
server.ssl.enabled: false
elasticsearch.hosts: ["http://elasticsearch:9200"]
elasticsearch.username: kibana_system
elasticsearch.password: password
monitoring.ui.container.elasticsearch.enabled: true
xpack.reporting.roles.enabled: false
xpack.reporting.encryptionKey: a_random_string
xpack.security.encryptionKey: something_at_least_32_characters
xpack.encryptedSavedObjects.encryptionKey: fhjskloppd678ehkdfdlliverpoolfcr
i18n.locale: "zh-CN"
标签:ELK,9200,xpack,enabled,kibana,elasticsearch,password
From: https://www.cnblogs.com/yzpopulation/p/16743515.html