HAProxy community

Am I running HAProxy twice?

I was looking at running processes and was curious if this means I’m running HAProxy twice:

[root@haproxy ~]# ps -ef | grep  haproxy
root        1043       1  0 12:42 ?        00:00:00 /usr/local/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /run/haproxy-master.sock
haproxy     1183    1043  0 12:42 ?        00:00:00 /usr/local/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /run/haproxy-master.sock
root        1448    1426  0 12:43 pts/0    00:00:00 grep --color=auto haproxy

Also have this:

[root@haproxy ~]# systemctl status haproxy.service
 haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/etc/systemd/system/haproxy.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-10-08 12:42:21 CDT; 1min 9s ago
  Process: 1018 ExecStartPre=/usr/local/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS (code=exited, status=0/SUCCESS)
 Main PID: 1043 (haproxy)
    Tasks: 2 (limit: 4855)
   Memory: 24.5M
   CGroup: /system.slice/haproxy.service
           ├─1043 /usr/local/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /run/haproxy-master.sock
           └─1183 /usr/local/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /run/haproxy-master.sock

    Oct 08 12:42:21 haproxy.REMOVED.local haproxy[1043]: haproxy.REMOVED.local haproxy[1043]: Proxy ssl_relay started.
    Oct 08 12:42:21 haproxy.REMOVED.local haproxy[1043]: haproxy.REMOVED.local haproxy[1043]: Proxy ssl_relay started.
    Oct 08 12:42:21 haproxy.REMOVED.local haproxy[1043]: haproxy.REMOVED.local haproxy[1043]: Proxy ssl_remote started.
    Oct 08 12:42:21 haproxy.REMOVED.local haproxy[1043]: haproxy.REMOVED.local haproxy[1043]: Proxy ssl_remote started.
    Oct 08 12:42:21 haproxy.REMOVED.local haproxy[1043]: haproxy.REMOVED.local haproxy[1043]: Proxy ssl_jrsmarthome started.
    Oct 08 12:42:21 haproxy.REMOVED.local haproxy[1043]: haproxy.REMOVED.local haproxy[1043]: Proxy ssl_jrsmarthome started.
    Oct 08 12:42:21 haproxy.REMOVED.local haproxy[1043]: haproxy.REMOVED.local haproxy[1043]: Proxy stats started.
    Oct 08 12:42:21 haproxy.REMOVED.local haproxy[1043]: haproxy.REMOVED.local haproxy[1043]: Proxy stats started.
    Oct 08 12:42:21 haproxy.REMOVED.local haproxy[1043]: [NOTICE] 281/124221 (1043) : New worker #1 (1183) forked
    Oct 08 12:42:21 haproxy.REMOVED.local systemd[1]: Started HAProxy Load Balancer.

No, this is expected in master-worker mode.

First process runs as root with PID 1043 and is the master process, the second process is a worker and a fork of the first one (see PPID = 1043) and runs with reduced privileges (haproxy as opposed to root).