`

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

阅读更多

网上有一个Apache中文手册,因不常用,地址经常忘记,所以在此记一下:

http://help.114la.com/Apache2/index.html

 

另外,有朋友问Apache 做负载均衡(LoadBalancer),怎么实现会话保持,在手册里找到了说明,顺手抄抄书:

 

ProxyPass 指令

说明语法作用域状态模块
将一个远端服务器映射到本地服务器的URL空间中
ProxyPass [path] !|url [key=value key=value ...]]
server config, virtual host, directory
扩展(E)
mod_proxy

该指令允许你将一个远端服务器映射到本地服务器的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

Parameter Default Description
min 0 Minumum number of connections that will always be open to the backend server.
max 1...n Hard 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.
smax max Upto 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.
timeout Timeout Connection 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.
keepalive Off This 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.
retry 60 Connection 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.
loadfactor 1 Worker 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.

Parameter Default Description
lbmethod - 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 JSESSIONIDPHPSESSIONID, and it depends on the backend application server that support sessions.
nofailover Off If 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.
timeout 0 Balancer timeout in seconds. If set this will be the maximum time to wait for a free worker. Default is not to wait.
maxattempts 1 Maximum 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.

 

 

 

分享到:
评论

相关推荐

    Linux负载均衡集群

    在这个场景中,Apache作为Web服务器,被配置为负载均衡器,而JBoss则是运行在Linux上的应用服务器,它们可以被组织成集群以实现应用的负载分发。 【Apache负载均衡】Apache通过模块mod_jk实现了对应用服务器的负载...

    Windows 2008 NLB Apache2.2 Tomcat 5集群安装配置指导手册

    本手册详细介绍了在Windows 2008操作系统上配置NLB(网络负载均衡)、Apache 2.2和Tomcat 5的集群环境的步骤和要点。以下是根据手册内容整理出的详细知识点: 1. 环境准备:需要有两台安装Windows 2008 R2操作系统...

    Apache Tomcat 7管理手册

    另外,手册或许还会介绍Tomcat 7的高级特性,如集群配置、负载均衡和高可用性。了解如何配置多个Tomcat实例以分担负载或提供故障转移的能力对于构建大规模应用系统至关重要。 最后,随着软件的更新,管理员手册可能...

    glassfish集群搭建手册

    4. 介绍创建jk监听器的部分说明了仅仅依靠Glassfish内部的负载均衡和会话复制功能是不够的,还需要通过配置Apache服务器来保证跨服务器的会话复制和粘滞会话效果。 5. 最后,手册还包括了通过命令行界面进行集群...

    Apache_+_Tomcat来构建J2EE环境系统部署手册

    - **Mod_jk 连接器部分配置**:配置负载均衡、会话共享等功能。 - **JDK 部分配置**:设置 Java 的环境变量等。 - **系统整合**:完成所有组件的配置后,确保各组件之间能够协同工作。 以上是 Apache + Tomcat 构建...

    Tomcat技术资源

    Apache与Tomcat的结合使用,可以实现高效的负载均衡配置。Apache通常作为前端的反向代理服务器,接收并分发用户请求到后端的多个Tomcat实例。Apache的mod_proxy模块是实现这一功能的关键,通过设置ProxyPass和...

    Weblogic使用手册

    集群配置涉及多个方面,包括服务器配置、集群配置、负载均衡策略等。合理规划集群配置,对于提升应用的稳定性和性能至关重要。 #### 分发应用 在WebLogic环境中,应用的分发是一个重要的运维环节。应用可以以WAR、...

    weblogic使用手册大全详解(中文)

    - 集群配置涉及到多个WebLogic服务器实例的协作,包括负载均衡策略、故障转移机制等。 - **新建一个域** - 创建一个新的WebLogic域涉及配置管理服务器和受管服务器、设置监听端口等步骤。 - **监控服务器** - ...

    tomcat中文手册

    《Tomcat中文手册》是Java Web开发者不可或缺的参考资料,它详尽地介绍了Apache Tomcat服务器的配置、管理和优化。Tomcat作为一个开源的Servlet容器,是Java EE应用中的关键组件,尤其在轻量级Web应用程序部署方面...

    Spring Cloud Dalston 中文文档 参考手册 中文版 非扫描 完整版

    Spring Cloud是基于Spring Boot的一系列框架的集合,它利用Spring Boot的开发便利性简化了分布式系统基础设施的开发,如服务发现、配置管理、消息总线、负载均衡、断路器、数据监控等,都可以用Spring Cloud的开发...

    nc+was集群安装手册

    配置负载均衡策略,如基于请求的负载均衡或者基于会话的负载均衡。 - 确保每个服务器的节点代理配置正确,能够加入到集群中,并设置好集群间的通信方式。 7. **安全性设置**: - 配置安全管理,包括用户认证、...

    jetty实施手册

    手册的配置篇涵盖了JBOSS AJP connector、Apache、mod_proxy、Jetty以及dbcp等多个方面的配置细节,这些配置是确保系统正常运行的关键。 **3.1 JBOSS AJP connector配置** JBOSS AJP connector配置主要用于将...

    websphere配置手册

    - **集群配置**:通过负载均衡和故障转移提高可用性和性能。 6. **WebSphere插件**: - **WebSphere Application Server Plugin**:用于与Web服务器(如Apache或IIS)集成,处理请求转发和会话管理。 - **...

    TRSMASv5.0用户手册

    - **负载均衡与会话粘连**:确保系统稳定性和高可用性。 #### 六、网络内容协作平台集成与身份管理 - **TRSWCM集成**(视频库初始配置):介绍了如何集成TRSWCM到现有环境中。 - **TRSIDS配置**(身份管理服务器)...

    Tomcat技术手册

    7. **集群和负载均衡**:Tomcat支持集群配置,通过复制会话数据实现多个实例间的会话同步,配合负载均衡器(如Nginx或Apache HTTPD)可实现高可用性和负载分发。 8. **性能优化**:包括调整JVM参数,启用压缩,缓存...

Global site tag (gtag.js) - Google Analytics