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

What does Nginx load balancing mean by high availability?

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you what the meaning of Nginx load balancing high availability means, I believe most people do not know much about it, so share this article for your reference. I hope you will learn a lot after reading this article. Let's learn about it.

To achieve high availability of nginx, you need to implement a backup machine.

1.1. What is load balancing with high availability

Nginx as a load balancer, all requests go to nginx, which shows that nginx is in a very important position. If the nginx server goes down, the back-end web service will not be able to provide services, which will have a serious impact.

In order to shield the downtime of the load balancer server, a backup machine needs to be established. High availability (High Availability) monitors run on both the primary server and the backup machine to monitor each other's health by sending messages such as "I am alive". When the backup machine cannot receive such information within a certain period of time, it takes over the service IP of the primary server and continues to provide load balancing services; when the backup manager receives information such as "I am alive" from the master manager, it releases the service IP address, and such a master server begins to provide load balancing services again.

1.2. Keepalived+nginx realizes active and standby

1.2.1. What is keepalived?

Keepalived is a service software to ensure the high availability of clusters in cluster management, which is used to prevent single point of failure.

The role of Keepalived is to detect the status of the web server. If a web server crashes or fails, Keepalived will detect and remove the malfunctioning web server from the system. When the web server works normally, Keepalived automatically adds the web server to the server farm. All these tasks are completed automatically, without human intervention, and all you need to do is to repair the faulty web server.

1.2.2. How keepalived works

Keepalived is based on VRRP protocol, and VRRP is called Virtual Router Redundancy Protocol, that is, virtual routing redundancy protocol.

Virtual routing redundancy protocol can be considered as a protocol to achieve high availability of routers, that is, N routers with the same function form a router group, in which there is a master and multiple backup,master with a vip providing external services (VIP = Virtual IP Address, virtual IP address, the default route of other machines in the local area network of the router is this vip), and master will send multicast. When the backup does not receive the VRRP packet, it is considered that the master is down, so it is necessary to elect a backup as the master according to the priority of the VRRP. In this way, the high availability of the router can be ensured.

Keepalived has three main modules, namely, core, check and VRRP. Core module is the core of keepalived, which is responsible for the startup and maintenance of the main process as well as the loading and parsing of global configuration files. Check is responsible for health check-ups, including common check-ups. The VRRP module is used to implement the VRRP protocol.

1.2.3. Keepalived+nginx realizes the active and standby process

Initial state

Host downtime

Host recovery

High availability environment

Two nginx, one master and one standby: 192.168.101.3 and 192.168.101.4

Two tomcat servers: 192.168.101.5, 192.168.101.6

The above is all the content of the article "what does the high availability of Nginx load balancing mean?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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