Elastic Stack
elasticsearch集群
mkdir ~/elasticsearch/data{
01...03}
mkdir ~/elasticsearch/logs{
01...03}
制作数字证书
sudo docker run --name elasticsearch -exec -it --rm elasticsearch:7.14.1 /bin/bash
./bin/elasticsearch-certutil ca
./bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12 --out config/elastic-certificates.p12
chmod 644 config/elastic-certificates.p12
sudo docker cp elasticsearch:/user/share/elasticsearch/config/elastic-certificates.p12 ~/elasticsearch/
docker-compose.yml
version: '3.8'
services:
es01:
image: elasticsearch:7.14.1
container_name: es01
privileged: true
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
- xpack.security.enabled=true
- xpack.security.transport.ssl.enabled=true
- xpack.monitoring.collection.enabled=true
- xpack.security.transport.ssl.verification_mode=certificate
- xpack.security.transport.ssl.keystore.path=elastic-certificates.p12
- xpack.security.transport.ssl.truststore.path=elastic-certificates.p12
- "ES_JAVA_OPTS=-Xms32G -Xmx32G"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- ~/elasticsearch/data01:/usr/share/elasticsearch/data
- ~/elasticsearches/log01:/usr/share/elasticsearch/logs
- ~/elasticsearch/elastic-certificates.p12:/usr/share/elasticsearch/config/elastic-certificates.p12
ports:
- 9200:9200
networks:
- elastic
es02:
image: elasticsearch:7.14.1
container_name: es02
privileged: true
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
- xpack.security.enabled=true
- xpack.security.transport.ssl.enabled=true
- xpack.monitoring.collection.enabled=true
- xpack.security.tran