最近对负载均衡进行搭建具体方法如下:
- 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:linkage!^* frontend http-in bind *:9090 default_backend dynamic_servers backend dynamic_servers mode http option httpclose option forwardfor header X-Forwarded-For appsession JSESSIONID len 52 timeout 30m balance roundrobin server server_9091 218.9.70.6:9091 maxconn 250 server server_9092 218.9.70.6:9092 maxconn 250 server server_9093 218.9.70.6:9093 maxconn 250 server server_9094 218.9.70.6:9094 maxconn 250 server server_9095 218.9.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 port="9005" 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 port="9091" 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" /> --> .....
相关推荐
mariadb+haproxy负载均衡集群搭建.docx
用haproxy实现RDP会话负载均衡 这篇文章主要针对 thinstation 方案来做测试。
这是一个PPT,主要讲解在liunx服务器搭建一下haproxy应用实现负载均衡功能。
Galera是一个MySQL(也支持MariaDB,Percona)的同步多主集群软件,目前只支持InnoDB引擎。 主要功能: • 同步复制 • 真正的multi-master,即所有节点可以同时读写数据库 • 自动的节点成员控制,失效节点自动被...
redhat 5.8(64位)下HAproxy+Keepalived 负载均衡架构搭建@整理V1..rar
redhat 6.4(64位)下HAproxy+Keepalived 负载均衡架构搭建.docx
准备4台Linux服务器,两台做Web服务器,1台安装HAProxy,1台做客户端。实现如下功能: 客户端访问HAProxy,HAProxy分发请求到后端Real Server; 开启HAProxy监控页面,及时查看调度器状态; 设置HAProxy为开机启动;
redhat6.4(64位)下HAproxy+Keepalived负载均衡架构搭建.pdf
本文使用haproxy和keepalived搭建mysql集群:负载均衡、高可用、负载均衡+高可用,并验证测试成功
基于Keepalived+Haproxy搭建四层负载均衡器
基于mysql的负载均衡有很多种方式,如haproxy,前面一篇博客有介绍,还可以用更高效lvs做负载均衡,下面是基于percona xtradb cluster的三个节点的多主复制+atlas的lvs负载均衡,其实这里是不需要用atlas的,因为...
emqtt+haproxy高可用高负载可容错,完整配置调优文件。
Rabbitmq+HAproxy+Keepalived实现高可用加负载均衡-附件资源
在当今信息技术迅速...此外,文档还提供了使用HAProxy实现负载均衡的方法,旨在提升整体架构的高可用性和性能。通过这些详尽的指导,IT专业人员可以有效搭建和管理RabbitMQ集群,确保企业消息系统的稳定和高效运行。
我用nginx实现网站负载均衡测试的例子,windows下IIS做负载实测
1、简介2、基本环境3、配置MySQL主主复制4、中间件简述4.1、Haproxy介绍4.2、keepalived介绍5、中间件的安装与配置(haproxy、keepalived)5.1、安装haproxy1)、编译安装haproxy2)、提供启动脚本3)、提供配置文件...
rabbitmq 镜像集群 + Haproxy 负载均衡 + keepalived 高可用 环境搭建
Oracle数据库有其公司开发的配套rac来实现负载均衡,目前已知的最大节点数能到128个,但是其带来的维护成本无疑是很高的,并且rac的稳定性也并不是特别理想,尤其是节点很多的时候。 但是,相对mysql来说,rac的...