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 to build es Cluster in docker

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article will explain in detail how to build an es cluster in docker. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

Linux system:

The vm.max_map_count setting should be permanently set / etc/sysctl.conf at the following location

Grep vm.max_map_count / etc/sysctl.confvm.max_map_count=262144# temporary effective sysctl-w vm.max_map_count=262144# permanent effective echo vm.max_map_count=262144 > > / etc/sysctl.confsysctl-p

MacOS system: (Docker for Mac)

This vm.max_map_ count must be set in the xyve virtual machine:

# 1. Run: screen ~ / Library/Containers/com.docker.docker/Data/vms/0/tty#2 from the command line. Press enter and use "sysctl" to configure vm.max_map_ count: sysctl-w vm.max_map_count=262144#3. Exit the screen session, use the Ctrl a d key to exit

Configure the docker network (optional)

In order to simulate that our es is a stand-alone server, we can use docker network IP to specify isolation. Docker uses bridge network by default when creating a container, and we are not allowed to assign IP by ourselves. In the actual deployment, we need to specify the container IP, which is not allowed to allocate IP, especially when building a cluster, it is necessary to fix the IP. So we can create our own bridge network: mynet. When creating the container, we can specify the network as mynet and specify IP.

# View network mode docker network ls# to create a new bridge network-mynetdocker network create-- driver bridge-- subnet=172.18.12.0/16-- gateway=172.18.1.1 mynet# to view network details docker network inspect mynet#, use-- network=mynet-- ip 172.18.12.x to specify IP to create es nodes

Here we take 3 master and 3 slave as an example, first create 3 Master nodes, and copy the following script to create 3 master nodes easily and quickly.

For port in $(seq 1 3);\ do\ mkdir-p ~ / mydata/elasticsearch/master-$ {port} / configmkdir-p ~ / mydata/elasticsearch/master-$ {port} / datachmod-R 777 ~ / mydata/elasticsearch/master-$ {port} cat

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

Internet Technology

Wechat

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

12
Report