$ docker pull elasticsearch:5.6
$ docker run -p 9200:9200 -p 9300:9300 -d --name elas elasticsearch:5.6 -Etransport.host=0.0.0.0 -Ediscovery.zen.minimum_master_nodes=1
注意:node
- 系統參數 vm.max_map_count 須要調整, 不然容器可能運行失敗。
- 可以使用此命令臨時調整 sysctl -w vm.max_map_count=262144。
- 永久調整 修改配置文件/etc/sysctl.conf。
- 最後記得配置跨域,重啓 ES ,訪問 http://localhost:9100/
$ sed -i '$a http.cors.enabled: true' elasticsearch.yml $ sed -i '$a http.cors.allow-origin: "*"' elasticsearch.yml $ cat elasticsearch.yml http.host: 0.0.0.0 # Uncomment the following lines for a production cluster deployment #transport.host: 0.0.0.0 #discovery.zen.minimum_master_nodes: 1 http.cors.enabled: true http.cors.allow-origin: "*"
$ docker pull mobz/elasticsearch-head:5 $ docker run -p 9100:9100 mobz/elasticsearch-head:5
$ docker exec -it elas root@017ac94a0576:/usr/share/elasticsearch# ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.6.4/elasticsearch-analysis-ik-5.6.4.zip -> Downloading https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.6.4/elasticsearch-analysis-ik-5.6.4.zip [=================================================] 100% -> Installed analysis-ik root@017ac94a0576:/usr/share/elasticsearch# ls plugins/ analysis-ik