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

Installation and configuration of keepalived on centos7

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "how to install and configure keepalived on centos7". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to install and configure keepalived on centos7".

1. Environmental planning

1) master:node1,centos7.5,eth0:192.168.1.11,eht1:10.10.1.11,keepalive

2) backup:node1,centos7.5,eth0:192.168.1.12,eth2:10.10.1.12,keepalive

2. Build steps

1) CentOS 7.564-bit is installed in mini mode on node1,node2, and the IP address is configured as planned.

2) add the following to the / etc/hosts of node1,node2.

192.168.1.11 node1.xx.xxx.com node1

10.10.1.11 node1.xx.xxx.com node1

192.168.1.12 node2.xx.xxx.com node2

10.10.1.12 node2.xx.xxx.com node2

3) node1,node2 install keepalive1.3.5

# yum install keeplived

4) configure keepalive on node1

Vi / etc/keepalived/keepalived.conf # is modified as follows

Vrrp_instance VI_1 {

State MASTER # set node node1 to MASTER role

Interface enp11s0f0 # configure the eth0 network card enp11s0f0 as the system IP of node node1

Virtual_router_id 51 # master is consistent with backup

The higher the number of priority 100#, the higher the grade, which ensures that master is higher than any backup.

Advert_int 1

Authentication {

Auth_type PASS # vrrp protocol to ensure the consistency of master and other backup

Auth_pass 1111 # ensures that master and other backup are consistent

}

Virtual_ipaddress {

192.168.1.210/24 # VIP

}

5) configure keeplive on node node2

Vi / etc/keepalived/keepalived.conf # is modified as follows

Vrrp_instance VI_1 {

State BACKUP # set node node2 to BACKUP role

Interface enp11s0f0 # configure the eth0 network card enp11s0f0 as the system IP of node node2

Virtual_router_id 51 # master is consistent with backup

The higher the number of priority 99 # is, the higher the grade is, and it is guaranteed to be lower than master.

Advert_int 1

Authentication {

Auth_type PASS # vrrp protocol to ensure the consistency of master and other backup

Auth_pass 1111 # ensures that master and other backup are consistent

}

Virtual_ipaddress {

192.168.1.210/24 # VIP

}

6) start and configure keepalive

Systemctl start keepalived.service

Systemct enable keepalived.service

3. Verification

1) check keepalive and ip on master

Ps-ef | grep keepalive

Ip addr

2) keepalived High availability Test

# close keepalived on node1

Systemctl stop keepalived.service

# View keepalived and ip on node1

Ps-ef | grep keepalived

Ip addr

# View keepalived and ip on node2

Ps-ef | grep keepalived

Ip addr

At this point, I believe you have a deeper understanding of "the installation and configuration of keepalived on centos7". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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