LAMP+haproxy+varnish实现网站访问的动静分离及静态资源缓存

实验目标:
1.    LAMP节点提供用户动态请求访问,数据库单独有数据库节点提供;
2.    LAMP动态网站有两台服务器,提供负载均衡;
3.    静态网站服务器节点提供用户的静态资源请求访问;存在两台静态web服务器,其网站静态资源在静态服务器上存放;
4.    用户的静态请求访问后缓存在varnish服务器上,实现访问加速
5.    前端的haproxy提供反向代理功能,将用户的动态资源请求发送给后端LAMP节点,静态资源请求发往后端静态web服务器;
6.    该架构考虑还不健全,如静态内容的一致性,数据库的单点故障,只是一个不成熟的架构实现简单的动静分离及缓存服务器实现;

实现过程:

一. LAMP构建
================ ha.stu31.com : 172.16.31.10 ================
vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.31.10 ha.stu31.com ha
172.16.31.11 node1.stu31.com node1
172.16.31.12 node2.stu31.com node2
172.16.31.13 node3.stu31.com node3
172.16.31.14 node4.stu31.com node4
172.16.31.15 mysql.stu31.com mysql
172.16.31.16 node5.stu31.com node5
172.16.31.17 node6.stu31.com node6
=======
ssh-keygen -t rsa -P "" -f "/root/.ssh/id_rsa"
for i in {1..6}; do ssh-copy-id -i .ssh/id_rsa.pub node$i; done
for i in {1..6}; do scp /etc/hosts node$i:/etc/hosts; done
for i in {1..6}; do ssh node$i "ntpdate -u 202.112.10.60"; done
for i in {1..6}; do ssh node$i date; done
for i in {1..6}; do ssh node$i "mount /dev/cdrom /mnt/cdrom"; done
for i in {1..2}; do ssh node$i "yum -y install httpd php  mysql  php-mysql"; done
for i in {1..2}; do ssh node$i "service httpd start"; done
vim index.php
<?php
       phpinfo();
?>
///////////
for i in {1..2}; do scp index.php [email protected]$i:/var/www/html; done

====================== windows ======================
浏览器访问 http://172.16.31.11/index.php
浏览器访问 http://172.16.31.12/index.php

============== mysql.stu31.com : 172.16.31.15 ================
mount /dev/cdrom /mnt/cdrom/
yum -y install mysql-server mysql
service mysqld start
mysql
mysql> create schema bbsdb;
mysql> grant all on bbsdb.* to ‘bbsadmin‘@‘172.16.%.%‘identified by ‘oracle‘;
mysql> flush privileges;
mysql> quit

============== node1.stu31.com : 172.16.31.11 ================
wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip
unzip -d /var/www/html/ Discuz_X3.2_SC_UTF8.zip
cd /var/www/html/upload
chmod -R go+w config/ data uc_*

====================== windows ======================
浏览器访问 http://172.16.31.11/upload/install
1. 检查安装环境:
2. 设置运行环境:点击选择全新安装
3. 安装数据库
填写数据库信息
数据库服务器: 172.16.31.15
数据库名: bbsdb
数据库用户名: bbsadmin
数据库密码: oracle
数据表前缀: pre_
系统邮箱: [email protected]
填写管理员信息
管理员账号: admin
管理员密码: admin
重复密码: admin
管理员Email: [email protected]
设置好数据库后点击安装即可

============== node2.stu31.com : 172.16.31.12 ===============

1. cd /var/www/html; scp -r upload/ readme/ utility/ node2:/var/www/html/
2. 重新解压软件包到node2,重新安装一遍,删除数据库重新安装(因为数据库中无重要内容)。

访问测试
====================== windows ======================
http://172.16.31.11/upload/forum.php
http://172.16.31.12/upload/forum.php
能正常访问证明LAMP平台构建成功

二. 静态web服务器构建

============== node5.stu31.com : 172.16.31.16 ===============
scp node1:/root/Discuz_X3.2_SC_UTF8.zip ./
(wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip)
unzip -d /var/www/html/ Discuz_X3.2_SC_UTF8.zip
service httpd start

