您的位置:首页 > 运维架构 > Tomcat

keepalived ,egnix ,tomcat 高可用,高并发 应用架构的搭建

2016-05-15 16:34 609 查看
keepalived ,egnix ,tomcat 高可用,高并发 应用架构的搭建

keepalived 中需要构建Virtual IP 地址 ,并创建一个nginx check 文件 检测 nginx Server 运行状态 ,如果ngnix 进程不可访问,则kill掉killall keepalived 进程,实现VIP 漂移

ngnix 托管tocmat 服务器地址,因此在tomcat web 服务器上不再需要LVS 功能 即 去掉 lo:A 设备的绑定

本架构共四台机器 :

服务器 A ,IP 192.168.168.101 安装 keepalived ,ngnix ,配置 keepalived(MASTER) ,ngnix(A,B ngnxi 配置要完全相同),不需要lvs

服务器 B ,IP 192.168.168.102 安装 keepalived ,ngnix ,配置 keepalived(BACKUP) ,ngnix(A,B ngnxi 配置要完全相同),不需要lvs

服务器 C,IP 192.168.168.103 安装tomcat ,不需要lvs

服务器 D,IP 192.168.168.104 安装tomcat,不需要lvs

示例 keepalived 配置:

! Configuration File for keepalived

global_defs {

notification_email {

root@localhost

}

notification_email_from Alexandre.Cassen@firewall.loc

smtp_server 192.168.184.178

smtp_connect_timeout 30

router_id LVS_DEVEL

}

vrrp_instance VI_1 {

state BACKUP

interface eth0

virtual_router_id 51

priority 10

advert_int 1

authentication {

auth_type PASS

auth_pass 1111

}

virtual_ipaddress {

192.168.184.222/24 dev eth0 label eth0:A

}

}

示例 ngnix 配置:

upstream yunxinghai {
server 192.168.184.188:8080 weight=1;
server 192.168.184.168:8080 weight=1;
# check interval=3000 rise=2 fall=5 timeout=1000 type=http;
# check_http_send "HEAD / HTTP/1.0\r\n\r\n";
# check_http_expect_alive http_2xx http_3xx;
}
server {
listen 80;
server_name www.yunxh1.com;
location / {
#root html;
#index index.html index.htm;
#-----------
#auth_basic "hi who are you ?";
#auth_basic_user_file /var/users;
#index index.html index.htm;
#------------------
#proxy_pass http://192.168.184.168:8080/;
proxy_pass http://yunxinghai/;
#index index.html index.htm;
}


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: