haproxy启动两个进程,正常与否?

时间:2014-08-26 07:07:12

标签: python haproxy suse

后台:我写了一个python脚本来读取数据库,更新haproxy.cfg并每分钟重新加载haproxy。为了避免遗漏请求,我提到HAProxy: Reloading Your Config With Minimal Service Impact和linux命令“man haproxy”。现在,我达到了目标,并且还没有出现任何错误。使我困惑的是两个haproxy进程,有时三个同时工作。换句话说,选项'-sf'始终不起作用。这是正常与否,为什么?
python脚本的一部分是:

if 0 != os.system('/usr/local/sbin/haproxy -f /usr/local/sbin/haproxy.cfg -p /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)'):
        print '[ERROR] restart haproxy fails'


'haproxy.cfg'文件是这样的:

global
        log 127.0.0.1   local3 info
        maxconn 5000
        daemon
        nbproc 1

defaults
        log             global
        mode            tcp
        option          dontlognull
        retries         3
        maxconn         2000
        timeout connect    5000
        timeout client     50000
        timeout server     50000

listen  xtbroker_1_20001_7080 0.0.0.0:58002
        mode    tcp
        balance roundrobin
        server xtbroker_1_20001_7080_0 127.0.0.1:58101 check inter 5000 rise 1 fall 2
        server xtbroker_1_20001_7080_1 127.0.0.1:58102 check inter 5000 rise 1 fall 2

listen  xtbroker_1_21001_8090 0.0.0.0:58004
        mode    tcp
        balance roundrobin
        server xtbroker_1_21001_8090_0 127.0.0.1:58103 check inter 5000 rise 1 fall 2

listen  xtbroker_1_21001_8888 0.0.0.0:58006
        mode    tcp
        balance roundrobin
        server xtbroker_1_21001_8888_0 127.0.0.1:58104 check inter 5000 rise 1 fall 2

listen  xtbroker_1_21001_1001 0.0.0.0:58008
        mode    tcp
        balance roundrobin
        server xtbroker_1_21001_1001_0 127.0.0.1:58105 check inter 5000 rise 1 fall 2
        server xtbroker_1_21001_1001_1 127.0.0.1:58106 check inter 5000 rise 1 fall 2
        server xtbroker_1_21001_1001_2 127.0.0.1:58107 check inter 5000 rise 1 fall 2
        server xtbroker_1_21001_1001_3 127.0.0.1:58108 check inter 5000 rise 1 fall 2
        server xtbroker_1_21001_1001_4 127.0.0.1:58109 check inter 5000 rise 1 fall 2


listen  xtbroker_1_21001_3010 0.0.0.0:58012
        mode    tcp
        balance roundrobin
        server xtbroker_1_21001_3010_0 127.0.0.1:58112 check inter 5000 rise 1 fall 2


listen  xtbroker_1_21001_8060 0.0.0.0:58018
        mode    tcp
        balance roundrobin
        server xtbroker_1_21001_8060_0 127.0.0.1:58117 check inter 5000 rise 1 fall 2
        server xtbroker_1_21001_8060_1 127.0.0.1:58118 check inter 5000 rise 1 fall 2


root@linux-kas9:/home/rzrk/server/pyScripts # ps aux | grep haproxy
root     12258  0.0  0.0   6016  1552 ?        Ss   14:19   0:00 /usr/local/sbin/haproxy -f /usr/local/sbin/haproxy.cfg -p /var/run/haproxy.pid -sf 19512
root     17500  0.0  0.0   5936  1152 ?        Ss   14:56   0:00 /usr/local/sbin/haproxy -f /usr/local/sbin/haproxy.cfg -p /var/run/haproxy.pid -sf 11722
root     21187  0.0  0.0   5920   800 pts/4    S+   14:56   0:00 grep haproxy
root     47545  0.0  0.0   5900  1524 ?        Ss   14:38   0:00 /usr/local/sbin/haproxy -f /usr/local/sbin/haproxy.cfg -p /var/run/haproxy.pid -sf 42333
You have new mail in /var/mail/root

0 个答案:

没有答案