一、docker-compose.yml文件
version: '3'
services:
elasticsearch:
image: elasticsearch:6.4.3
container_name: elasticsearch
volumes:
- /docker/elasticsearch/data:/usr/share/elasticsearch/data:rw
- /docker/elasticsearch/conf/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- /docker/elasticsearch/logs:/user/share/elasticsearch/logs:rw
ports:
- "9200:9200"
- "9300:9300"
environment:
- discovery.type=single-node
es-head:
image: tobias74/elasticsearch-head:6
container_name: es-head
ports:
- "9100:9100"
二、编写elasticsearch.yml文件
bootstrap.memory_lock: false
cluster.name: "es-server"
node.name: node-1
node.master: true
node.data: true
network.host: 0.0.0.0
http.port: 9200
path.logs: /usr/share/elasticsearch/logs
http.cors.enabled: true
http.cors.allow-origin: "*"
xpack.security.audit.enabled: true