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 configure the cluster for linux

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

Share

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

Today, I will talk to you about how to configure the cluster in linux. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

Setting up a virtual cluster is a complex and time-consuming process. First of all, you need to have two Red Hat Enterprise Linux or CentOS 7 nodes, and configure the correct forwarding and reverse domain name system. Due to some changes between Red Hat 6 and 7, the complexity of cluster management is significantly reduced.

Cluster setup mainly depends on two technologies: Pacemaker and Corosync. Pacemaker runs the cluster management side, and Corosync manages lower-level cluster projects to ensure connectivity.

1. Use the following command to install both Pacemaker and Corosync

Yum install-y pcs fence-agents-all

This command will download all dependent packages needed to configure the cluster, and note that the above command must be executed on both nodes.

You also need to add a firewall rule to allow the necessary traffic. You need to run the following command:

Firewall-cmd-permanent-add-service=high-availabilityfirewall-cmd-permanent-add-service=httpfirewall-cmd-reload

The next step is to enable and start the cluster service. You need to run the following command:

Systemctl enable pcsd.servicesystemctl start pcsd.service

The first command enables the cluster service at startup, and the second command starts the cluster service at the current session.

After installing the cluster configuration, create a user-managed virtual cluster called hacluster. In order to be able to use this account, the password must be changed, so reset the password on two nodes: passwd hacluster

3. After the above configuration is completed, you can start to manage virtual clusters and nodes. The first step is to authorize the nodes contained in the virtual cluster. Command: pcs cluster auth node1 node2

The next step is to create a cluster resource. You can create a cluster resource using the pcs cluster setup command: pcs cluster setup-- start-- name myapp node1 node2

At this point, the cluster resource controller will refresh the existing configuration, synchronize the new configuration data, and build a new configuration that includes two specified nodes. The next step is to enable the virtual cluster using the following command: pcs cluster enable-- all

5. The result should show that the two nodes are enabled. To check the status of the entire cluster, you can use the command pcs cluster status, which displays a summary of the current cluster status.

6. After completing the above configuration, we need to enable virtual IP. A virtual IP is an address that has no physical connection. It is intended to act as a fault-tolerant front end for virtual clusters to provide services. Replace the IP address in the following command as needed, and then execute:

Pcs resource create Cluster_VIP ocf:heartbeat:IPaddr2 ip=192.168.0.100 cidr_netmask=24 op monitor interval=20s

The cluster should now be active. You need to increase cluster resources before you start using clusters.

After reading the above, do you have any further understanding of how to configure the cluster in linux? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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