大并发高可用负载均衡系统部署方案Word格式文档下载.doc
《大并发高可用负载均衡系统部署方案Word格式文档下载.doc》由会员分享,可在线阅读,更多相关《大并发高可用负载均衡系统部署方案Word格式文档下载.doc(35页珍藏版)》请在冰豆网上搜索。
四、数据高可用方案部署 7
五、运行维护事项 8
上海俊泽-2015
一、方案说明
为满足公司业务平台的发展需要,应对业务平台的多用户大并发量的访问请求,需要一套高效可靠的系统部署方案。
目前各业务平台存在的问题有,业务系统(web\数据库)单机运行,单台应用服务器提供的访问能力有限,存在单点故障,虽然现在能做到故障急时报警,但出现故障后恢复时间较见;
另外业务数据存在安全隐患,数据定时备份,数据库或数据库服务器故障后存在数据留失风险,仅故障恢复时间较常等。
本套部署方案旨在加固业务系统的可靠性、可扩展性,提高业务系统的并发访问,提高业务数据安全性。
二、系统架构描述
1、系统整体结构图
2、WEB端高可用负载均衡
2.1Nginx负载均衡简介
nginx是一款高性能的HTTP和反向代理服务器软件,截止到2014年底,Nginx仅次于apache成为第二大web服务器软件,而在全球最忙碌top10000网站中使用比例更是高达42.7%。
其发展速度和流行程度已经远远超过其它同类软件,成为大型网站和高并发网站的首选。
Nginx的优势
l轻量级安装文件小运行时CPU内存使用率低
l性能强,支持多核心,处理静态文件效率高,内核采用的poll模型最大可以支持50K并发连接
l支持热部署,同时启动速度快,可以不间断服务的情况下对软件和配置进行升级
l支持负载均衡,支持容错和健康检查
l代理功能强大,支持无缓存的反向代理。
主流的负载均衡方案优缺点参考:
2.2高可用方案简介
单台调度服务器如果出现故障就会造成业务不可访问,在关键的业务环境里通常都会提供一台备用调度服务器,用来降低单点故障给业务系统带来的风险。
这里推荐使用开源软件Keepalive来提供nginx
调度服务器的高可用,当主nginx宕机后,keepalive会将调度业务切换至备用调度主机,继续提供用户访问。
Keepalived的作用是检测web服务器的状态,如果有一台web服务器死机,或工作出现故障,Keepalived将检测到,并将有故障的web服务器从系统中剔除,当web服务器工作正常后Keepalived自动将web服务器加入到服务器群中,这些工作全部自动完成,不需要人工干涉,需要人工做的只是修复故障的web服务器。
官方网址:
www.keepalived.org/download.html
3、数据库高可用方案介绍
三、WEB端负载均衡及高可用系统部署
3.1前端调度服务器Nginx部署
3.1.1安装说明
nginx安装有源码安装和系统匹配的安装包安装,这里为了方便采用redhat下的RPM包安装。
3.1.2Nginx安装
1)nginx下载地址
http:
//nginx.org/en/linux_packages.html
2)下载相关的安装包
wgethttp:
//nginx.org/packages/rhel/6/noarch/RPMS/nginx-release-rhel-6-0.el6.ngx.noarch.rpm
3)安装nginx官方提供的yum源,用yum安装
rpm-ivhnginx-release-rhel-6-0.el6.ngx.noarch.rpm
yuminstallnginx
4)查看安装文件
[root@RH01~]#rpm-qlnginx-1.8.0-1.el6.ngx.x86_64
/etc/logrotate.d/nginx
/etc/nginx
/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf
/etc/nginx/conf.d/example_ssl.conf
/etc/nginx/fastcgi_params
/etc/nginx/koi-utf
/etc/nginx/koi-win
/etc/nginx/mime.types
/etc/nginx/nginx.conf
/etc/nginx/scgi_params
/etc/nginx/uwsgi_params
/etc/nginx/win-utf
/etc/rc.d/init.d/nginx
/etc/sysconfig/nginx
/usr/sbin/nginx
/usr/share/nginx
/usr/share/nginx/html
/usr/share/nginx/html/50x.html
/usr/share/nginx/html/index.html
/var/cache/nginx
/var/log/nginx
3.1.3启动配置
1)启动服务
#servicenginxstart
2)查看进程
[root@RH01~]#ps-ef|grepnginx
root306221010:
56?
00:
00:
00nginx:
masterprocess/usr/sbin/nginx-c/etc/nginx/nginx.conf
nginx3062330622010:
00:
workerprocess
以上信息显示一个主进程和一个工作进程
[root@RH01~]#lsof-i:
80
COMMANDPIDUSERFDTYPEDEVICESIZE/OFFNODENAME
nginx30622root6uIPv4709550t0TCP*:
http(LISTEN)
nginx30623nginx6uIPv4709550t0TCP*:
3)删除或重命名默认配置文件
#mv/etc/nginx/conf.d/default.conf/etc/nginx/conf.d/default.conf.bak
4)修改配置文件
[root@RH01~]#vim/etc/nginx/nginx.conf
default_typeapplication/octet-stream;
log_formatmain'
$remote_addr-$remote_user[$time_local]"
$request"
'
'
$status$body_bytes_sent"
$http_referer"
"
$http_user_agent"
"
$http_x_forwarded_for"
'
;
access_log/var/log/nginx/access.logmain;
sendfileon;
#tcp_nopushon;
keepalive_timeout65;
#gzipon;
include/etc/nginx/conf.d/*.conf;
upstreamtomcat{
ip_hash;
server192.168.18.6:
80weight=10;
server192.168.18.7:
8080weight=10;
}
server{
listen80;
server_namelocahost;
location/{
proxy_passhttp:
//tomcat;
}
}
}
3.1.4测试、维护
3.2高可用keepalive部署
3.2.1keepalive安装
1)安装前请配置yum源
2)yuminstall-ykeepalived
3)查看安装文件路径
#rpm-qlkeepalived
/etc/keepalived
/etc/keepalived/keepalived.conf
/etc/rc.d/init.d/keepalived
/etc/sysconfig/keepalived
/usr/bin/genhash
/usr/libexec/keepalived
/usr/sbin/keepalived
/usr/share/doc/keepalived-1.2.13
/usr/share/doc/keepalived-1.2.13/AUTHOR
/usr/share/doc/keepalived-1.2.13/CONTRIBUTORS
/usr/share/doc/keepalived-1.2.13/COPYING
/usr/share/doc/keepalived-1.2.13/ChangeLog
/usr/share/doc/keepalived-1.2.13/NOTE_vrrp_vmac.txt
/usr/share/doc/keepalived-1.2.13/README
/usr/share/doc/keepalived-1.2.13/TODO
/usr/share/doc/keepalived-1.2.13/VERSION
/usr/share/doc/keepalived-1.2.13/keepalived.conf.SYNOPSIS
/usr/share/doc/keepalived-1.2.13/samples
/usr/share/doc/keepalived-1.2.13/samples/keepalived.conf.HTTP_GET.port
/usr/share/doc/keepalived-1.2.13/samples/keepalived.conf.IPv6
/usr/share/doc/keepalived-1.2.13/samples/keepalived.conf.SMTP_CHECK
/usr/share/doc/keepalived-1.2.13/samples/keepalived.conf.SSL_GET
/usr/share/doc/keepalived-1.2.13/samples/keepalived.conf.fwmark
/usr/share/doc/keepalived-1.2.13/samples/keepalived.conf.inhibit
/usr/share/doc/keepaliv