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

Centos 7.6 deployment of elasticsearch clusters

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

Share

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

1. Introduction of Elasticsearch cluster

1. Elasticsearch cluster node

Candidate master node (Master-eligible node): after a node is started, the Zen Discovery mechanism is used to find other nodes in the cluster and establish connections with them. In the cluster, a master node is selected from the candidate master node, which is responsible for creating indexes, deleting indexes, allocating fragments, tracking the status of nodes in the cluster, and so on. The workload of the master node in Elasticsearch is relatively light, and the user's request can be sent to any node, which is responsible for distributing and returning the results without being forwarded by the master node.

Data node (Data node): the data node is responsible for data storage and related specific operations, such as CRUD, search, aggregation. Therefore, data nodes have high requirements for machine configuration, first of all, they need enough disk space to store data, and secondly, data operations consume a lot of performance on system CPU, Memory and IO. Usually as the cluster expands, more data nodes need to be added to improve availability.

Client node (Client node): a client node is a node that is neither a candidate master node nor a data node, but is only responsible for the distribution, summary, and so on of requests, that is, the role of the coordinator node that we will talk about below. In fact, any node can do this kind of work, and adding such nodes alone is more for load balancing.

Orchestration node (Coordinating node): the orchestration node is a role, not a real Elasticsearch node. You have no way to configure which node is the orchestration node through the configuration item. Any node in the cluster can act as a coordinator node. When a node A receives the query request from the user, it distributes the query clause to other nodes, then merges the query results returned by each node, and finally returns a complete data set to the user. In this process, node A plays the role of coordinating nodes. There is no doubt that the coordinator node will have higher requirements for CPU and Memory.

2. Deployment plan

By default, a node can be either a candidate master node or a data node, so we use two machines to deploy master+data nodes.

3. System environment

Hostname IP address operating system node1192.168.2.211Centos 7.6 64-bit node2192.168.2.212Centos 7.6 64-bit 2. Preparation before deployment

1. Close selinux

Sed-I "s/SELINUX=enforcing/SELINUX=disabled/g" / etc/selinux/configsed-I's etc/selinux/configsetenforce

2. Install the tools you need

Yum-y install vim wget java

3. Download elasticsearch and decompress it

Wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.2.tar.gzmkdir / datatar zxvf elasticsearch-7.4.0-linux-x86_64.tar.gz-C / data/mv / data/elasticsearch-6.6.2 / data/elasticsearch

4. The firewall opens the following ports

Firewall-cmd-permanent-add-port=9200/tcpfirewall-cmd-permanent-add-port=9300/tcpfirewall-cmd-reload III. Deploy elasticsearch cluster

1. Modify elasticsearch configuration

Vim / data/elasticsearch/config/elasticsearch.yml

Cluster.name: cluster-test # cluster name, each node cluster name is the same as node.name: test-1 # node name Each node sets a unique name path.data: / data/elasticsearch/data # data storage path path.logs: / data/elasticsearch/logs # log file storage path network.host: 0.0.0.0http.port: 9200discovery.zen.ping.unicast.hosts: ["192.168.2.211" "192.168.2.212"] # Node list discovery.zen.minimum_master_nodes: 2 # number of candidate master nodes gateway.recover_after_nodes: 1 # as long as there is one node in the cluster, it will work properly

2. Create a startup user

Useradd els-p 123456chown-R els:els / data/elasticsearch

3. To modify the number of limit, you need to log in to the system again to take effect

Vim / etc/security/limits.conf # add the following

* soft nofile 65536 * hard nofile 65536

4. Modify the kernel parameter vm.max_map_count

Vim / etc/sysctl.conf # add the following

Vm.max_map_count=262144sysctl-p

5. Switch to els user and start elasticsearch

Su-els/data/elasticsearch/bin/elasticsearch-d

6. Check the cluster status

View the status of cluster nodes

Curl http://192.168.2.211:9200/_cat/nodes?pretty

View cluster status

Curl http://192.168.2.211:9200/_cluster/state?pretty

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