Squid3.0 reverse WEB acceleration proxy + DNS round robin For detailed Load Balancing Configuration

Source: Internet
Author: User
Tags squid proxy
This article is very well written. It will be useful in the future. A typical squid proxy application. system topology: ● a DNS server: Operating System Freebsd, software BIND9.5, IP192.168.76.222; ● three Squid servers: Operating System LinuxAS4, software Squid3.0, corresponding IP Address: Squid1: 192.168.76.223Squid2:

 

This article is very well written. It will be useful in the following articles. It is a typical squ.IdProxy application.

System topology:

 

 

● One DNS server: Operating System Freebsd, software BIND 9.5, IP 192.168.76.222;

● Three Squid servers: Linux AS 4, software Squid 3.0, and corresponding IP addresses:

Squid1: 192.168.76.223

Squid2: 192.168.76.133

Squid3: 192.168.76.225

● Three WEB servers: Linux AS 4 and application softwareMcAt 5.0 + Mysql, the corresponding IP address is as follows:

WebServer1: 210.82.118.195

WebServer2: 192.168.76.226

WebServer1: 192.168.76.227

 

Installation and configuration of Application Software

Configure DNS Server

The software uses Freebsd's bind 9.5. Then configure bind for the system. First, modify the bind configuration file/etc/nam.EdB/named. conf, add it to the file

Zone "cache.ibm.com.cn "{

Type master;

File"Master/cache.ibm.com.cn ";

};

Add the cache.ibm.com.cn file in the/etc/namedb/master Directory. The content of the file is as follows:

$ TTL 3600

@ In soa search. ibm.com.cn. root. ibm.com.cn .(

20080807; Serial

3600; Refresh

900; ReTrY

3600000; Expire

3600); Minimum

In ns search.ibm.com.cn.

1 in ptr localhost.ibm.com.cn.

Wenjin in a 192.168.76.223

Wenjin in a 192.168.76.133

Wenjin in a 192.168.76.225

In this way, when the user requests, DNS uses the polling mechanism to resolve the domain name of wenjin.cache.ibm.com.cn to one of 192.168.76.223, 192.168.76.20.and 192.168.76.225.

After the configuration is complete, run rndc star t to start the bind service.

Use ps-A |GrepNamed: Check whether the bind service is up;

Use nsLookUp wenjin.cache.ibm.com.cn to test whether the bind service is running properly.

 

Configure the Squid1 Server

Download the squid-3.0.STABLE8.tar.gz source package and put it in the/home Directory

SolutionCompression:

Tar-zxvf squid-3.0.STABLE8.tar.gz

Set configuration parameters:

CdSquid-3.0.STABLE10

./Configure-prefix =/usr/local/squid

Install squid in the/usr/local directory

Compile and install:

Make

Make install

After the installation, the squid directory is displayed in the/usr/local directory.

Configure the squid configuration file

Edit the squid. conf file,

Vi/usr/local/squid/etc/squid. conf

Cache_inclutive_user squid

Cache_paitive_group squid

 

######### Set the squid host name.

Visible_hostname squid1.nlc.gov.cn

 

############ Configure squid as the acceleration mode #################

Http_port 80 accel vhost vport

ICp_ Port 3130

 

##### Configure squid2 and squid3 as the neighbor. When squid1 does not find the requested resource in its cache, It retrieves the cache from its neighbor through the ICP query.

Cache_peer squid2.ibm.com.cn sibling 80 3130

Cache_peer squid3.ibm.com.cn sibling 80 3130

 

##### For the three parent nodes of squid1, The originserver parameter indicates the source server, and the round-robin parameter indicates that squid distributes requests to one of the parent nodes through polling; squid also checks the health status of these parent nodes. If the parent node is down, squid captures data from the remaining origin servers.

Cache_peer 210.82.118.195 parent 8080 0 no-query originserver round-robin name = webServer1

Cache_peer 192.168.76.226 parent 8080 0 no-query originserver round-robin name = webServer2

Cache_peer 192.168.76.227 parent 8080 0 no-query originserver round-robin name = webServer3

 

#### Forward requests from the wenjin.cache.ibm.com.cn domain to one of the three parent nodes through RR round robin

Cache_peer_domain webServer1 wenjin.cache.ibm.com.cn

Cache_peer_domain webServer2 wenjin.cache.ibm.com.cn

Cache_peer_domain webServer3 wenjin.cache.ibm.com.cn

Cache_peer_domain webServer1 webServer2 webServer3 wenjin.cache.ibm.com.cn (the preceding three rows can also be written as one line)

 

##### Below are some access control, log and cache directory settings

Acl locaLnEt src 192.168.76.223 192.168.76.20.192.168.76.225

Acl all src 0.0.0.0/0.0.0.0

Http_access allow all

Icp_access allow localnet

Cache_log/usr/local/squid/var/logs/cache. log

Access_log/usr/local/squid/var/logs/access. log squid

Cache_dir ufs/usr/local/squid/var/cache/1000 16 256

 

####### Optimization of squid ###############

Maximum_object_size 10240 KB ### Maximum Cache objects: 10 MB

Maximum_object_size_in_memory 512 KB ### maximum cached objects in memory: 512 KB

Cache_mem 256 MB ### squid memory used for Cache

After saving: wq exits.

 

Add

192.168.76.223 squid1.ibm.com.cn

192.168.76.20.squid2.ibm.com.cn

192.168.76.225 squid3.ibm.com.cn

After saving: wq exits.

 

Check whether the squid configuration file is correct:

/Usr/local/squid/sbin/squid-k parse/reconfigure (-k -- help can be viewed)

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.