Docker install ElasticSearch 6.1.8 and kibana

docker install elasticsearch 6.1.8

1. Download the mirror

docker pull elasticsearch:6.8.1

2. Start the mirror

docker run -it --name elasticsearch -d -p 9200:9200 -p 9300:9300  elasticsearch:6.8.1

3. Configure cross-domain

  1. Go inside the container

    docker exec -it 1285897a1b06 /bin/bash
    

    1285897a1b06 is the container id, which can be viewed through docker ps

  2. Modify elasticsearch.yml in the config directory and add the following information:

    cluster.name: "my-cluster"
    network.host: 0.0.0.0
    http.cors.enabled: true
    http.cors.allow-origin: "*"
    

    cluster.name: Custom cluster name.
    network.host: The ip address bound to the current es node, the default is 127.0.0.1, this attribute must be set if you need to open external access.
    http.cors.enabled: Whether to support cross-domain, the default is false.
    http.cors.allow-origin: When the setting allows cross-domain, the default is *, which means that all domain names are supported. If we only allow certain websites to be accessible, we can use regular expressions.

    Note: When modifying, it must conform to the grammar of the yml file.

  3. Exit the container

exit

4. Restart the mirror

docker restart 1285897a1b06

5. Testing

curl localhost:9200

See the following information, indicating that the installation was successful

{
  "name" : "PyZi-Pw",
  "cluster_name" : "my-cluster",
  "cluster_uuid" : "BE-PBfsJTGGT0LxRJRmcWA",
  "version" : {
    "number" : "6.8.1",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "1fad4e1",
    "build_date" : "2019-06-18T13:16:52.517138Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

docker安装elasticsearch head

elasticsearch head is a visualization tool for elasticsearch

  1. Boot mirror
docker run -p 9100:9100 mobz/elasticsearch-head:5
  1. After startup, enter: localhost:9100 in the browser to view the visual interface

image-20200325225217014

docker install IK Chinese word segmenter

  1. Enter the container
docker exec -it 1285897a1b06 /bin/bash
  1. Download and install online

Official website address:

https://github.com/medcl/elasticsearch-analysis-ik

Use the elasticsearch-plugin command to execute the installation command:

./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.8.1/elasticsearch-analysis-ik-6.8.1.zip

Here you can select the corresponding version number.

Note here is the version of the ik tokenizer. It needs to correspond to the elasticsearch version, otherwise it will fail to start later.

After the installation is complete, there will be an additional folder in the plugin directory:analysis-ik

  1. Restart es

    docker restart 1285897a1b06
    
  2. Test word segmentation effect

Use postman to send a post request:

image-20200325233841228

The returned result is as follows, indicating that the Chinese word segmenter is installed successfully

image-20200325233903559

docker Kibana

Kibana

  1. Download mirror

    docker pull kibana:6.8.1
    
  2. Run mirror

docker run -d --name kibana -e ELASTICSEARCH_URL=http://172.17.0.3:9200 -p 5601:5601  kibana:6.8.1

172.17.0.3 is the ip of the container elasticsearch

  1. Browser enter localhost:5601 to see the page

Set up the kibana Chinese interface

  1. Go inside the container
docker exec -it 68f6e0ed0bca /bin/bash
  1. Modify kibana.yml in the config directory

Add i18n.locale: zh-CN in the last line. Note that there is a space after the colon

#
# ** THIS IS AN AUTO-GENERATED FILE **
#
# Default Kibana configuration for docker target
server.name: kibana
server.host: "0"
elasticsearch.hosts: [ "http://elasticsearch:9200" ]
xpack.monitoring.ui.container.elasticsearch.enabled: true

i18n.locale: zh-CN
  1. Restart the container

  2. Enter localhost:5601 in the browser to see the Chinese interface

    image-20200326195027887

Guess you like

Origin blog.csdn.net/kaihuishang666/article/details/105127528