haproxy简单负载均衡搭建
来源:互联网 发布:打开cydia数据库红字 编辑:程序博客网 时间:2024/06/10 08:04
最近对负载均衡进行搭建具体方法如下:
- haproxy 修改部分(haproxy-cfg.cfg)
global daemon maxconn 4500 defaults mode http timeout connect 5000ms timeout client 50000ms timeout server 180000ms stats enable stats uri /stats stats auth admin:age!^*frontend http-in bind *:<span style="color: #ff0000;"><strong>9090</strong></span> default_backend dynamic_serversbackend dynamic_servers mode http option httpclose option forwardfor header X-Forwarded-For appsession JSESSIONID len 52 timeout 30m balance roundrobin server server_9091 191.29.70.6:9091 maxconn 250 server server_9092 191.29.70.6:9092 maxconn 250 server server_9093 191.29.70.6:9093 maxconn 250 server server_9094 191.29.70.6:9094 maxconn 250 server server_9095 191.29.70.6:9095 maxconn 250
使用haproxy做端口转发,只需要修改tomcat的 到不同的端口(保证端口不被占用)
在haproxy映射即可。
启动方法 ./haproxy -f haproxy-cfg.cfg
haproxy 有编译好的版本,也可以自行编译参考方法
http://wenku.baidu.com/view/0a7a28154431b90d6c85c760.html
tomcat示例
<!-- Note: A "Server" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html--><Server <strong><span style="color: #ff0000;">port="9005"</span></strong> shutdown="SHUTDOWN"> <!--APR library loader. Documentation at /docs/apr.html --> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --> <Listener className="org.apache.catalina.core.JasperListener" /> <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html --> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <!-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html --> <GlobalNamingResources> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <!-- A "Service" is a collection of one or more "Connectors" that share a single "Container" Note: A "Service" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/service.html --> <Service name="Catalina"> <!--The connectors can use a shared executor, you can define one or more named thread pools--> <!-- <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150" minSpareThreads="4"/> --> <!-- A "Connector" represents an endpoint by which requests are received and responses are returned. Documentation at : Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) Java AJP Connector: /docs/config/ajp.html APR (HTTP/AJP) Connector: /docs/apr.html Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Connector <span style="color: #ff0000;"><strong>port="9091"</strong></span> protocol="HTTP/1.1" connectionTimeout="100000" redirectPort="8443" URIEncoding="gbk"/><!-- A "Connector" using the shared thread pool--> <!-- <Connector executor="tomcatThreadPool" port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> --> <!-- Define a SSL HTTP/1.1 Connector on port 8443 This connector uses the JSSE configuration, when using APR, the connector should be using the OpenSSL style configuration described in the APR documentation --> <!-- <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> -->.....
0 0
- haproxy简单负载均衡搭建
- Linux下搭建Haproxy负载均衡
- haproxy负载均衡服务器之搭建
- Haproxy+KeepAlived 负载均衡
- 负载均衡(haproxy+keepalive)
- haproxy负载均衡配置
- Haproxy+KeepAlived 负载均衡
- HAProxy MySQL负载均衡
- haproxy + redis 负载均衡
- Keepalived+HAproxy负载均衡
- Haproxy+KeepAlived 负载均衡
- haproxy安装.负载均衡
- Haproxy负载均衡算法
- Thrift+Haproxy负载均衡
- [负载均衡]haproxy
- 均衡负载haproxy
- HAProxy负载均衡
- HAProxy+nginx 负载均衡
- iostat 离线安装
- 最近架构随想
- C++中vector的用法
- 解套操作的主要技巧谈
- highchart 实现mrtg
- haproxy简单负载均衡搭建
- 成为一个 PHP 专家:缺失的环节
- 黑马程序员__c#基础3
- 系统监控的工具tsar
- spring 4 泛型注入
- elasticsearch 性能测试
- C# 简单的方法与属性的继承
- 解决WCF调用时出现错误:“创建MTOM消息读取器时出错”
- heritrix 3.2.0 下载