设为首页 收藏本站
查看: 945|回复: 0

[经验分享] 记个Apache中文手册地址(负载均衡配置及会话保持配置说明)

[复制链接]

尚未签到

发表于 2017-1-13 11:07:56 | 显示全部楼层 |阅读模式
  网上有一个Apache中文手册,因不常用,地址经常忘记,所以在此记一下:
  http://help.114la.com/Apache2/index.html
  另外,有朋友问Apache 做负载均衡(LoadBalancer),怎么实现会话保持,在手册里找到了说明,顺手抄抄书:
语法ProxyPass [path] !|url [key=value key=value ...]]作用域server config, virtual host, directory状态扩展(E)模块mod_proxy
ProxyPass 指令
说明将一个远端服务器映射到本地服务器的URL空间中
  该指令允许你将一个远端服务器映射到本地服务器的URL空间中,此时本地服务器并不充当代理角色,而是充当远程服务器的一个镜像。path是一个本地虚拟路径名,url是一个指向远程服务器的部分URL,并且不允许包含查询字符串。
当使用ProxyPass指令时,ProxyRequests指令通常应当被设为 off
  假设本地服务器地址是:http://example.com/ ,那么,
  ProxyPass /mirror/foo/ http://backend.example.com/

  将会导致对http://example.com/mirror/foo/bar的本地请求将会在内部转换为一个代理请求:http://backend.example.com/bar 。
  "!"指令对于您不想对某个子目录进行反向代理时很有用。比如说:
  ProxyPass /mirror/foo/i !
ProxyPass /mirror/foo http://backend.example.com

  将会代理除/mirror/foo/i之外的所有对backend.example.com下/mirror/foo的请求。
注意
  顺序很重要,您需要把拒绝指令放置在普通ProxyPass指令之前

  As of Apache 2.1, the ability to use pooled connections to a backend server is available. Using the key=value parameters it is possible to tune this connection pooling. The default for a Hard Maximum for the number of connections is the number of threads per process in the active MPM. In the Prefork MPM, this is always 1, while with the Worker MPM it is controlled by the ThreadsPerChild.
  Setting min will determine how many connections will always be open to the backend server. Upto the Soft Maximum or smax number of connections will be created on demand. Any connections above smax are subject to a time to live or ttl. Apache will never create more than the Hard Maximum or max connections to the backend server.
  ProxyPass /example http://backend.example.com smax=5 max=20 ttl=120 retry=300

ParameterDefaultDescriptionmin0Minumum number of connections that will always be open to the backend server.max1...nHard Maximum number of connections that will be allowed to the backend server. The default for a Hard Maximum for the number of connections is the number of threads per process in the active MPM. In the Prefork MPM, this is always 1, while with the Worker MPM it is controlled by the ThreadsPerChild. Apache will never create more than the Hard Maximum connections to the backend server.smaxmaxUpto the Soft Maximum number of connections will be created on demand. Any connections above smax are subject to a time to live or ttl. ttl-Time To Live for the inactive connections above the smax connections in seconds. Apache will close all connections that has not been used inside that time period. timeoutTimeoutConnection timeout in seconds. If not set the Apache will wait until the free connection is available. This directive is used for limiting the number of connections to the backend server together with max parameter. acquire-If set this will be the maximum time to wait for a free connection in the connection pool. If there are no free connections in the pool the Apache will return SERVER_BUSY status to the client. keepaliveOffThis parameter should be used when you have a firewall between your Apache and the backend server, who tend to drop inactive connections. This flag will tell the Operating System to send KEEP_ALIVE messages on inactive connections (interval depends on global OS settings, generally 120ms), and thus prevent the firewall to drop the connection. To enable keepalive set this property value to On. retry60Connection pool worker retry timeout in seconds. If the connection pool worker to the backend server is in the error state, Apache will not forward any requests to that server until the timeout expires. This enables to shut down the backend server for maintenance, and bring it back online later. loadfactor1Worker load factor. Used with BalancerMember. It is a number between 1 and 100 and defines the normalized weighted load applied to the worker. route-Route of the worker when used inside load balancer. The route is a value appended to seesion id. redirect-Redirection Route of the worker. This value is usually set dynamically to enable safe removal of the node from the cluster. If set all requests without session id will be redirected to the BalancerMember that has route parametar equal as this value.   If the Proxy directive scheme starts with the balancer:// then a virtual worker that does not really communicate with the backend server will be created. Instead it is responsible for the management of several "real" workers. In that case the special set of parameters can be add to this virtual worker.
ParameterDefaultDescriptionlbmethod-Balancer load-balance method. Select the load-balancing scheduler method to use. Either byrequests, to perform weighted request counting or bytraffic, to perform weighted traffic byte count balancing. Default is byrequests. stickysession-Balancer sticky session name. The value is usually set to something like JSESSIONID或PHPSESSIONID, and it depends on the backend application server that support sessions. nofailoverOffIf set to On the session will break if the worker is in error state or disabled. Set this value to On if backend servers do not support session replication. timeout0Balancer timeout in seconds. If set this will be the maximum time to wait for a free worker. Default is not to wait. maxattempts1Maximum number of failover attempts before giving up.   ProxyPass /special-area http://special.example.com/ smax=5 max=10
ProxyPass / balancer://mycluster stickysession=jsessionid nofailover=On
<Proxy balancer://mycluster>
BalancerMember http://1.2.3.4:8009
BalancerMember http://1.2.3.5:8009 smax=10
# Less powerful server, don't send as many requests there
BalancerMember http://1.2.3.6:8009 smax=1 loadfactor=20
</Proxy>

  When used inside a <Location> section, the first argument is omitted and the local directory is obtained from the <Location>.
  If you require a more flexible reverse-proxy configuration, see the RewriteRule directive with the [P] flag.


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-327928-1-1.html 上篇帖子: 使用Apache POI 实现导出数据到Excel 并下载到本地 下篇帖子: 宁波网络公司-浙江海商网apache+awstats安装过程
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表