The company recently had a project because users are concerned that a single machine can not afford to use the maximum number of users, the application cluster requirements. We designed the application cluster architecture according to the application situation.
The architecture diagram is as follows:
Features for deploying application clusters:
1. Front-end Agent load balancing
Because the user environment infrastructure uses the virtualization cluster platform, the server uses the virtual machine realization, therefore the design uses the single platform Haproxy to realize.
Front selection Haproxy: One of the largest features of the HTTP 7th-layer key Kang state check, and we need to be consistent, because of the constant application of pressure, application can not respond to the situation, just through this feature for health checks to ensure that users transparent access. Prior to the use of Haporxy main standby mode to do a dual-machine main standby application cluster. Main Standby mode is also a major feature of Haproxy.
This scheme uses the load Balancing mode to use the source mode.
2. Application Server Session Replication
Configure JBoss to apply session replication to ensure that user logon sessions are shared by three servers.
3. Shared storage space
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Servers/web/
Shared storage space is an essential feature of cluster applications, which is implemented using NFS. Used to implement code consistent with data such as attachments.
4. Haproxy configuration Essentials file records are as follows:
(1) Cancel the logging in the/var/log/messages directory
The default will also record the Haproxy log in the/var/log/message, to be removed.
# vi/etc/syslog.conf
local3.* /var/log/haproxy.log
local0.* /var/log/haproxy.log *.info
; Mail.none;authpriv.none;cron.none;local3.none /var/log/messages
(2) Haproxy log Cutting
Haproyx Log Cutting script, there is no ready-made, wrote a log cutting script to achieve daily log cutting, add to the scheduled task, must su root-c force root permission to execute. If you want to keep the access log, you can modify the script implementation.
#!/bin/bash #
Author:koumm #
desc:
# date:2013-01-31
# version:v1.0 #
Modify:
# Cut Haproxy Log
Mv/var/log/haproxy.log/var/log/haproxy.log.bak
if [-e/var/log/haproxy.log.bak]; then
Logrotate-f/etc/logrotate.conf
chown nobody:nobody/var/log/haproxy.log
chmod +x/var/log/haproxy.log
fi sleep
1
if [-e/var/log/haproxy.log]; then
rm-rf/var/log/haproxy.log.bak
fi
(3) Haproxy configuration file record
Global log 127.0.0.1 local0 maxconn 65535 chroot/usr/local/haproxy uid/GID stats socket/usr/local/haproxy/ha Proxsocket level admin Daemon nbproc 1 pidfile/usr/local/haproxy/haproxy.pid #debug defaults log 127.0.0.1 local3 m Ode HTTP option httplog option httplog CLF option httpclose #option dontlognull option forwardfor option Redispatch RETR IES 2 maxconn balance source #balance roundrobin stats uri/haproxy-stats stats Refresh 10s contimeout 5 Clitimeout 50000 srvtimeout 50000 Listen app_cluster 0.0.0.0:80 mode http option httpchk get/test.html HTT p/1.0\r\nhost:192.168.0.110 Server 192.168.0.111_node1 192.168.0.111:80 weight 3 check Inter/Rise 2 Fall 1 server 19 2.168.0.112_node2 192.168.0.112:80 Weight 3 check Inter rise 2 Fall 1 server 192.168.0.113_node3 192.168.0.113:80 W Eight 3 check Inter rise 2 Fall 1 Listen stats_auth 0.0.0.0:91 mode HTTP stats enable stats uri/admin stats Realm "LOGIN" Stats Auth ADMin:123456 #stats hide-version Stats Refresh 10s Stats admin if TRUE
This article is from "Koumm Linux Technology blog" blog, please be sure to keep this source http://koumm.blog.51cto.com/703525/1282152