You've already forked www.colben.cn
update
This commit is contained in:
@@ -6,7 +6,7 @@ tags: ["haproxy", "高可用", "负载均衡"]
|
||||
categories: ["ha/lb"]
|
||||
---
|
||||
|
||||
# CentOS7 下安装
|
||||
## CentOS7 下安装
|
||||
- CentOS7 自带的 haproxy 版本太低,这里通过 cheese 源安装最新版本
|
||||
- 安装 cheese repo,详细参考[这里](http://www.nosuchhost.net/~cheese/fedora/packages/epel-7/x86_64/cheese-release.html)
|
||||
```bash
|
||||
@@ -34,7 +34,7 @@ categories: ["ha/lb"]
|
||||
setenforce 0
|
||||
```
|
||||
|
||||
# 全局配置
|
||||
## 全局配置
|
||||
```
|
||||
global
|
||||
log 127.0.0.1 local2 info
|
||||
@@ -48,7 +48,7 @@ global
|
||||
stats socket /var/lib/haproxy/stats
|
||||
```
|
||||
|
||||
# 默认配置
|
||||
## 默认配置
|
||||
```
|
||||
defaults
|
||||
log global
|
||||
@@ -58,7 +58,7 @@ defaults
|
||||
timeout check 8s
|
||||
```
|
||||
|
||||
# tcp 连接多个 ceph-radosgw
|
||||
## tcp 连接多个 ceph-radosgw
|
||||
```
|
||||
frontend ceph-radosgw
|
||||
bind *:7480
|
||||
@@ -77,7 +77,7 @@ backend ceph-radosgw
|
||||
server ceph243 10.9.10.236:7480 check
|
||||
```
|
||||
|
||||
# tcp 连接 mysql galera cluster
|
||||
## tcp 连接 mysql galera cluster
|
||||
```
|
||||
frontend mysql
|
||||
bind *:3306
|
||||
@@ -94,7 +94,7 @@ backend mysql
|
||||
server mysql233 10.9.10.233:3306 check inter 4s
|
||||
```
|
||||
|
||||
# tcp 连接 redis 主库
|
||||
## tcp 连接 redis 主库
|
||||
```
|
||||
frontend redis
|
||||
bind *:6379
|
||||
@@ -118,7 +118,7 @@ backend redis
|
||||
server redis89 10.1.14.89:6379 check inter 4s
|
||||
```
|
||||
|
||||
# 状态页面
|
||||
## 状态页面
|
||||
```
|
||||
listen admin_stats
|
||||
bind 0.0.0.0:10080
|
||||
@@ -134,12 +134,12 @@ listen admin_stats
|
||||
stats hide-version
|
||||
```
|
||||
|
||||
# 通过 rsyslog 生成日志
|
||||
## 通过 rsyslog 生成日志
|
||||
```bash
|
||||
sed -i -e '/ModLoad imudp/s/^#//' \
|
||||
-e '/UDPServerRun 514/s/^#//' /etc/rsyslog.conf
|
||||
cat > /etc/rsyslog.d/haproxy.conf <<EOF
|
||||
# haproxy log
|
||||
## haproxy log
|
||||
template(name="HaproxyTime" type="list"){
|
||||
property(name="timereported" dateformat="year")
|
||||
constant(value="-")
|
||||
@@ -169,7 +169,7 @@ systemctl restart rsyslog
|
||||
systemctl restart haproxy
|
||||
```
|
||||
|
||||
# 参考
|
||||
## 参考
|
||||
- [详解地址](http://blog.haohtml.com/archives/7959)
|
||||
- [官网](https://www.haproxy.com/documentation/hapee/1-5r2/traffic-management/health-checking/)
|
||||
|
||||
|
Reference in New Issue
Block a user