A, Docker deployment ElasticSearch
1, to find all the mirrors from the warehouse ElasticSearch
[root@iZwz99dhxbd6xwly17tb3bZ app]# docker search elasticsearch
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/elasticsearch Elasticsearch is a powerful open source se... 3060 [OK]
docker.io docker.io/kibana Kibana gives shape to any kind of data — s... 1239 [OK]
docker.io docker.io/nshou/elasticsearch-kibana Elasticsearch-6.3.1 Kibana-6.3.1 81 [OK]
docker.io docker.io/itzg/elasticsearch Provides an easily configurable Elasticsea... 66 [OK]
docker.io docker.io/mobz/elasticsearch-head elasticsearch-head front-end and standalon... 34
docker.io docker.io/kubernetes/fluentd-elasticsearch An image that ingests Docker container log... 25
docker.io docker.io/lmenezes/elasticsearch-kopf elasticsearch kopf 17 [OK]
docker.io docker.io/tutum/elasticsearch Elasticsearch image - listens in port 9200. 16 [OK]
docker.io docker.io/monsantoco/elasticsearch ElasticSearch Docker image 11 [OK]
docker.io docker.io/bitnami/elasticsearch Bitnami Docker Image for Elasticsearch 10 [OK]
docker.io docker.io/mesoscloud/elasticsearch [UNMAINTAINED] Elasticsearch 9 [OK]
docker.io docker.io/justwatch/elasticsearch_exporter Elasticsearch stats exporter for Prometheus 7
docker.io docker.io/taskrabbit/elasticsearch-dump Import and export tools for elasticsearch 7 [OK]
docker.io docker.io/blacktop/elasticsearch Alpine Linux based Elasticsearch Docker Image 5 [OK]
docker.io docker.io/centerforopenscience/elasticsearch Elasticsearch 3 [OK]
docker.io docker.io/frodenas/elasticsearch A Docker Image for Elasticsearch 3 [OK]
docker.io docker.io/barchart/elasticsearch-aws Elasticsearch AWS node 2
docker.io docker.io/jetstack/elasticsearch-pet An elasticsearch image for kubernetes PetSets 1 [OK]
docker.io docker.io/phenompeople/elasticsearch Elasticsearch is a powerful open source se... 1 [OK]
docker.io docker.io/thingswise/elasticsearch Elasticsearch + etcd2 peer discovery 1 [OK]
docker.io docker.io/18fgsa/elasticsearch Built from https://github.com/docker-libra... 0
docker.io docker.io/backplane/elasticsearch-curator Elasticsearch Curator (https://github.com/... 0
docker.io docker.io/driveclutch/infra-elasticsearch-aws Elasticsearch Docker for use in AWS 0 [OK]
docker.io docker.io/forkdelta/fluentd-elasticsearch fluent/fluentd with fluent-plugin-elastics... 0 [OK]
docker.io docker.io/wreulicke/elasticsearch elasticsearch
2, a version of the image for selecting pull
[root@iZwz99dhxbd6xwly17tb3bZ ~]# docker pull docker.elastic.co/elasticsearch/elasticsearch:7.1.1
Trying to pull repository docker.elastic.co/elasticsearch/elasticsearch ...
7.1.1: Pulling from docker.elastic.co/elasticsearch/elasticsearch
7dc0dca2b151: Pull complete
72d60ff53590: Pull complete
ca55c9f7cc1f: Pull complete
822d6592a660: Pull complete
22eceb1ece84: Pull complete
30e73cf19e42: Pull complete
f05e800ca884: Pull complete
3e6ee2f75301: Pull complete
Digest: sha256:8f06aecf7227dbc67ee62d8d05db680f8a29d0296ecd74c60d21f1fe665e04b0
Status: Downloaded newer image for docker.elastic.co/elasticsearch/elasticsearch:7.1.1
3, to view mirror
[root@iZwz99dhxbd6xwly17tb3bZ ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/elasticsearch latest 5acf0e8da90b 3 days ago 486 MB
docker.io/hello-world latest 4ab4c602aa5e 2 weeks ago 1.84 kB
docker.elastic.co/elasticsearch/elasticsearch 7.1.1 96dd1575de0f 2 months ago
4, through the mirror, starts a container, and maps 9200 and 9300 to a local port ( ElasticSearch
default port 9200, we mapped to the host port 9200 Environment Docker
9200 port container)
[root@iZwz99dhxbd6xwly17tb3bZ ~]# docker run -d --name es -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.1.1
c11ef1beb4f3e82d74b8709f9462e83636551b6307cd816563a4a5539f17ac6b
5, arranged cross-domain, into the interior of the container, modifying elasticsearch.yml
[root@iZwz99dhxbd6xwly17tb3bZ ~]# docker exec -it es /bin/bash
[root@c11ef1beb4f3 elasticsearch]# ls LICENSE.txt NOTICE.txt README.textile bin config data lib logs modules plugins [root@c11ef1beb4f3 elasticsearch]# cd config/ [root@c11ef1beb4f3 config]# ls elasticsearch.keystore ingest-geoip log4j2.properties roles.yml users_roles elasticsearch.yml jvm.options role_mapping.yml users [root@c11ef1beb4f3 config]# vi elasticsearch.yml
New cross-domain configuration
cluster.name: "docker-cluster" network.host: 0.0.0.0 http.cors.enabled: true http.cors.allow-origin: "*" # minimum_master_nodes need to be explicitly set when bound on a public IP # set to 1 to allow single node clusters # Details: https://github.com/elastic/elasticsearch/pull/17288 discovery.zen.minimum_master_nodes: 1
6, the container restart ElasticSearch
[root@iZwz99dhxbd6xwly17tb3bZ ~]# docker restart es
es
7, browser access ip: 9200
{ "name" : "bfc29f5a8f8c", "cluster_name" : "docker-cluster", "cluster_uuid" : "9dtJwBrNTwCHnbewPETxhw", "version" : { "number" : "7.1.1", "build_flavor" : "default", "build_type" : "docker", "build_hash" : "7a013de", "build_date" : "2019-05-23T14:04:00.380842Z", "build_snapshot" : false, "lucene_version" : "8.0.0", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" }
Two, Docker deployment ElasticSearch-Head
ElasticSearch-Head is a management interface, you can view information about ElasticSearch
1, the mirror pulling ElasticSearch-Head
[root@iZwz99dhxbd6xwly17tb3bZ ~]# docker pull mobz/elasticsearch-head:5
Trying to pull repository docker.io/mobz/elasticsearch-head ...
5: Pulling from docker.io/mobz/elasticsearch-head
75a822cd7888: Pull complete
57de64c72267: Pull complete
4306be1e8943: Pull complete
871436ab7225: Pull complete
0110c26a367a: Pull complete
1f04fe713f1b: Pull complete
723bac39028e: Pull complete
7d8cb47f1c60: Pull complete
7328dcf65c42: Pull complete
b451f2ccfb9a: Pull complete
304d5c28a4cf: Pull complete
4cf804850db1: Pull complete
Digest: sha256:55a3c82dd4ba776e304b09308411edd85de0dc9719f9d97a2f33baa320223f34
Status: Downloaded newer image for docker.io/mobz/elasticsearch-head:5
2, the container run ElasticSearch-Head
[root@iZwz99dhxbd6xwly17tb3bZ ~]# docker run -d --name es_admin -p 9100:9100 mobz/elasticsearch-head:5
76b0903ac01bc642d4d3ad238134df7312473a44c5b9f603f97f6742a759e629
3, browser access ip: 9100
Three, Docker deploy plug-ik Chinese word
1, into the interior of the container es, / ik new folder plugins
[root@iZwz99dhxbd6xwly17tb3bZ ~]# docker exec -it es /bin/bash [root@970f612c5cac elasticsearch]# ls LICENSE.txt NOTICE.txt README.textile bin config data lib logs modules plugins [root@970f612c5cac elasticsearch]# cd plugins/ [root@970f612c5cac plugins]# mkdir ik [root@970f612c5cac plugins]# ls ik ingest-geoip ingest-user-agent
2, corresponding to the version of the download and es ik compressed and decompressed
This step and some people do not support the server can not extract the zip so. I ended up after extracting tar.gz file on your computer and then uploaded to the server to the next cp container inside the corresponding folder, /tmp/elasticsearch-analysis-ik-7.1.1.tar.gz cp command Docker 40aeef081297: / usr / share / elasticsearch / plugins / tk
Download: https://github.com/medcl/elasticsearch-analysis-ik/releases
[root @ 970f612c5cac plugins] # cd I [root @ 970f612c5cac I] # wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.1.1/elasticsearch-analysis-ik-7.1.1 .zip [root @ 970f612c5cac I] # unzip elasticsearch-analysis-ik-7.1.1.zip [root @ I 970f612c5cac] # ls commons codec 1.9.jar elasticsearch-analysis-I-6.3.2.jar plugin descriptor .properties commons-logging 1.2.jar http client-4.5.2.jar plugin security.policy config http core-4.4.4.jar
3, exit the container, the container restart es
[root@970f612c5cac ik]# exit exit [root@iZwz99dhxbd6xwly17tb3bZ ~]# docker restart es
4, ik word test plug, postman request the following parameters
ip:9200/_analyze?pretty=true
{
"Analyzer": "ik_max_word",
"text": "This is my copy came, I was not very powerful."
}
Note down is not the same word analyzer
So far Docker Elasticsearch installation has been completed, from which we can clearly feel the power of Docker's!