安装docker
wget -qO- https://get.docker.com/ | sh
安装docker-compose
sudo curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
新建docker-compose.yml
参考:极客时间
version: '2.2'
services:
kibana:
image: docker.elastic.co/kibana/kibana:7.3.0
container_name: kibana73
environment:
- I18N_LOCALE=zh-CN
- XPACK_GRAPH_ENABLED=true
- TIMELION_ENABLED=true
- XPACK_MONITORING_COLLECTION_ENABLED="true"
ports:
- "5601:5601"
networks:
- quyue-net
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.3.0
container_name: quyue-es1
environment:
- cluster.name=quyue-es
- node.name=quyue-es1
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- discovery.seed_hosts=quyue-es1,quyue-es2
- cluster.initial_master_nodes=quyue-es1,quyue-es2
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- quyue-data1:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- quyue-net
elasticsearch2:
image: docker.elastic.co/elasticsearch/elasticsearch:7.3.0
container_name: quyue-es2
environment:
- cluster.name=quyue-es
- node.name=quyue-es2
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- discovery.seed_hosts=quyue-es1,quyue-es2
- cluster.initial_master_nodes=quyue-es1,quyue-es2
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- quyue-data2:/usr/share/elasticsearch/data
networks:
- quyue-net
volumes:
quyue-data1:
driver: local
quyue-data2:
driver: local
networks:
quyue-net:
driver: bridge
错误解决:
虚拟内存错误
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决办法:
在 /etc/sysctl.conf文件最后添加一行
vm.max_map_count=2621440
执行
sysctl -p