docker-compose 배치es 집단
mkdir -p /home/elfk/elasticsearch/config
mkdir /home/elfk/elasticsearch/{data1,data2,data3}
cd /home/elfk
echo 'ELK_VERSION=7.5.1' > .env
tree .
.
├── docker-compose.yml
└── elasticsearch
├── config
│ └── elasticsearch.yml
├── data1
├── data2
├── data3
└── Dockerfile
5 directories, 3 files
elasticsearch
Dockerfile
vim /home/elfk/elasticsearch/Dockerfile
ARG ELK_VERSION=7.5.1
# https://github.com/elastic/elasticsearch-docker
# FROM docker.elastic.co/elasticsearch/elasticsearch:${ELK_VERSION}
FROM elasticsearch:${ELK_VERSION}
# Add your elasticsearch plugins setup here
# Example: RUN elasticsearch-plugin install analysis-icu
elasticsearch.yml
vim /home/elfk/elasticsearch/config/elasticsearch.yml
---
## Default Elasticsearch configuration from Elasticsearch base image.
## https://github.com/elastic/elasticsearch/blob/master/distribution/docker/src/docker/config/elasticsearch.yml
#
cluster.name: "es-docker-cluster"
network.host: 0.0.0.0
## X-Pack settings
## see https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-xpack.html
#
xpack.license.self_generated.type: trial #trial , , basic
xpack.security.enabled: true
xpack.monitoring.collection.enabled: true
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
docker-compose.yml
vim /home/elfk/docker-compose.yml
version: '3.7'
services:
es01:
build:
context: elasticsearch/
args:
ELK_VERSION: $ELK_VERSION
container_name: es01
volumes:
- type: bind
source: ./elasticsearch/config/elasticsearch.yml
target: /usr/share/elasticsearch/config/elasticsearch.yml
read_only: true
- type: volume
source: data01
target: /usr/share/elasticsearch/data
ports:
- 9200:9200
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
networks:
- elastic
es02:
build:
context: elasticsearch/
args:
ELK_VERSION: $ELK_VERSION
container_name: es02
volumes:
- type: bind
source: ./elasticsearch/config/elasticsearch.yml
target: /usr/share/elasticsearch/config/elasticsearch.yml
read_only: true
- type: volume
source: data02
target: /usr/share/elasticsearch/data
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
networks:
- elastic
es03:
build:
context: elasticsearch/
args:
ELK_VERSION: $ELK_VERSION
container_name: es03
volumes:
- type: bind
source: ./elasticsearch/config/elasticsearch.yml
target: /usr/share/elasticsearch/config/elasticsearch.yml
read_only: true
- type: volume
source: data03
target: /usr/share/elasticsearch/data
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
networks:
- elastic
volumes:
data01:
driver: local
driver_opts:
type: none
o: bind
device: /home/elfk/elasticsearch/data1
data02:
driver: local
driver_opts:
type: none
o: bind
device: /home/elfk/elasticsearch/data2
data03:
driver: local
driver_opts:
type: none
o: bind
device: /home/elfk/elasticsearch/data3
networks:
elastic:
driver: bridge
if [ $(grep 'vm.max_map_count' /etc/sysctl.conf |wc -l) -eq 0 ] ; \
then echo 'vm.max_map_count=655360' >> /etc/sysctl.conf; \
fi
sysctl -p
docker-compose up --build -d
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5af70e32dbb8 elfk_es01 "/usr/local/bin/dock…" 14 seconds ago Up 6 seconds 0.0.0.0:9200->9200/tcp, 9300/tcp es01
793bab4160b7 elfk_es03 "/usr/local/bin/dock…" 14 seconds ago Up 6 seconds 9200/tcp, 9300/tcp es03
93ffa61c639f elfk_es02 "/usr/local/bin/dock…" 14 seconds ago Up 6 seconds 9200/tcp, 9300/tcp es02
netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1303/master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 936/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1303/master
tcp6 0 0 :::9200 :::* LISTEN 8724/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 936/sshd
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Docker For Mac 느림: 대책 실험(docker-sync)총결한 자료에서 실제 테스트의 내용을 총결하였다.(인간^-^) 나는 회사 Laravel 프로젝트의 Docker 개발 환경에서 시도한 적이 있다. 우선 Docker-compose입니다.나는 yml을 분석하고 동기화 대...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.