通过Docker使用Elasticsearch
[root@Dockh ~]#docker pull docker.elastic.co/elasticsearch/elasticsearch:5.3.0
尝试拉取仓库docker.elastic.co/elasticsearch/elasticsearch…
5.3.0:正在从docker.elastic.co/elasticsearch/elasticsearch拉取
3690ec4760f9:拉取完毕
f52154c3d3fc:拉取完毕
4075cc5db14a:拉取完毕
2d52f619a2d6:拉取完毕
8bb7b04253b3:拉取完毕
1cb5a2a95e15:拉取完毕
e2f60cff0f2f:拉取完毕
9eb2cf345f74:拉取完毕
ff68f5fa0401:拉取完毕
90f6e7841041:拉取完毕
摘要:摘要:sha256:56ac964338bc74f3874d63271433f6555648d55405a89c96f56a18dee48456eb
[root@Dockh ~]#docker images
仓库标签IMAGE ID已创建大小
docker.elastic.co/elasticsearch/elasticsearch5.3.0ccec59a7dd843 weeks ago 206.4 MB
[root@Dockh ~]#
docker-compose.yml 的中文释义为“Docker 配置文件”。
[root@Dockh ~]# cat docker-compose.yml
version: '2'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:5.3.0
container_name: elasticsearch
environment:
- cluster.name=dev-kibana-cluster
- node.name=dev-kibana-01
- bootstrap.memory_lock=true
- xpack.security.enabled=false
- xpack.monitoring.enabled=true
- xpack.watcher.enabled=false
- xpack.graph.enabled=false
- xpack.monitoring.history.duration=1d
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
mem_limit: 2g
memswap_limit: 2g
cap_add:
- IPC_LOCK
volumes:
- es_data1:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- kibana_net
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "10"
kibana:
image: docker.elastic.co/kibana/kibana:5.3.0
container_name: kibana
environment:
ELASTICSEARCH_URL: "http://elasticsearch:9200"
XPACK_MONITORING_ELASTICSEARCH_URL: "http://elasticsearch:9200"
XPACK_SECURITY_ENABLED: "false"
ports:
- 80:5601
networks:
- kibana_net
mem_limit: 2g
memswap_limit: 2g
depends_on:
- elasticsearch
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "10"
volumes:
es_data1:
driver: local
networks:
kibana_net:
driver: bridge
[root@Dockh ~]# docker-compose up -d
Starting elasticsearch
Starting kibana
[root@Dockh ~]# docker-compose ps
Name Command State Ports
-----------------------------------------------------------------------------------------
elasticsearch /bin/bash bin/es-docker Up 0.0.0.0:9200->9200/tcp, 9300/tcp
kibana /bin/sh -c /usr/local/bin/ ... Up 0.0.0.0:80->5601/tcp
[root@Dockh ~]#