1. Select Elasticsearch image file

Use docker commands to view Elasticsearch Image files

  1. docker search elasticsearch
  1. [root@172-10-20-165 zlb]# docker search elasticsearch
  2. NAME DESCRIPTION STARS OFFICIAL AUTOMATED
  3. elasticsearch Elasticsearch is a powerful open source sear 5304 [OK]
  4. nshou/elasticsearch-kibana Elasticsearch-7.15.1 Kibana-7.15.1 132 [OK]
  5. mobz/elasticsearch-head elasticsearch-head front-end and standalone 82
  6. elastichq/elasticsearch-hq Official Docker image for ElasticHQ: Elastic 77 [OK]
  7. itzg/elasticsearch Provides an easily configurable Elasticsearc 71 [OK]
  8. elastic/elasticsearch The Elasticsearch Docker image maintained by 56
  9. taskrabbit/elasticsearch-dump Import and export tools for elasticsearch 27 [OK]
  10. lmenezes/elasticsearch-kopf elasticsearch kopf 18 [OK]
  11. barnybug/elasticsearch Latest Elasticsearch 1.7.2 and previous rele 17 [OK]
  12. justwatch/elasticsearch_exporter Elasticsearch stats exporter for Prometheus 17
  13. blacktop/elasticsearch Alpine Linux based Elasticsearch Docker Image 16 [OK]
  14. esystemstech/elasticsearch Debian based Elasticsearch packing for Lifer 15
  15. monsantoco/elasticsearch ElasticSearch Docker image 11 [OK]
  16. mesoscloud/elasticsearch [UNMAINTAINED] Elasticsearch 9 [OK]
  17. dtagdevsec/elasticsearch elasticsearch 4 [OK]
  18. centerforopenscience/elasticsearch Elasticsearch 4 [OK]
  19. barchart/elasticsearch-aws Elasticsearch AWS node 3
  20. jetstack/elasticsearch-pet An elasticsearch image for kubernetes PetSets 1 [OK]
  21. kuzzleio/elasticsearch Elasticsearch container based on Alpine Linu 1 [OK]
  22. axway/elasticsearch-docker-beat "Beat" extension to read logs of containers 1 [OK]
  23. dsteinkopf/elasticsearch-ingest-attachment elasticsearch + ingest-attachment to be used 1 [OK]
  24. phenompeople/elasticsearch Elasticsearch is a powerful open source sear 1 [OK]
  25. thingswise/elasticsearch Elasticsearch + etcd2 peer discovery 1 [OK]
  26. wreulicke/elasticsearch elasticsearch 0 [OK]
  27. travix/elasticsearch-kubernetes To run ElasticSearch in kubernetes and expor 0 [OK]

2. Download the elasticsearch image file

According to the above operations, we generally select the first one, and add the version number you need when selecting. Here I choose version 7.4.0

  1. docker pull elasticsearch:7.4.0

3. Select the kibana visualization tool image file.

