first commit
This commit is contained in:
commit
ba848e218d
1001 changed files with 152333 additions and 0 deletions
24
linux基础/HaProxy服务摘除.md
Normal file
24
linux基础/HaProxy服务摘除.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
haproxy在多进程模式下无法直接对后端服务器直接进行软下线,当输入软下线的命令时haproxy依旧可以将用户的请求调度到后端已经下下的服务器上,这是应为haproxy的socket文件的关系,一个socket文件对应一个进程,当haproxy处于多进程的模式下时,就需要有多个socket文件,并将其和进程进行绑定,对后端服务器进行软下线时需要对所有的socket文件下达软下线的指令。
|
||||
|
||||
```
|
||||
global
|
||||
maxconn 100000
|
||||
chroot /usr/local/haproxy
|
||||
stats socket /var/lib/haproxy/haproxy.sock1 mode 600 level admin process 1 #分别使用不用的socket文件名,并使用process选项将其于进程进行绑定
|
||||
stats socket /var/lib/haproxy/haproxy.sock2 mode 600 level admin process 2
|
||||
uid 99
|
||||
gid 99
|
||||
daemon
|
||||
nbproc 2 #haproxy进程数为2,所以需要创建出2个socket文件
|
||||
cpu-map 1 0
|
||||
cpu-map 2 1
|
||||
pidfile /usr/local/haproxy/run/haproxy.pid
|
||||
log 127.0.0.1 local3 info
|
||||
```
|
||||
|
||||
下线
|
||||
```
|
||||
## 对后端的服务器进行下线时分别对每个socket文件发送软下线指令
|
||||
echo "disable server php_server/web1" | socat stdio /var/lib/haproxy/haproxy.sock1
|
||||
echo "disable server php_server/web1" | socat stdio /var/lib/haproxy/haproxy.sock2
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue