[root@localhost x86_64]# service haproxy restart
Restarting haproxy (via systemctl): [ OK ]
[root@localhost x86_64]#
[root@localhost x86_64]#
[root@localhost x86_64]#
[root@localhost x86_64]# service haproxy status
● haproxy.service - SYSV: HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications
Loaded: loaded (/etc/rc.d/init.d/haproxy)
Active: active (running) since Sun 2016-06-05 10:38:20 EDT; 2s ago
Docs: man:systemd-sysv-generator(
Process: 3550 ExecStop=/etc/rc.d/init.d/haproxy stop (code=exited, status=0/SUCCESS)
Process: 3544 ExecReload=/etc/rc.d/init.d/haproxy reload (code=exited, status=0/SUCCESS)
Process: 3617 ExecStart=/etc/rc.d/init.d/haproxy start (code=exited, status=0/SUCCESS)
Main PID: 3622 (haproxy)
CGroup: /system.slice/haproxy.service
└─3622 /usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid
Jun 05 10:38:20 localhost.localdomain systemd[1]: Starting SYSV: HAProxy is a free, very fast and reliable solution offering high availability, load balanci...ations...
Jun 05 10:38:20 localhost.localdomain haproxy[3617]: Starting haproxy: [ OK ]
Jun 05 10:38:20 localhost.localdomain systemd[1]: Started SYSV: HAProxy is a free, very fast and reliable solution offering high availability, load balancin...ications.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost x86_64]#
[root@localhost x86_64]#
[root@localhost x86_64]# service haproxy reload
Reloading haproxy configuration (via systemctl): [ OK ]
[root@localhost x86_64]#
[root@localhost x86_64]#
[root@localhost x86_64]# service haproxy status
● haproxy.service - SYSV: HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications
Loaded: loaded (/etc/rc.d/init.d/haproxy)
Active: failed (Result: signal) since Sun 2016-06-05 10:38:24 EDT; 2s ago
Docs: man:systemd-sysv-generator(
Process: 3671 ExecStop=/etc/rc.d/init.d/haproxy stop (code=exited, status=0/SUCCESS)
Process: 3665 ExecReload=/etc/rc.d/init.d/haproxy reload (code=exited, status=0/SUCCESS)
Process: 3617 ExecStart=/etc/rc.d/init.d/haproxy start (code=exited, status=0/SUCCESS)
Main PID: 3670 (code=killed, signal=KILL)
Jun 05 10:38:20 localhost.localdomain systemd[1]: Starting SYSV: HAProxy is a free, very fast and reliable solution offering high availability, load balanci...ations...
Jun 05 10:38:20 localhost.localdomain haproxy[3617]: Starting haproxy: [ OK ]
Jun 05 10:38:20 localhost.localdomain systemd[1]: Started SYSV: HAProxy is a free, very fast and reliable solution offering high availability, load balancin...ications.
Jun 05 10:38:24 localhost.localdomain haproxy[3665]: Reloading haproxy:
Jun 05 10:38:24 localhost.localdomain systemd[1]: Reloaded SYSV: HAProxy is a free, very fast and reliable solution offering high availability, load balanci...ications.
Jun 05 10:38:24 localhost.localdomain systemd[1]: haproxy.service: main process exited, code=killed, status=9/KILL
Jun 05 10:38:24 localhost.localdomain haproxy[3671]: Stopping haproxy: [FAILED]
Jun 05 10:38:24 localhost.localdomain systemd[1]: Unit haproxy.service entered failed state.
Jun 05 10:38:24 localhost.localdomain systemd[1]: haproxy.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost x86_64]# 作者: yyu0378 時(shí)間: 2016-06-06 09:20
centos7已經(jīng)在使用systemd的服務(wù)管理,請(qǐng)使用新款管理工具sysctrl作者: Cleo_Z 時(shí)間: 2016-06-08 10:09 回復(fù) 2# yyu0378
[root@unknown ~]# service haproxy status
● haproxy.service - LSB: HAProxy
Loaded: loaded (/etc/rc.d/init.d/haproxy)
Active: active (running) since Tue 2016-06-07 11:33:22 UTC; 1h 14min ago
Docs: man:systemd-sysv-generator(
Process: 16636 ExecStart=/etc/rc.d/init.d/haproxy start (code=exited, status=0/SUCCESS)
Main PID: 16641 (haproxy)
CGroup: /system.slice/haproxy.service
mq16641 /usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid
Jun 07 11:33:22 unknown systemd[1]: Starting LSB: HAProxy...
Jun 07 11:33:22 unknown haproxy[16636]: Starting haproxy: [ OK ]
Jun 07 11:33:22 unknown systemd[1]: Started LSB: HAProxy.
[root@unknown ~]#
[root@unknown ~]# service haproxy reload
Reloading haproxy configuration (via systemctl): [ OK ]
[root@unknown ~]# echo $?
0 -> 顯示reload是成功的
[root@unknown ~]#
[root@unknown ~]# service haproxy status
● haproxy.service - LSB: HAProxy
Loaded: loaded (/etc/rc.d/init.d/haproxy)
Active: failed (Result: signal) since Tue 2016-06-07 12:48:01 UTC; 1s ago
Docs: man:systemd-sysv-generator(
Process: 16869 ExecStop=/etc/rc.d/init.d/haproxy stop (code=exited, status=0/SUCCESS)
Process: 16863 ExecReload=/etc/rc.d/init.d/haproxy reload (code=exited, status=0/SUCCESS)
Process: 16636 ExecStart=/etc/rc.d/init.d/haproxy start (code=exited, status=0/SUCCESS)
Main PID: 16868 (code=killed, signal=KILL)
Jun 07 11:33:22 unknown systemd[1]: Starting LSB: HAProxy...
Jun 07 11:33:22 unknown haproxy[16636]: Starting haproxy: [ OK ]
Jun 07 11:33:22 unknown systemd[1]: Started LSB: HAProxy.
Jun 07 12:48:00 unknown systemd[1]: Reloaded LSB: HAProxy.
Jun 07 12:48:00 unknown systemd[1]: haproxy.service: main process exited, code=killed, status=9/KILL -> 但是之后被kill掉了,關(guān)鍵是什么kill掉的呢,cgroup么?
Jun 07 12:48:01 unknown haproxy[16869]: [FAILED]
Jun 07 12:48:01 unknown systemd[1]: Unit haproxy.service entered failed state.
Jun 07 12:48:01 unknown systemd[1]: haproxy.service failed.
[root@unknown ~]#
查看日志。具體過程如下:
Jun 07 13:02:59 elb systemd[1]: Starting LSB: HAProxy...
Jun 07 13:02:59 elb systemd[7010]: Executing: /etc/rc.d/init.d/haproxy start
Jun 07 13:02:59 elb haproxy[7010]: Starting haproxy: [ OK ]
Jun 07 13:02:59 elb systemd[1]: Child 7010 belongs to haproxy.service
Jun 07 13:02:59 elb systemd[1]: haproxy.service: control process exited, code=exited status=0
Jun 07 13:02:59 elb systemd[1]: haproxy.service got final SIGCHLD for state start
Jun 07 13:02:59 elb systemd[1]: Main PID loaded: 7015
Jun 07 13:02:59 elb systemd[1]: haproxy.service changed start -> running
Jun 07 13:02:59 elb systemd[1]: Job haproxy.service/start finished, result=done
Jun 07 13:02:59 elb systemd[1]: Started LSB: HAProxy. -> start 成功
Jun 07 13:03:27 elb systemd[1]: Trying to enqueue job haproxy.service/reload/replace
Jun 07 13:03:27 elb systemd[1]: Installed new job haproxy.service/reload as 9504
Jun 07 13:03:27 elb systemd[1]: Enqueued job haproxy.service/reload as 9504
Jun 07 13:03:27 elb systemd[1]: About to execute: /etc/rc.d/init.d/haproxy reload
Jun 07 13:03:27 elb systemd[1]: Forked /etc/rc.d/init.d/haproxy as 7060
Jun 07 13:03:27 elb systemd[1]: haproxy.service changed running -> reload
Jun 07 13:03:27 elb systemd[7060]: Executing: /etc/rc.d/init.d/haproxy reload
Jun 07 13:03:27 elb systemd[1]: Child 7015 belongs to haproxy.service
Jun 07 13:03:27 elb systemd[1]: Main PID changing: 7015 -> 7065
Jun 07 13:03:27 elb systemd[1]: Child 7060 belongs to haproxy.service
Jun 07 13:03:27 elb systemd[1]: haproxy.service: control process exited, code=exited status=0
Jun 07 13:03:27 elb systemd[1]: haproxy.service got final SIGCHLD for state reload
Jun 07 13:03:27 elb systemd[1]: haproxy.service changed reload -> running
Jun 07 13:03:27 elb systemd[1]: Job haproxy.service/reload finished, result=done
Jun 07 13:03:27 elb systemd[1]: Reloaded LSB: HAProxy. -> reload成功
Jun 07 13:03:27 elb systemd[1]: Child 7065 belongs to haproxy.service
Jun 07 13:03:27 elb systemd[1]: haproxy.service: main process exited, code=killed, status=9/KILL -> 7065 進(jìn)程被kill掉。這里不知道是不是cgroup 發(fā)現(xiàn)了7065是7060的子進(jìn)程。就一起kill掉了。
Jun 07 13:03:27 elb systemd[1]: haproxy.service changed running -> failed
Jun 07 13:03:27 elb systemd[1]: Unit haproxy.service entered failed state.
Jun 07 13:03:27 elb systemd[1]: haproxy.service failed.
Jun 07 13:03:27 elb systemd[1]: haproxy.service: cgroup is empty