OpenStack (haproxy)
openstack部署脚本
链接:<https://pan.baidu.com/s/1BTp_tGNC6ZWwVmKkhwivgw >
提取码:jxuz
haproxy 官网:< https://www.haproxy.org/ >
haproxy推荐阅读:http://www.ttlsa.com/linux/haproxy-study-tutorial/
openstack部署haproxy
在所有节点安装Haproxy
第一步:安装haproxy
yum -y install haproxy
systemctl enable haproxy.service
第二步:所有节点配置haproxy
cat <<EOF>/etc/rsyslog.d/haproxy.conf
$ModLoad imudp
$UDPServerRun 514
$template Haproxy,"%msg%n"
local0.=info -/var/log/haproxy.log;Haproxy
local0.notice -/var/log/haproxy-status.log;Haproxy
local0.* ~
EOF
systemctl restart rsyslog.service
systemctl status rsyslog.service
cat <<EOF>/etc/haproxy/haproxy.cfg
global
log 127.0.0.1 local3
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
stats socket /var/lib/haproxy/stats
maxconn 40000
user haproxy
group haproxy
daemon
spread-checks 3
tune.bufsize 32768
tune.maxrewrite 1024
tune.ssl.default-dh-param 2048
defaults
mode http
log global
option httplog
option tcplog
option redispatch
option http-server-close
option splice-auto
option dontlognull
retries 3
timeout http-request 20s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout check 10s
maxconn 8000
listen stats
bind 0.0.0.0:8789
mode http
stats enable
stats uri /
stats realm Haproxy\ Statistics
stats auth admin:admin
stats refresh 15s
stats show-node
stats show-legends
stats hide-version
listen dashboard_cluster
bind 192.168.210.120:8080
balance source
option tcpka
option httpchk
option tcplog
server node1 192.168.210.131:80 check inter 2000 rise 2 fall 5
server node2 192.168.210.130:80 check inter 2000 rise 2 fall 5
server node3 192.168.210.132:80 check inter 2000 rise 2 fall 5
listen galera_cluster
bind 192.168.210.120:3307
balance source
hash-type consistent
mode tcp
option tcplog
option clitcpka
option srvtcpka
option httpchk
timeout client 28801s
timeout server 28801s
server node1 192.168.210.131:3306 check port 9200 inter 20s fastinter 2s downinter 2s rise 3 fall 3
server node2 192.168.210.130:3306 check port 9200 inter 20s fastinter 2s downinter 2s rise 3 fall 3 backup
server node3 192.168.210.132:3306 check port 9200 inter 20s fastinter 2s downinter 2s rise 3 fall 3 backup
listen mq_cluster
bind 192.168.210.120:5672 tcp-ut 5s
mode tcp
option tcpka
balance roundrobin
server node1 192.168.210.131:5672 check inter 10s fastinter 2s downinter 2s rise 3 fall 3
server node2 192.168.210.130:5672 check inter 10s fastinter 2s downinter 2s rise 3 fall 3
server node3 192.168.210.132:5672 check inter 10s fastinter 2s downinter 2s rise 3 fall 3
listen keystone_admin_cluster
bind 192.168.210.120:35358
http-request set-header X-Forwarded-Proto https if { ssl_fc }
option httplog
option httpclose
option forwardfor
server node1 192.168.210.131:35357 check inter 10s fastinter 2s downinter 2s rise 3 fall 3
server node2 192.168.210.130:35357 check inter 10s fastinter 2s downinter 2s rise 3 fall 3
server node3 192.168.210.132:35357 check inter 10s fastinter 2s downinter 2s rise 3 fall 3
listen keystone_public_internal_cluster
bind 192.168.210.120:5001
http-request set-header X-Forwarded-Proto https if { ssl_fc }
option httplog
option httpclose
option forwardfor
server node1 192.168.210.131:5000 check inter 10s fastinter 2s downinter 2s rise 3 fall 3
server node2 192.168.210.130:5000 check inter 10s fastinter 2s downinter 2s rise 3 fall 3
server node3 192.168.210.132:5000 check inter 10s fastinter 2s downinter 2s rise 3 fall 3
listen glance_registry_cluster
bind 192.168.210.120:9192
timeout server 30m
server node1 192.168.210.131:9191 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node2 192.168.210.130:9191 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node3 192.168.210.132:9191 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
listen glance_api_cluster
bind 192.168.210.120:9293
http-request set-header X-Forwarded-Proto https if { ssl_fc }
option httpchk /versions
option httplog
option httpclose
timeout server 30m
server node1 192.168.210.131:9292 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node2 192.168.210.130:9292 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node3 192.168.210.132:9292 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
listen nova_ec2_api_cluster
bind 192.168.210.120:9774
http-request set-header X-Forwarded-Proto https if { ssl_fc }
option httpchk
option httplog
option httpclose
timeout server 600s
server node1 192.168.210.131:8774 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node2 192.168.210.130:8774 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node3 192.168.210.132:8774 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
listen nova_compute_api_cluster
bind 192.168.210.120:9773
http-request set-header X-Forwarded-Proto https if { ssl_fc }
option httpchk
option httplog
option httpclose
server node1 192.168.210.131:8773 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node2 192.168.210.131:8773 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node3 192.168.210.131:8773 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
listen nova_metadata_api_cluster
bind 192.168.210.120:9775
option httpchk
option httplog
option httpclose
server node1 192.168.210.131:8775 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node2 192.168.210.130:8775 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node3 192.168.210.132:8775 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
listen nova_vncproxy_cluster
bind 192.168.210.120:6081
http-request set-header X-Forwarded-Proto https if { ssl_fc }
server node1 192.168.210.131:6080 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node2 192.168.210.130:6080 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node3 192.168.210.132:6080 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
listen nova_placement_cluster
bind 192.168.210.120:9778
http-request set-header X-Forwarded-Proto https if { ssl_fc }
server node1 192.168.210.131:8778 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node2 192.168.210.130:8778 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node3 192.168.210.132:8778 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
listen neutron_api_cluster
bind 192.168.210.120:9697
http-request set-header X-Forwarded-Proto https if { ssl_fc }
option httpchk
option httplog
option httpclose
server node1 192.168.210.131:9696 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node2 192.168.210.130:9696 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node3 192.168.210.132:9696 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
listen cinder_api_cluster
bind 192.168.210.120:9776
http-request set-header X-Forwarded-Proto https if { ssl_fc }
option httpchk
option httplog
option httpclose
server node1 192.168.210.131:8776 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node2 192.168.210.130:8776 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node3 192.168.210.132:8776 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
listen ceilometer_api_cluster
bind 192.168.210.120:9777
http-request set-header X-Forwarded-Proto https if { ssl_fc }
option httplog
option httpclose
server node1 192.168.210.131:8777 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node2 192.168.210.130:8777 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
server node3 192.168.210.132:8777 check inter 10s fastinter 2s downinter 3s rise 3 fall 3
EOF