1.linux lvs nat Load balancing

Add two network cards and open the routing pipeline

echo > /proc/sys/net/ipv4/ip_forward // Start routing pipes 

install ipvsadm

yum install ipvsadm

To configure ipvsadm

iptables -F // Clear firewall 
ipvsadm -C // clear ipvsadm To configure
ipvsadm -At 8.8.8.8: -s rr // tell ipvsadm Dispatch 8.8.8.8 Of 80 port , And the scheduling mode is polling (-s rr)
// Set up the real server for scheduling
ipvsadm -at 8.8.8.8: -r 192.168.1.10: -m
ipvsadm -at 8.8.8.8: -r 192.168.1.11: -m
// Let's assume that the Internet IP by 8.8.8.8, Intranet IP by 192.168.1.2, Intranet two clothes WEB The servers are 192.168.1.10,192.168.1.11 And the gateway points to 192.168.1.2

2.nginx Reverse agent to achieve load balancing

yum install nginx

// add to nginx Of yum package 
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm yum install nginx

Configure the proxy server

// modify /ect/nginx/nginx.conf
client_max_body_size 300m;
client_body_buffer_size 128k;
client_body_temp_path /dev/shm/client_body_temp;
proxy_read_timeout ;
proxy_send_timeout ;
proxy_buffer_size 16k;
proxy_buffers 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_temp_path /dev/shm/proxy_temp;
upstream cluster{
server 192.168.1.10: weight= max_fails= fail_timeout=30s;
server 192.168.1.11: weight= max_fails= fail_timeout=30s;
}
// modify /ect/nginx/conf.d/defaut.conf
location / {
root /usr/share/nginx/html;
index index.html index.htm;
proxy_pass http://cluster/;
proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}

linux More articles on Load Balancing

  1. Linux Load balancing software LVS brief introduction

    Linux Load balancing software LVS LVS The architecture and characteristics of cluster 1. LVS brief introduction         LVS yes Linux Virtual Server For short , That is to say Linux Virtual server , It was initiated by Dr. Zhang wensong ...

  2. Linux Load balancing software LVS The second ( Installation chapter )[ turn ]

    Linux Load balancing software LVS The second ( Installation chapter ) 2011-04-26 16:01:47 label :lvs Installation configuration  linux lvs  leisure  linux High availability Original works , Allowed to reprint , Please be sure to indicate the text in the form of hyperlink when reprinting ...

  3. ( turn )Linux Load balancing software LVS One of ( Concept )

    turn :http://ixdba.blog.51cto.com/2895551/552947 Linux Load balancing software LVS The second ( Installation chapter ):http://ixdba.blog.51cto.com/28955 ...

  4. linux Load balancing ( What is load balancing )

    linux Load balancing ( What is load balancing ) One . summary One sentence summary : Build on the existing network structure , It provides a cheap, efficient and transparent way to expand the bandwidth of network devices and servers . Increased throughput . Strengthening network data processing capacity . Improve network flexibility and availability ...

  5. Linux The concept and practice of load balancing ( Two )

    Build practice LVS+Keepalived Load balancing keepalived summary 1.keepalived It's specifically for LVS A powerful tool for designing , It is mainly used to provide fail over and health check functions —— Judge LVS Load scheduler ...

  6. Linux The concept and practice of load balancing ( One )

    According to the online articles . Load balancing software LVS(Linux Virtual Server) Concept lvs Is in linux Build a virtual server based on the operating system , Achieve load balancing between service nodes . It is based on linux Kernel implemented .2 ...

  7. Linux Load balancing software LVS One of ( Concept )

    One . LVS brief introduction LVS yes Linux Virtual Server For short , That is to say Linux Virtual server , Is a free software project initiated by Dr. Zhang wensong , Its official website is www.linuxvirtualserver ...

  8. Linux Load balancing software LVS Of the four ( Test paper - End )

    One . start-up LVS The cluster service LVS There are two ways to manage and use load balancing , A is ipvsadm Command line and ldirectord Monitoring mode , A is Piranha Tools to manage and use . Here are the introduction . 1. utilize ipvsad ...

  9. linux Load balancing configuration keepalive lvs Use nginx forward CentOS7 build LVS+keepalived Load balancing

    Recently, I hope to be able to configure load balancing , On the virtual machine , But I found a lot of information on the Internet, which is very scattered , For those who don't know , Many of them are not detailed enough , It's finally done recently , Write down the specific steps , It's convenient for you to check and study This experiment needs to be installed nginx If not installed ...

Random recommendation

  1. hibernate( 8、 ... and ) Hibernate Search strategy ( Class level , Association level , Batch Search ) Detailed explanation

    preface A lot of things that seem difficult are not difficult , The key is to see if you spend time and energy looking at , If you can understand something , alike , Others can understand it , It doesn't show the gap with others , So when you feel like you've read a lot or learned a lot , Do you want to ...

  2. asp.net in GridView Of CheckedUnBindCheckBox attribute

    1. obtain GridView in CheckBox Fields for the selected row , Even when the data source is bound , You can also get the selected CheckedUnBindCheckBox The fields of the corresponding columns It can be modified according to the actual situation . ...

  3. Traffic Lights - SGU 103( shortest path )

    The main idea of the topic : There's a road map of the city , Yes N A crossing point , There is only one road between every two intersections , Now I want to start from the intersection u De intersection v, But the traffic on this road is special , Every road has a traffic light , Lights come in two colors , Blue and purple , For example, a route at the intersection s,t Between , ...

  4. html Table Achieve the meter head fixed

    I've been working on the front desk trivia recently , I've also learned linux, There is no time for in-depth research and learning of new things , I didn't blog , But the reason for this is still laziness . I don't say much nonsense , Today, I want to share a little thing about the front page design , that ...

  5. 1076: [SCOI2008] Reward level ( dp )

    Expectation pressure dp.... ------------------------------------------------------------------ #include<cstdio> ...

  6. mybatis error ——java.io.IOException: Could not find resource com/xxx/xxxMapper.xml

    I'm learning Mybatis When , Refer to the online tutorial for simple demo Build , There is no problem with the configuration , And then there was the following error ! Exception in thread "main" java.lang. ...

  7. spring Annotation related configuration

    One .<context:annotation-config> and <context:component-scan> <context:annotation-config&g ...

  8. HTML Catalog :

    HTML Commonly used labels CSS style

  9. EFCore Lazy Loading + Inheritance = Clean data sheet ( Two ) 【 Dedicated to Virgo DB First Program the ape 】

    Preface This is the last one EFCore Lazy Loading + Inheritance = Clean data sheet ( One ) [ Dedicated to Virgo DB First Program the ape ] Front dish The sequel of . This one is really for Virgo DB Fi ...

  10. Using unsafe code will Bitmap The bitmap changes to WPF Of ImageSource To achieve high performance and sustained small memory footprint

    stay WPF Will be a ready-made Bitmap Convert bitmap to ImageSource Used to show a troublesome thing , because WPF There are not many ways to turn around . But it produces Bitmap But there are many sources , Like screen shots . ...