Run the docker command to view the kibana image file.

  1. docker search kibana
  1. [root@172-10-20-165 zlb]# docker search kibana
  2. NAME DESCRIPTION STARS OFFICIAL AUTOMATED
  3. kibana Kibana gives shape to any kind of data str 2287 [OK]
  4. elastic/kibana The Kibana docker images maintained by Elast 33
  5. marcbachmann/kibana4 Kibana 4 Dashboard, Stable release, Environm 27 [OK]
  6. devdb/kibana Elasticsearch 1.5.2 + Kibana 4.0.2 15 [OK]
  7. blacktop/kibana Alpine Linux based Kibana Docker Image 12 [OK]
  8. clusterhq/kibana Kibana 3.1.x image for ClusterHQ's flocker t… 6 [OK]
  9. jimmidyson/kibana4 3 [OK]
  10. monsantoco/kibana Kibana web UI based on Alpine Linux (~65 MB). 3 [OK]
  11. million12/kibana4 Kibana 4 For Elasticsearch (works like kiban… 2 [OK]
  12. dtagdevsec/kibana kibana 2 [OK]
  13. khezen/kibana Kibana Docker image including search-guard 2 [OK]
  14. sxmichael/kibana Kibana with Marvel and Sense 2 [OK]
  15. ansibleplaybookbundle/kibana-apb Kibana APB 1 [OK]
  16. mesoscloud/kibana [UNMAINTAINED] Kibana 1 [OK]
  17. komljen/kibana Kibana kube image 1 [OK]
  18. maxird/kibana Kibana dashboard 0
  19. rlister/kibana4 Kibana4 configured with env variables. 0
  20. barchart/kibana Kibana console for Logstash 0
  21. appcelerator/kibana Kibana image builder using only environment … 0 [OK]
  22. plaguedr/kibana pelk - Kibana 0
  23. phenompeople/kibana Kibana gives shape to any kind of data — str… 0 [OK]
  24. neemuchaordic/kibana-without-xpack kibana without x-pack 0 [OK]
  25. brendangibat/kibana-aws-container Kibana v4.1.4 with AWS ElasticSearch signing… 0 [OK]
  26. petekaik/kibana-healthcheck Adaptation of the popular Kibana image with … 0 [OK]
  27. amd64/kibana Kibana gives shape to any kind of data — str… 0

4. Download the kibana image file

According to the above operations, we generally select the first one, and add the version number you need when selecting. Here I choose version 7.4.0

  1. docker pull kibana:7.4.0

5.Download Chinese word segmentation

To support Chinese word segmentation, we need to download the Chinese analysis tool. We select elasticsearch-analysis-ik-7.4.0.zip
Download URL:https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.4.0/elasticsearch-analysis-ik-7.4.0.zip

  1. wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.4.0/elasticsearch-analysis-ik-7.4.0.zip

6. Create required folders

6.1 docker installation of elasticsearch requires several folders to be hosted for external Association

  1. mkdir config data plugins
  • config to store the elasticsearch configuration file
  • Data Store data
  • Plugins Store Word Segmentation

6.2 create elasticsearch.yml in the config file

To allow Internet access, follow these steps:

  1. echo "http.host: 0.0.0.0">>/zlb/docker-es/elasticsearch/config/elasticsearch.yml

Note: http.host: must be followed by a space.

6.3 decompress the elasticsearch-analysis-ik-7.4.0.zip to the plugins folder

The procedure is as follows:

  1. #解压
  2. unzip elasticsearch-analysis-ik-7.4.2.zip -d analysis-ik
  3. # 删除原有文件
  4. rm -rf elasticsearch-analysis-ik-7.4.2.zip

As shown in figure:/zlb/docker-es/plugins/analysis-ik
image.png

7. Modify read/write permissions

  1. chmod -R 777 /zlb/docker-es/

8.Enable related services

8.1 Enable elasticsearch

  1. docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
  2. -e "discovery.type=single-node" \
  3. -v /zlb/docker-es/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
  4. -v /zlb/docker-es/data:/usr/share/elasticsearch/data \
  5. -v /zlb/docker-es/plugins:/usr/share/elasticsearch/plugins \
  6. -d elasticsearch:7.4.0
  1. -name: docker容器中显示的名称
  2. -p:9200:操作eshttp请求端口
  3. -p:9300:es在分布式集群下的节点之间的通讯端口
  4. -e:指定单节点运行
  5. -e:训你机内存配置,初始64m,最大占用128mx线上至少32g
  6. -v:挂载配置
  7. -d:指定安装镜像文件

Verification:
image.png

8.2 Install kibana

  1. docker run --name kibana -e ELASTICSEARCH_HOSTS=http://172.10.20.165:9200 -p 5601:5601 -d kibana:7.4.0

ELASTICSEARCH_HOSTS=:This address is your es address

Verification:image.png

8.3 Tokenization test

The tokenizer path must correspond to the path in the elasticsearch Service.
image.png
So now we just need to check whether the two directories are unified (if they are unified, you can go to the docker container to see them)
image.png
Check the mapping

image.png

9. Note

  1. # 如果启动报错 可以执行查看logs的命令
  2. docker logs 容器ID
  3. #开机启动
  4. docker update elasticsearch --restart-always
  5. 1.echo写入配置时候少了个空格
  6. 2.es所有配置添加读写权限