3.ElasticSearch系列之Docker本地部署
对于之前的部署方式一般用于生产环境,而对于学习而言Docker方式快速部署就好了,本示例在window10环境下进行。
1. Docker使用Elasticsearch 需要对vm.max_map_count进行如下配置
# Windows and macOS with Docker Desktop
docker-machine ssh
sudo sysctl -w vm.max_map_count=262144
# Windows with Docker Desktop WSL 2 backend
wsl -d docker-desktop
sysctl -w vm.max_map_count=262144
2. docker-compose方式部署
version: '3'
services:
kibana:
image: docker.elastic.co/kibana/kibana:7.11.2
container_name: kibana711
environment:
- I18N_LOCALE=zh-CN
- XPACK_GRAPH_ENABLED=true
- TIMELION_ENABLED=true
- XPACK_MONITORING_COLLECTION_ENABLED="true"
ports:
- "5601:5601"
networks:
- es711net
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.11.2
container_name: es711
environment:
- cluster.name=shenjian
- node.name=es711
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
- discovery.seed_hosts=es711
- cluster.initial_master_nodes=es711
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- es73data1:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- es711net
volumes:
es73data1:
driver: local
networks:
es711net:
driver: bridge
验证ES节点 http://127.0.0.1:9200/
{
"name" : "es711",
"cluster_name" : "shenjian",
"cluster_uuid" : "UCRt6zcbTEKVJHD8nRjkQA",
"version" : {
"number" : "7.11.2",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "3e5a16cfec50876d20ea77b075070932c6464c7d",
"build_date" : "2021-03-06T05:54:38.141101Z",
"build_snapshot" : false,
"lucene_version" : "8.7.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
访问Kibana http://127.0.0.1:5601/
欢迎使用 Elastic