Docker下安裝 Elasticsearch5.x與相關插件(head、ik分詞器)

$ docker pull elasticsearch:5.6
  • 運行es容器,建立集羣 。
$ 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

  1. 系統參數 vm.max_map_count 須要調整, 不然容器可能運行失敗。
  2. 可以使用此命令臨時調整 sysctl -w vm.max_map_count=262144。
  3. 永久調整 修改配置文件/etc/sysctl.conf。
  4. 最後記得配置跨域,重啓 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
相關文章
相關標籤/搜索