I. Why this structure
1. High availability of the system
2. System Extensibility
3. Load Balancing capability
Lvs+keepalived can be very good to achieve the above requirements, LVS provides load balancing, Keepalived provides health checks, failover, improve the availability of the system! With this architecture it is easy to extend existing systems, as long as you add or reduce realserver on the backend, just change the LVS configuration file and enable seamless configuration changes! Nginx provides a reverse proxy, while Tomcat provides a Web service.
Two, LVS
LVS is a shorthand for Linux virtual server, that is, a virtualized server cluster system.
There are several structures for scalable network services that require a front-end load scheduler (or multiple master-slave backups). We first analyze the main technology of implementing virtual Network Service, and point out that IP load balancing technology is the most efficient in the implementation of load scheduler. In the existing IP load balancing technology, there are mainly a set of servers through Network address translation (translation) to form a high-performance, high-availability virtual server, we call it Vs/nat technology (virtual server via Network Address translation). On the basis of analyzing the disadvantage of vs/nat and the asymmetry of network service, we propose a method of implementing virtual server through IP tunneling Vs/tun (virtual server via IP tunneling), and the method of implementing the dummy server through direct routing vs/ DR (Virtual Server via Direct Routing), which can greatly improve the scalability of the system. Vs/nat, Vs/tun and VS/DR technology are three kinds of IP load balancing technology implemented in LVS cluster.
Third, keepalived
keepalived is run on the LVS, its main function is to realize the real machine fault isolation and load balancer between the failure switch, improve the availability of the system. The status of the Web server can be detected, if a Web server freezes, or the work fails, keepalived detects and rejects the failed Web server from the system. When the Web server is working properly, Keepalived automatically joins the Web server to the server farm, all of which are done automatically, without the need for manual intervention, and the only thing that needs to be done manually is to repair the failed Web server.
Four, Nginx
Nginx ("Engine X") is a high-performance HTTP and reverse proxy server.
LVS + keepalived + nginx + Tomcat high available load reverse proxy server configuration (i) Introduction