Net Distributed System II: The CentOS system builds Nginx load balancing and centosnginx
1. Introduction to CentOS
CentOS (Community Enterprise Operating System) is one of the Linux releases. It is compiled by Red Hat Enterprise Linux according to the open source code. Based on the continuous upgrade of Red Hat and fixing of known bugs, CentOS is more used to build large enterprise-level servers. At present
General Overview:keepalived is a software similar to the Layer3, 4 5 switch, which is what we normally call the 3rd, 4th, and 5th layers of exchange. The role of keepalived is to detect the state of the Web server, if a Web server freezes, or a work failure occurs, 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 whic
, you only need to add:
Iptables-I RH-Firewall-1-INPUT-d 224.0.0.18-j ACCEPT
2. If you use a script to configure a firewall, add the following rules:
Iptables-a output-o eth0-d 224.0.0.18-j ACCEPT iptables-a output-o eth0-s ACCEPT-j ACCEPT iptables-a input-I eth0-d 224.0.0.18-j ACCEPT iptables -a input-I eth0-s 224.0.0.18-j ACCEPT
5. Summary
Keepalived implements dual-machine Hot Standby through virtual routing, which is superior to other solutions.
Because it is a fixed master-slave Hot
Load Balancing for nginx and tomcat in CentOS
Some time ago, leaders always looked at the system, but the system was always updated frequently. In order to prevent the leaders from seeing anything when updating the system, they planned to use ngix as the proxy and deploy two tomcat servers in the background for load balancing
This article is mainly about the simplest solution--dns polling.DNS PollingMost domain name registrars support the resolution of multiple A records, in fact, this is the DNS polling, the DNS server will resolve the request in accordance with the order of a records, one by one assigned to a different IP, so that the simple load balancing is completed.Advantages
Basically no cost, because often domai
The weighted polling policy (http://blog.csdn.net/xiajun07061225/article/details/9318871) for Nginx load balancing is described earlier, which is the underlying strategy for Nginx load balancing, so some of the initialization work For example, configure value dumps, and other policies can directly reuse him. You will s
0 04:37? 00:00:00 nginx:worker processroot 10342 10069 0 06:26 pts/1 00:00:00 grep nginxThen you can test if the nginx is in effect.You can launch two Tomcat in the 192.168.1.104 and 192.168.1.102 servers.And thenhttp://192.168.1.106/test/index.jspVisit a bitI put a test project under the 102 104 machine Tomcat, and there's a index.jsp file in the project.If you can access it to show that the Nginx built successfully, you can also be one of the above, such as 102 tomcat off. See
Ext.: http://ju.outofmemory.cn/entry/52165Main Nginx Load balancer: 172.26.11.99 ( keepalived configured with vip:172.26.11.101 for external use)Nginx Load Balancer: 172.26.11.100 ( keepalived configured with vip:172.26.11.101 for external use)Back-end Web server:172.26.11.73172.26.11.74The key nginx configurations for 172.26.11.99 and 172.26.11.100 are as follows:Vim/etc/nginx/nginx.conf#################..
subnet problem
Through these articles, including this blog, you have learned the functions, principles, features and working modes of Nginx and LVS respectively. In the following article, we will combine these load layer technologies to introduce the installation and configuration of Nginx + keepalived, LVs + keepalived, LVs + keepalived + nginx.(I this Month "Perseverance" award has been received, laugh one: haha ha) Copyright NOTICE: This arti
Description
Operating system: CentOS 5.X 64-bit
Web server: 192.168.21.127, 192.168.21.128
Sites: Bbs.111cn.net and Sns.111cn.net deployed on two Web servers
To achieve the purpose:
Add two servers (main main mode) to achieve Web server load balancing through haproxy+keepalived
Architecture Planning:
Haproxy server: 192.168.21.129, 192.168.
PrerequisiteAdd a new NIC to the two Exchange servers as the Heart network
CAS IP
Heart Network
192.168.1.15
192.168.200.2
192.168.1.16
192.168.200.3
NLB cluster virtual IP
192.168.1.28
To configure server network information: 650) this.width=650; "title=" clip_image002 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-l
.jpg "title=" h3.jpg "alt=" wkiom1sbuastgl02aau2loofbzs748.jpg "/> After the test Master haproxy hangs, whether to switch#killall HaproxyAfter looking at the keepalived log information, found that the master has been stopped according to the script, and the VIP began to drift650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/6B/wKioL1SBulaDv-RTAAEvuh5mw14842.jpg "style=" float: none; "title=" k4.jpg "alt=" Wkiol1sbuladv-rtaaevuh5mw14842.jp
# ln-s/usr/src/kernels/2.6.18-53.el5pae-i686/ /usr/src/linux
# TAR-XZVF ipvsadm-1.24.tar.gz
# CD ipvsadm-1.24
# make
# make install
# CP ipvsadm/sbin/
3. Configure virtual IP services and load Balancing
This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/Servers/zs/
To 192.168.91.10 (LVS host) as a LVS host, for the host network card configuration of dual IP, o
now the part of the theory that encounters complex realities. We have come to the point that the operating system considers the "best" not always equal to the "optimal" that the program Ape thinks. We have observed that, in exceptional cases, most connections are undertaken by two or three processes-especially Linux and Solaris systems.From the operating system perspective, this makes sense: context switching (suspending a process and then reactivating another process) is a fairly resource-inte
Tags: haproxy mysql1. Installation# yum Install Haproxy2. Modify the configuration# vim/etc/haproxy/haproxy.cfgConfigured as followsglobaldaemon nbproc1pidfile/var/run/ haproxy.piddefaultsmodetcp #默认的模式mode {tcp|http|health},tcp is 4 layer, HTTP is 7 layer, health will only return OK retries3 #两次连接失败就认为是服务器不可用, you can also set option by the rear redispatch #当serverId对应的服务器挂掉后, force directed to other healthy servers optionabortonclose #当服务器负载很高的时候, Automatically end the current queue process
10Nb_get_retry 3Delay_before_retry 3Connect_port 8888}}Real_server 192.168.1.107 8888 {#指定real_server2的ip地址Weight 3 #配置节点权重Tcp_check {Connect_timeout 10Nb_get_retry 3Delay_before_retry 3Connect_port 8888}}}Save Exit,Open keepalived ServiceService keepalived StartView status Ipvsadm-l-NConfigure LVS from the server (another LVS)Apt-get Install keepalivedThe configuration from the server is roughly the same as the primary server, to change the state from master to backup in keepalived.confChange
frequent exchanges, and the loss of response can only restart the server.L Low Costbuy F5 big-IP netscaler hardware load balancer switch Hundreds of thousands ofNginx based on BSD Open source protocol free, commercially availablel support rewrite rewrite rulesability to distribute HTTP requests to different back-end server groups based on domain names and URL differencesl built-in health check functionif a
/;
Proxy_set_header Host $host;
Proxy_set_header X-real-ip $remote _addr;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
}
Location/
{
Proxy_pass http://bbb.com/;
Proxy_set_header Host $host;
Proxy_set_header X-real-ip $remote _addr;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
}
}
Descriptionmore than 1 of the aaa.com and bbb.com in the configuration file are custom and write-free. 2 The server in upstream can write multiple,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.