Docker Compose单机安装elasticsearch7.16.3
文章目录
https://www.elastic.co/guide/en/elasticsearch/reference/7.16/docker.html
文件结构
└── elasticsearch
├── node-00
│ ├── config
│ │ └── elasticsearch.yml
│ ├── data
│ ├── docker-compose.yml
│ ├── logs
│ └── plugins
│ └── ik
├── node-01
│ ├── config
│ │ └── elasticsearch.yml
│ ├── data
│ ├── docker-compose.yml
│ ├── logs
│ └── plugins
│ └── ik
└── node-02
├── config
│ └── elasticsearch.yml
├── data
├── docker-compose.yml
├── logs
└── plugins
└── ik
chown 1000:1000 data
chown 1000:1000 logs
配置
- 创建公用docker network
docker network ls
docker network create --driver bridge elastic
- 创建各个node的docker-compose.yml
- node-00
version: "3"
services:
es-node-00:
image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3
container_name: es-node-00
environment:
- "TZ=Asia/Shanghai"
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
restart: always
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
ports:
- 9200:9200
- 9300:9300
networks:
- elastic
volumes:
- ./config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- ./data:/usr/share/elasticsearch/data
- ./plugins:/usr/share/elasticsearch/plugins
- ./logs:/usr/share/elasticsearch/logs
networks:
elastic:
external: true
- node-01
version: "3"
services:
es-node-01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3
container_name: es-node-01
environment:
- "TZ=Asia/Shanghai"
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
restart: always
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
ports:
- 9201:9200
- 9301:9300
networks:
- elastic
volumes:
- ./config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- ./data:/usr/share/elasticsearch/data
- ./plugins:/usr/share/elasticsearch/plugins
- ./logs:/usr/share/elasticsearch/logs
networks:
elastic:
external: true
- node-02
version: "3"
services:
es-node-02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3
container_name: es-node-02
environment:
- "TZ=Asia/Shanghai"
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
restart: always
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
ports:
- 9202:9200
- 9302:9300
networks:
- elastic
volumes:
- ./config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- ./data:/usr/share/elasticsearch/data
- ./plugins:/usr/share/elasticsearch/plugins
- ./logs:/usr/share/elasticsearch/logs
networks:
elastic:
external: true
- config/elasticsearch.yml
- node-00
cluster.name: my-es-cluster
node.name: es-node-00
network.host: es-node-00
http.port: 9200
transport.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.seed_hosts: ["es-node-01", "es-node-02"]
bootstrap.memory_lock: true
cluster.initial_master_nodes: ["es-node-00", "es-node-01", "es-node-02"]
#disable the usage of geoip functionality
ingest.geoip.downloader.enabled: false
- node-01
cluster.name: my-es-cluster
node.name: es-node-01
network.host: es-node-01
http.port: 9200
transport.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.seed_hosts: ["es-node-00", "es-node-02"]
bootstrap.memory_lock: true
cluster.initial_master_nodes: ["es-node-00", "es-node-01", "es-node-02"]
#disable the usage of geoip functionality
ingest.geoip.downloader.enabled: false
- node-02
cluster.name: my-es-cluster
node.name: es-node-02
network.host: es-node-02
http.port: 9200
transport.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.seed_hosts: ["es-node-00", "es-node-01"]
bootstrap.memory_lock: true
cluster.initial_master_nodes: ["es-node-00", "es-node-01", "es-node-02"]
#disable the usage of geoip functionality
ingest.geoip.downloader.enabled: false
kibana
https://www.elastic.co/guide/en/kibana/7.16/docker.html
kibana/
├── config
│ ├── kibana.yml
│ └── node.options
└── docker-compose.yml
docker-compose.yml
version: "3"
services:
kibana:
image: docker.elastic.co/kibana/kibana:7.16.3
container_name: kibana
environment:
- TZ=Asia/Shanghai
- ELASTICSEARCH_URL=http://es-node-00:9200
- ELASTICSEARCH_HOSTS=["http://es-node-00:9200","http://es-node-01:9200","http://es-node-02:9200"]
volumes:
- ./config/kibana.yml:/usr/share/kibana/config/kibana.yml
- ./config/node.options:/usr/share/kibana/config/node.options
restart: always
ports:
- 5601:5601
networks:
- elastic
networks:
elastic:
external: true
kibana.yml
#
# ** THIS IS AN AUTO-GENERATED FILE **
#
# Default Kibana configuration for docker target
server.host: "0.0.0.0"
server.shutdownTimeout: "5s"
elasticsearch.hosts: [ "http://es-node-00:9200" ]
monitoring.ui.container.elasticsearch.enabled: true
node.options
## Node command line options
## See `node --help` and `node --v8-options` for available options
## Please note you should specify one option per line
## max size of old space in megabytes
#--max-old-space-size=4096
## do not terminate process on unhandled promise rejection
--unhandled-rejections=warn
cerebro
docker-compose.yml
version: "3"
services:
cerebro:
image: lmenezes/cerebro:0.9.4
container_name: cerebro
environment:
- TZ=Asia/Shanghai
restart: always
ports:
- 9000:9000
networks:
- elastic
networks:
elastic:
external: true