Squid

简介:

1、Squid代理有三种模式:

传统代理、透明代理和反向代理

wKiom1fnmSGz-x0FAANAJ3YNLkQ802.png



2、haproxy和squid代理的区别

haproxy是专业代理,squid可以做代理和缓存



3、安装squid硬件和系统要求

squid可以运行在几乎所有的常见Unix及Linux系统上,也可以在Windows上运行。

1)第一重要资源:内存

squid对硬件的要求最主要的就是内存资源,内存短缺会影响性能。因为所有的对象都会被缓存到内存中,


2)第二重要资源:磁盘IO

磁盘空间也是另一个squid能够高效运行的重要因素。更多的磁盘空间意味着更多的缓存目标和更高的命中率。快速的磁盘介质也是必要的。例如:SSD、SAS代替SATA硬盘

当然快速的CPU也是好的,但他并不是提高性能的关键因素。



4、Squid安装

1)下载安装包:http://www.squid-cache.org/Versions/

2)编译前关键内核调整

a、调整文件描述符

关于文件描述符的介绍参考:http://qingwang.blog.51cto.com/505009/579064/

查看当前用户的文件描述符设置:

1
2
# ulimit -n
1024


设置文件最大最大描述符的数目的方法:

方法一“”

1
2
#ulimit -Hn 20480
#echo “ulimit -Hn 20480” >> /etc/rc.local

方法二:

vim /etc/sysctl.conf

追加以下内容

1
fs. file -max = 102400

保存后使用sysctl -p命令使其生效


b、调整临时端口范围:

查看临时端口范围的方法:

1
2
# cat /proc/sys/net/ipv4/ip_local_port_range 
32768  61000

修改端口范围方法:

1
2
3
4
echo  "net.ipv4.ip_local_port_range = 4000  65000"  >> /etc/sysctl .conf
sysctl -p
# cat /proc/sys/net/ipv4/ip_local_port_range 
4000  65000


c、编译前查看帮助:

帮助文件路径在解压后的目录下,名为INSTALL

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
cat  INSTALL 
/*
  * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
  * Please see the COPYING and CONTRIBUTORS files  for  details.
  */
To build and  install  the Squid Cache,  type :
% . /configure  --prefix= /usr/local/squid
         make  all
         make  install
To run a Cache, you will need to:
1. customize the squid.conf configuration  file :
       vi  /usr/local/squid/etc/squid .conf
2. Initalise the cache:
       /usr/local/squid/sbin/squid  -z
       
3. start the cache:
       /usr/local/squid/sbin/squid
If you want to use the WWW interface to the Cache Manager, copy
the tools /cachemgr .cgi program into your httpd server's cgi-bin


d、安装

安装gcc和gcc-c++

1
2
3
yum -y  install  gcc gcc-c++
. /configure  --prefix= /usr/local/squid  -- enable -icmp -- enable -storeio=ufs,aufs
#make && make install










本文转自 曾哥最爱 51CTO博客,原文链接:http://blog.51cto.com/zengestudy/1856391,如需转载请自行联系原作者

目录
相关文章
Squid 安装与配置
本文转载自:https://help.aliyun.com/knowledge_detail/41342.html Squid 介绍 Squid 是一个缓存 Internet 数据的软件,其接收用户的下载申请,并自动处理所下载的数据。
1490 0
|
缓存 应用服务中间件 开发工具
squid反向代理
squid反向代理
|
缓存 网络安全
squid 代理服务器应用(上)
Squid 主要提供缓存加速、应用层过滤控制的功能。
squid 代理服务器应用(上)
|
缓存 网络协议 PHP
|
Web App开发 开发工具
|
网络协议 缓存 开发工具
|
Web App开发 缓存 监控