Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Docker deploy ElasticSearch clusters

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how to deploy ElasticSearch clusters in Docker". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Preface

Why use ElasticSearch? Our applications often need to add retrieval functions, and open source Elastic Search is the first choice of full-text search engine at present. It can quickly store, search and analyze huge amounts of data. ElasticSearch is a distributed search framework, which provides RestfulAPI, the underlying layer is based on Lucene, uses multi-shard (fragmentation) to ensure data security, and provides the function of automatic resharding.

Elasticsearch: authoritative Guide (in Chinese): https://www.elastic.co/guide/cn/elasticsearch/guide/current/index.html

two。 Pull ElasticSearch image

In the centos window, execute the following command:

Docker pull elasticsearch:5.6.8

Current ES image version information:

{"name": "WlwFyqU", "cluster_name": "elasticsearch", "cluster_uuid": "78UDZtviQqiWmzmenGpSrQ", "version": {"number": "5.6.8", "build_hash": "cfe3d9f", "build_date": "2018-09-10T20:12:43.732Z", "build_snapshot": false, "lucene_version": "6.6.1"} Tagline: "You Know, for Search"} 3. Create data to hang in the directory, and configure ElasticSearch cluster configuration file 3. 1. 0. Create a data file mount directory and open the communication port

In the centos window, do the following:

[root@localhost soft] # pwd/root/soft [root@localhost soft] # mkdir-p ES/config [root@localhost soft] # cd ES [root@localhost ES] # mkdir data1 [root@localhost ES] # mkdir data2 [root@localhost ES] # mkdir data3 [root@localhost ES] # cd ES/config/ [root@localhost ES] # firewall-cmd-add-port=9300/tcpsuccess [root@localhost ES] # firewall-cmd-add-port=9301/tcpsuccess [root@localhost ES] # firewall-cmd-add-port=9302/tcpsuccess

Note: if ELK chooses version 6.x and is not an administrator, then the reader should open data1 data2 data3 to 777 permissions = > chmod 777 data1 data2 data3.

3.2. Create an ElasticSearch profile

In the centos window, use the vim command to create the following files: es1.yml,es2.yml,es3.yml

Es1.yml

Cluster.name: my-elasticsearchnode.name: es-node1network.bind_host: 0.0.0.0network.publish_host: 192.168.70.129http.port: 9200transport.tcp.port: 9300http.cors.enabled: truehttp.cors.allow-origin: "*" node.master: true node.data: true discovery.zen.ping.unicast.hosts: ["192.168.70.129es-node1network.bind_host 9300", "192.168.70.129purl 9301" "192.168.70.129 9302"] discovery.zen.minimum_master_nodes: 2

Es2.yml

Cluster.name: my-elasticsearchnode.name: es-node2network.bind_host: 0.0.0.0network.publish_host: 192.168.70.129http.port: 9201transport.tcp.port: 9301http.cors.enabled: truehttp.cors.allow-origin: "*" node.master: true node.data: true discovery.zen.ping.unicast.hosts: ["192.168.70.129es-node2network.bind_host 9300", "192.168.70.129purl 9301" "192.168.70.129 9302"] discovery.zen.minimum_master_nodes: 2

Es3.yml

Cluster.name: my-elasticsearchnode.name: es-node3network.bind_host: 0.0.0.0network.publish_host: 192.168.70.129http.port: 9202transport.tcp.port: 9302http.cors.enabled: truehttp.cors.allow-origin: "*" node.master: true node.data: true discovery.zen.ping.unicast.hosts: ["192.168.70.129es-node3network.bind_host 9300", "192.168.70.129purl 9301" "192.168.70.129 9302"] discovery.zen.minimum_master_nodes: 2

Note: native virtual machine ip:192.168.70.129 readers please change it yourself.

3.3. Increase the limited number of JVM threads

In the centos window, modify the configuration sysctl.conf

Vim / etc/sysctl.conf

Add the following:

Vm.max_map_count=262144

Enable configuration:

This is the end of sysctl-p, "how to deploy ElasticSearch clusters in Docker". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report