============== node6.stu31.com : 172.16.31.17 ===============
scp node1:/root/Discuz_X3.2_SC_UTF8.zip ./
(wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip)
unzip -d /var/www/html/ Discuz_X3.2_SC_UTF8.zip
service httpd start

访问测试
====================== windows ======================
http://172.16.31.16/upload/forum.php
http://172.16.31.17/upload/forum.php
只能看到静态界面

三. Varnish缓存服务器构建

============== node3.stu31.com : 172.16.31.13 ===============

wget http://repo.varnish-cache.org/redhat/varnish-3.0/el6/x86_64/varnish/varnish-3.0.6-1.el6.x86_64.rpm
wget http://repo.varnish-cache.org/redhat/varnish-3.0/el6/x86_64/varnish/varnish-docs-3.0.6-1.el6.x86_64.rpm
wget http://repo.varnish-cache.org/redhat/varnish-3.0/el6/x86_64/varnish/varnish-libs-3.0.6-1.el6.x86_64.rpm
yum -y install *.rpm

vim /etc/sysconfig/varnish
NFILES=131072
MEMLOCK=82000
#NPROCS="unlimited"            #加注释
DAEMON_COREFILE_LIMIT="unlimited"        #去注释
RELOAD_VCL=1
VARNISH_VCL_CONF=/etc/varnish/default.vcl
VARNISH_LISTEN_PORT=80              #修改
VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1
VARNISH_ADMIN_LISTEN_PORT=6082
VARNISH_SECRET_FILE=/etc/varnish/secret
VARNISH_MIN_THREADS=1            #修改
VARNISH_MAX_THREADS=1000
VARNISH_THREAD_TIMEOUT=120
VARNISH_STORAGE_FILE=/var/lib/varnish/varnish_storage.bin
VARNISH_STORAGE_SIZE=1G
VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}"
VARNISH_TTL=120
DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
             -f ${VARNISH_VCL_CONF} \
             -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
             -t ${VARNISH_TTL} \
             -w ${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_T
             -u varnish -g varnish \
             -S ${VARNISH_SECRET_FILE} \
             -s ${VARNISH_STORAGE}"
///////////////////////   ( grep -v ^# /etc/sysconfig/varnish |sed ‘/^$/d‘ )

cp /etc/varnish/default.vcl{,.bak}
vim /etc/varnish/default.vcl
:set nu
:15,[email protected]^#@@g

backend default {
  .host = "127.0.0.1";
  .port = "80";
}
#
# Below is a commented-out copy of the default VCL logic.  If you
# redefine any of these subroutines, the built-in logic will be
# appended to your code.
 sub vcl_recv {
     if (req.restarts == 0) {
        if (req.http.x-forwarded-for) {
            set req.http.X-Forwarded-For =
                req.http.X-Forwarded-For + ", " + client.ip;
        } else {
            set req.http.X-Forwarded-For = client.ip;
        }
     }
     if (req.request != "GET" &&
       req.request != "HEAD" &&
       req.request != "PUT" &&
       req.request != "POST" &&
       req.request != "TRACE" &&
       req.request != "OPTIONS" &&
       req.request != "DELETE") {
         /* Non-RFC2616 or CONNECT which is weird. */
         return (pipe);
     }
     if (req.request != "GET" && req.request != "HEAD") {
         /* We only deal with GET and HEAD by default */
         return (pass);
     }
     if (req.http.Authorization || req.http.Cookie) {
         /* Not cacheable by default */
         return (pass);
     }
     return (lookup);
 }

sub vcl_pipe {   
     # Note that only the first request to the backend will have
     # X-Forwarded-For set.  If you use X-Forwarded-For and want to
     # have it set for all requests, make sure to have:
     # set bereq.http.connection = "close";
     # here.  It is not set by default as it might break some broken web
     # applications, like IIS with NTLM authentication.
     return (pipe);
 }

sub vcl_pass {
     return (pass);
 }

sub vcl_hash {
     hash_data(req.url);
     if (req.http.host) {
         hash_data(req.http.host);
     } else {
         hash_data(server.ip);
     }
     return (hash);
 }

sub vcl_hit {
     return (deliver);
 }

sub vcl_miss {
     return (fetch);
 }

sub vcl_fetch {
     if (beresp.ttl <= 0s ||
         beresp.http.Set-Cookie ||
         beresp.http.Vary == "*") {
                /*
                 * Mark as "Hit-For-Pass" for the next 2 minutes
                 */
                set beresp.ttl = 120 s;
                return (hit_for_pass);
     }
     return (deliver);
 }

sub vcl_deliver {
     return (deliver);
 }

sub vcl_error {
     set obj.http.Content-Type = "text/html; charset=utf-8";
     set obj.http.Retry-After = "5";
     synthetic {"
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html>
   <head>
     <title>"} + obj.status + " " + obj.response + {"</title>
   </head>
   <body>
     <h1>Error "} + obj.status + " " + obj.response + {"</h1>
     <p>"} + obj.response + {"</p>
     <h3>Guru Meditation:</h3>
     <p>XID: "} + req.xid + {"</p>
     <hr>
     <p>Varnish cache server</p>
   </body>
 </html>
 "};
     return (deliver);
 }

sub vcl_init {
        return (ok);
 }

sub vcl_fini {
        return (ok);
 }
///////////////////

vim /etc/varnish/web.vcl
:set paste
######定义ACL
acl purgers {                    #定义acl,实现IP地址过滤
   "127.0.0.1";
   "172.16.0.0"/16;
}
######定义健康状态检测
probe dynamic {                  #设置动态网站服务器健康状态检测
   .url = "/index.html";
   .interval = 5s;
   .timeout = 1s;
    .expected_response= 200;
}           #这里设置了两个健康状态检测主要是为了区分动、静网站
probe static {                   #设置动态网站服务器健康状态检测
   .url = "/index.html";       #定义检测的页面
   .interval = 5s;              #探测请求的发送周期,默认为5秒
   .timeout = 1s;               #每次探测请求的过期时间
   .expected_response = 200;
}
######定义后端服务器
backend app1 {                  #定义一个后端服务器
   .host = "172.16.31.11";     #服务器地址
   .port = "80";              #服务器监听端口
   .probe = dynamic;           #健康状态检测
}
backend app2 {
   .host = "172.16.31.12";
    .port = "80";
   .probe = dynamic;
}
backend web1 {         
   .host = "172.16.31.16";
   .port = "80";
   .probe = static;
}
backend web2 {
   .host = "172.16.31.17";
   .port = "80";
   .probe = static;
}
######定义后端动态服务器组,实现负载均衡效果
director apps random {          #定义一个后端服务器组,实现负载均衡效果
    {
        .backend = app1;       #调用前面已定义过的后端主机
    .weight = 2;           #设置权重
    }
    {
    .backend = app2;
    .weight = 2;
    }
}
######定义后端静态服务器组,实现负载均衡效果
director webs random {
    {
       .backend = web1;
       .weight = 2 ;
    }
    {
       .backend = web2;
       .weight = 2 ;
    }
}
######定义vcl_recv函数,实现请求到达并成功接收后调用此函数中定义的规则
sub vcl_recv {
######定义动、静分离,以".php"或".php?后面跟所有文件"结尾的请求都发送到动态服务器,其他请求都发送到静态服务器
   if (req.url ~ "\.php(\?\.*|$)") {
   set req.backend = apps;
    }else {
   set req.backend = webs;
    }
   return(lookup);
######定义允许清除缓存的IP地址,调用的是前面定义的ACL
   if (req.request == "PURGE") {
       if (!client.ip ~ purgers) {
       error 405 "Method not allowed";
    }
       return(lookup);
    }
######重新定义http请求首部,让后端服务器可以记录请求客户端的真实IP地址
       if (req.restarts == 0) {
           if (req.http.x-forwarded-for) {
               set req.http.X-Forwarded-For =
               req.http.X-Forwarded-For +", " + client.ip;
           } else {
                 set req.http.X-Forwarded-For =client.ip;
           }
        }
######除了定义的请求方法外,其他请求都到后端服务器
   if (req.request != "GET" &&
       req.request != "HEAD" &&
       req.request != "PUT" &&
       req.request != "POST" &&
       req.request != "TRACE" &&
       req.request != "OPTIONS" &&
       req.request != "DELETE") {
       return (pipe);
    }
   if (req.request != "GET" && req.request !="HEAD") {
       return (pass);
    }
######定义不缓存认证与Cookie信息
   if (req.http.Authorization || req.http.Cookie) {
       return (pass);
    }
######定义压缩功能
   if (req.http.Accept-Enconding) {
      if (req.url ~ "\.(jpg|jpeg|gif|bmp|png|flv|gz|tgz|tbz|mp3)$"){
          remove req.http.Accept-Encoding;
      remove req.http.Cookie;
      } else if (req.http.Accept-Encoding ~ "gzip") {
      set req.http.Accept-Encoding = "gzip";
      } else if (req.http.Accept-Encoding ~ "deflate") {
      set req.http.Accept-Encoding = "deflate";
      } else { remove req.http.Accept-Encoding;
      }
    }
######定义指定格式结尾的文件去除Cookie信息
   if (req.request == "GET" && req.url ~"\.(jpeg|jpg|gif|png|bmp|swf)$") {
   unset req.http.cookie;
    }
######定义防盗链设置
   if (req.http.referer ~ "http://.*") {
       if (!(req.http.referer ~ "http://.*\.baidu\.com" ||req.http.referer ~ "http://.*\.google\.com.*")) {
              set req.http.host ="www.stu31.com";
         set req.url = "http://172.16.31.10/error.html";
    }
    }
}
######定义vcl_hash函数
sub vcl_hash {
    hash_data(req.url);
   if (req.http.host) {
       hash_data(req.http.host);
    }else {
       hash_data(server.ip);
    }
   return(hash);
}
######定义vcl_hit函数
sub vcl_hit {
   if (req.request == "PURGE") { #语法方法为"PURGE"
      purge;                     #清除缓存
      error 200 "Purged.";      #返回错误状态码为"200"
    }
   return(deliver);
}
######定义vcl_miss函数
sub vcl_miss {
   if (req.request == "PURGE") {
   purge;
   error 404 "Not In Cache.";
    }
   return(fetch);
}
######定义vcl_psss函数
sub vcl_pass {
   if (req.request == "PURGE") {
      error 502 "Purged On A Passed Object.";
    }
   return(pass);
}
######定义vcl_fetch函数
sub vcl_fetch {
######定义缓存,如果匹配到已定义文件结尾的缓存1天,其他则缓存1小时
   if (req.request == "GET" && req.url ~"\.(html|jpg|png|bmp|jpeg|gif|js|ico|swf|css)$") {
      set beresp.ttl = 1d;
      set beresp.http.expires = beresp.ttl;
    }else {
      set beresp.ttl = 1h;
    }
   return(deliver);
}
######定义在http首部中,如果请求命中显示"HIT",未命中则显示"MISS",通过F12可查看缓存命中状态及varnish服务器IP
sub vcl_deliver {
   if (obj.hits > 0) {
      set resp.http.X-Cache = "Hit from " + server.ip;
    }else {
      set resp.http.X-Cache = "MISS";
    }
}
//////////////////////////// end for /etc/varnish/web.vcl

/etc/rc.d/init.d/varnish  start
netstat -tnlp | grep varnish

varnishadm -S/etc/varnish/secret -T 127.0.0.1:6082
varnish> vcl.load cache web.vcl
varnish> vcl.use cache
varnish> vcl.list
varnish> quit

============== node4.stu31.com : 172.16.31.14 ===============
scp node3:/root/*.rpm ./
yum -y install *.rpm
scp node3:/etc/sysconfig/varnish /etc/sysconfig/
scp node3:/etc/varnish/*.vcl /etc/varnish

/etc/rc.d/init.d/varnish  start
netstat -tnlp | grep varnish

varnishadm -S/etc/varnish/secret -T 127.0.0.1:6082
varnish> vcl.load cache web.vcl
varnish> vcl.use cache        #立刻生效, 重启varnish失效
varnish> vcl.list
varnish> quit

如果我们希望后端的web服务器记录客户端访问的真实IP地址,我们需要配置httpd的配置文件中的日志格式:
node1, node2, node5, node6四个节点都要
vim /etc/httpd/conf/httpd.conf   
LogFormat "%{X-Forwarded-For}i %l %u%t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""combined
///////////
service httpd reload
echo "ok" > /var/www/html/index.html    #此页面用于varnish做健康检测

四. HAProxy反向代理构建

=============== ha.stu31.com : 172.16.31.10 ================
mount /dev/cdrom /mnt/cdrom
yum -y install haproxy

vim /etc/rsyslog.conf
# Save boot messages also to boot.log
local7.*                                                /var/log/boot.log
local2.*                                                /var/log/haproxy.log     #添加此行
//////////////
service rsyslog restart

cd /etc/haproxy/
cp haproxy.cfg{,.bak}
vim haproxy.cfg
global
    log         127.0.0.1 local2
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon
    stats socket /var/lib/haproxy/stats

defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000

:set paste

listen stats        #添加此块
    mode http
    bind 0.0.0.0:1080
    stats enable
    stats hide-version
    stats uri     /haproxyadmin?stats
    stats realm   Haproxy\ Statistics
    stats auth    admin:admin
    stats admin if TRUE

frontend http-in        #修改很多内容
    bind *:80
    mode http
    log global
    option httpclose
    option logasap
    option dontlognull
    capture request  header Host len 20
    capture request  header Referer len 60
    acl url_static       path_beg       -i /upload/static/image/
    acl url_static       path_end       -i .html .jpeg .gif .png .jpg
    acl url_dynamic      path_end       -i .php .css .js .jsp
    use_backend static_servers         if url_static
    use_backend dynamic_servers        if url_dynamic
    default_backend static_servers

backend static_servers
    balance roundrobin
    server staticsrv1 172.16.31.13:80 check maxconn 3000
    server staticsrv2 172.16.31.14:80 check maxconn 3000

backend dynamic_servers
    balance source
    server dynamicsrv1 172.16.31.11:80 check maxconn 3000
    server dynamicsrv2 172.16.31.12:80 check maxconn 3000
//////////////////

service haproxy start

五. 测试访问

====================== windows =====================
访问论坛
http://172.16.31.10/upload/forum.php

访问haproxy的状态页
http://172.16.31.10:1080/haproxyadmin?stats
admin
admin

window浏览器F12检查缓存命中情况

varnish上的日志
[[email protected] ~]# varnishlog

原始服务器的日志
[[email protected] ~]# tail /var/log/httpd/access_log

时间: 2024-10-20 17:09:40

LAMP+haproxy+varnish实现网站访问的动静分离及静态资源缓存的相关文章

haproxy+varnish实现discuz论坛的动静分离以及静态缓存

一.目的: (1) 动静分离discuzx,静态资源通过NFS挂载至动态服务器中: (2) varnish缓存静态资源: 二.拓扑规划 三.步骤:     1.先部署discuz的动静分离 (1)在app动态服务器快速搭建LAMP环境: yum install -y httpd mysql-server php php-mysql (2)创建discuz论坛的mysql用户: MySQL [(none)]> GRANT ALL ON *.* TO 'nihao'@'localhost' IDEN

haproxy+varnish+amp集群实现动静分离

    一.简介 Haproxy一个高性能的负载均衡服务软件,它可基于四层和七层之间进行调度,而且对各个节点具有健康状态检测的功能,当后端服务器故障时,会自动标记为不可用状态,当服务器上线时还会自动将后端主机上线.比起lvs其配置简单,且引入了frontend,backend,listen等功能,frontend可添加acl规则,可根据HTTP请求头做规则匹配,然后把请求定向到相关的backend.       二.配置相关参数详解 haproxy主要分为global.defaults.fron

HAproxy企业应用,TCP/HTTP动静分离

HAproxy企业应用,TCP/HTTP动静分离HAProxy的是一个免费的.开源的的tcp/http反向代理工具.负载均衡器,是一个企业非常快速和可靠的安全的解决方案,提供高可用性.高并发性,负载均衡和代理对TCP和基于HTTP的应用程序.它特别适用于流量非常高的网站.它已成为事实上的标准开源负载均衡器,现在随大多数主流Linux发行版一起提供,在互联网领域应用也是非常广泛,受欢迎的第三方工具. 在企业实际应用环境中,往往会根据业务请求将相关不同请求跳转到指定的后端服务器,比如客户静态资源请求

使用HAproxy如何实现web站点的动静分离

HAProxy提供高可用性.负载均衡以及基于TCP和HTTP应用的代理,支持虚拟主机,它是免费.快速并且可靠的一种解决方案.      HAProxy特别 适用于那些负载特大的web站点,这些站点通常又需要会话保持或七层处理.HAProxy运行在当前的硬件上,完全可以支持数以万计的并发连接.并且它的 运行模式使得它可以很简单安全的整合进您当前的架构中,同时可以保护你的web服务器不被暴露到网络上.    HAProxy实现了一种事件驱动,单一进程模型,此模型支持非常大的并发连接数.多进程或多线程

haproxy+keepalived双主模型及动静分离的实现

实验目标: 1.haproxy统计页面的输出机制: 2.haproxy动静分离机制: 3.基于keepalived的高可用实现: 环境: vm8虚拟机 操作系统: centos 6.4 内核版本: 2.6.32-358.el6.x86_64 注: (1) 每个haproxy各有两块网卡,外网网卡选择Bridge,内网网卡选择Vmnet2; (2) 内部两台web服务器的网卡都是选择Vmnet2; 一.准备工作: 1.各节点IP地址相关设置 node1:  ifconfig eth1 192.16

Varnish的负载均衡、动静分离

一.Varish的简介 Varnish是一款高性能的开源HTTP加速器,挪威最大的在线报纸 Verdens Gang 使用3台Varnish代替了原来的12台Squid,性能比以前更好. 在当前主流的Web架构中,Cache担任着越来越重要的作用.常见的基于浏览器的C/S架构,Web Cache更是节约服务器资源的关键.而最近几年由FreeBSD创始人之一Kamp开发的varnish更是一个不可多得的Web Cache Server.严格意义上说,Varnish是一个高性能的反向代理软件,只不过

html 如何访问 jar 包里面的静态资源(js、css、字体等)

前言:最近两天在尝试写一个工具 jar 包,里面包含后台处理的 java 代码,包含前端 html.js.css.字体文件等,过程中解决了访问 jar 包里的静态资源问题,所以记录下来. 附:自己的一个 jar 包源码 https://github.com/yuleGH/querydb 方式一: 最开始采用阿里巴巴的源码 druid 的做法,使用一个 servlet,然后所有的请求经过这个 servlet,如果是文件,就读取到文件, 返回给前端. 这种方式经实现,没问题.不过感觉是有点影响性能.

利用Haproxy对Discuz实现数据的动静分离

一,实验目的 利用Haproxy+Discuz实现数据的动静分离 二,实验模型 三,实验环境 四,实验内容 1,首先在node2,3上安装http服务,安装PHP 2,提供NFS文件共享存储 配置node2的web根目录为nfs共享目录为挂载在node3的文件根目录下. node3: mount -t nfs 172.16.18.1:/var/www/html/upload   /var/www/html/upload 3,在node2上部署Discuz论坛 将Discuz解压到站点根目录下.进

HAproxy的负载均衡+日志独立+动静分离+读写分离的配置

主机环境   redhat6.5 64位 实验环境   服务端1 ip 172.25.29.2            服务端2 ip 172.25.29.3             管理端1 ip 172.25.29.1  防火墙状态:关闭 1.Haproxy的负载均衡及测试 A)负载均衡的配置 [[email protected] ~]# yum install haproxy -y            #安装haproxy [[email protected] ~]# vim /etc/h