参考
https://devops.hc-yun.com/archives/18.html
https://www.cnblogs.com/dowi/p/10309418.html
https://www.haproxy.com/blog/haproxy-on-docker-swarm-load-balancing-and-dns-service-discovery
https://kubesphere.io/docs/v3.4/installing-on-linux/high-availability-configurations/set-up-ha-cluster-using-keepalived-haproxy
https://github.com/k911/haproxy-keepalived-docker
https://ratibor78.medium.com/ha-redis-clustering-from-scratch-ebc5e81d7a78
1. compose
# cat > haproxy.yml << EOF
version: '3.8'
services:
haproxy01:
image: bitnami/haproxy:2.9.4
container_name: haproxy01
hostname: haproxy01.local
ports:
- 29080:8080
- 29443:9999
volumes:
- $PWD/haproxy.cfg:/bitnami/haproxy/conf/haproxy.cfg
networks:
haproxy-net:
ipv4_address: 172.16.22.11
#sysctls:
# net.ipv4.ip_unprivileged_port_start: 0
networks:
haproxy-net:
name: haproxy-net
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.22.0/24
gateway: 172.16.22.1
# Reloading config (container_name)
# docker kill -s HUP haproxy01
EOF
2. config
# cat > haproxy.cfg << EOF
global
log stdout format raw local0 info
defaults
mode http
timeout client 10s
timeout connect 5s
timeout server 10s
timeout http-request 10s
log global
frontend stats
bind *:9999
stats enable
stats uri /
stats refresh 30s
frontend myfrontend
bind *:8080
default_backend web
backend web
server srv-1 10.132.127.8:8080 check
server srv-2 192.168.2.12:8080 check
server srv-3 192.168.2.13:8080 check
EOF
标签:
keepalived
, haproxy
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类
2018-02-02 签名&加密的区别
2015-02-02 linux单机限速工具