Nginx+Keepalived+haproxy集群安装_HTTP

1.Nginx不再赘述

2.Keepalived

配置

! Configuration File for keepalived

global_defs {
   notification_email {
     acassen@firewall.loc
     failover@firewall.loc
     sysadmin@firewall.loc
   }
   notification_email_from Alexandre.Cassen@firewall.loc
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   router_id LVS_DEVEL
   vrrp_skip_check_adv_addr
   vrrp_strict
   vrrp_garp_interval 0
   vrrp_gna_interval 0
}

vrrp_instance VI_1 {
    state MASTER
    interface ens3
    virtual_router_id 51
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        
        
        198.10.51.2
    }
}

三个文件:

3.HA

配置

global
    log 127.0.0.1   local0 info
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     1020   # See also: ulimit -n
    user        haproxy
    group       haproxy
    daemon
    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats.sock mode 600 level admin
    stats timeout 2m
defaults
    mode    tcp
    log     global
    option  dontlognull
    option  redispatch
    timeout http-request      10s
    retries                   3
    timeout queue             45s
    timeout connect           10s
    timeout client            1m
    timeout server            1m
    timeout http-keep-alive   10s
    timeout check             10s
    maxconn                   1020
listen status
    mode http
    bind *:8070
    stats enable
    stats uri     /admin?stats
    stats realm   Haproxy\ Statistics
    stats auth    admin:admin
    stats admin if TRUE

frontend  nginx-8089web   
    bind    *:8090  
    default_backend     nginx-8089web  
  
  
backend nginx-8089web  
    option  httpchk HEAD /check.txt HTTP/1.0  
    balance roundrobin  
    server  web01 198.10.51.110:18090 weight 3 check inter 5s rise 2 fall 3  
    server  web02 198.10.51.111:18090 weight 3 check inter 5s rise 2 fall 3



参考资料:

1.https://blog.csdn.net/qq18346342939/article/details/127093139

2.https://www.jianshu.com/p/584f964d54d0

3.https://blog.51cto.com/u_710020/5680204

4.https://www.56dr.com/info/4123.html

5.https://blog.csdn.net/cnskylee/article/details/131591733

问题:

https://coding.imooc.com/learn/questiondetail/79833.html