1. docker pull docker.elastic.co/elasticsearch/elasticsearch:7.0.1
2. sysctl -w vm.max_map_count=262144
3.创建docker-compose.yml
version: ‘2.2’
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.0.1
container_name: es01
environment:
- node.name=es01
- discovery.seed_hosts=es02
- cluster.initial_master_nodes=es01,es02
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- “ES_JAVA_OPTS=-Xms512m -Xmx512m”
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata01:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- esnet
es02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.0.1
container_name: es02
environment:
- node.name=es02
- discovery.seed_hosts=es01
- cluster.initial_master_nodes=es01,es02
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- “ES_JAVA_OPTS=-Xms512m -Xmx512m”
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata02:/usr/share/elasticsearch/data
networks:
- esnet
volumes:
esdata01:
driver: local
esdata02:
driver: local
networks:
esnet:
4.启动:docker-compose up
5.检测安装结果:
curl http://127.0.0.1:9200/_cat/health
6.开启端口及外网访问
firewall-cmd --zone=public --query-port=9200/tcp
firewall-cmd --reload
firewall-cmd --zone=public --query-port=9200/tcp
7. 安装kibana
docker pull docker.elastic.co/kibana/kibana:7.0.1
touch/data/dockerFile/kibana/kibana.yml,添加如下内容:
server.name: kibana
server.host: “0”
elasticsearch.hosts: [ “http://172.26.20.114:9200” ]
docker run --name kibana7 -v /data/dockerFile/kibana/kibana.yml:/usr/share/kibana/config/kibana.yml -p 5601:5601 -d docker.elastic.co/kibana/kibana:7.0.1