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

Lvs+keepalived deploys highly available clusters

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

Share

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

This environment is based on centos7 deployment, and the basic architecture diagram:

Client ip: 192.168.1.101

Lvs1 ip: 192.168.1.173

Lvs2 ip: 192.168.1.110

Web1: 192.168.1.114

Web2: 192.168.1.119

VIP: 192.168.1.10

Deployment process:

Lvs1:

# yum install ipvsadm

# ipvsadm # check whether the output installation is successful

# yum install keepalived

# vim / etc/keepalived/keepalived.conf

Global_defs {

Notification_email {

Xxx@qq.com

}

Notification_email_from xxx@qq.com

Smtp_server smtp.qq.com

Smtp_connect_timeout 30

Router_id LVS1

}

Vrrp_instance VI_1 {

State MASTER

Interface ens33

Virtual_router_id 51

Priority 100

Advert_int 1

Authentication {

Auth_type PASS

Auth_pass 1111

}

Virtual_ipaddress {

192.168.1.10

}

}

Virtual_server 192.168.1.10 80 {

Delay_loop 6

Lb_algo rr

Lb_kind DR

Nat_mask 255.255.255.0

Persistence_timeout 50

Protocol TCP

Real_server 192.168.1.114 80 {

Weight 1

TCP_CHECK {

Connect_timeout 3

Nb_get_retry 3

Delay_before_retry 3

}

}

Real_server 192.168.1.119 80 {

Weight 1

TCP_CHECK {

Connect_timeout 3

Nb_get_retry 3

Delay_before_retry 3

}

}

}

# vim / etc/sysctl.conf # enable routing forwarding

Net.ipv4.ip_forward= 1

# sysctl-p

# service keepalived start

Lvs2 configuration is roughly the same as lvs

# vim / etc/keepalived/keepalived.conf

State BACKUP

# service keepalived start

The backend web server can use nginx.

Browser request http://192.168.1.10

# ipvsadm-l # View scheduling information

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