Op 16/12/2017 om 10:31 schreef Johan Hendriks:
>
> Op do 14 dec. 2017 om 22:12 schreef PiBa-NL <[email protected]
> <mailto:[email protected]>>
>
> Hi Johan,
>
> Op 14-12-2017 om 9:35 schreef Johan Hendriks:
> > Op 13/12/2017 om 20:48 schreef PiBa-NL:
> >> Hi Johan,
> >>
> >> Op 13-12-2017 om 17:31 schreef Johan Hendriks:
> >>> When i use the show stat command I get different results?
> >> Just a guess, are you using?: nbproc > 1
> > Yes indeed i use nbproc > 1, There are no old processes running
> on the
> > machine.
> > This is my global config
> >
> > global
> > nbproc 8
> >
> > # stats bind-process 1
> Oke so 'uncommenting' this 'fixed' the issue that you set a server to
> maintenance state in the first haproxy process, and you are
> viewing the
> 'show stat' of that first process..
> > stats socket /var/run/haproxy/info.sock mode 600 level
> admin
> > log 127.0.0.1:514 <http://127.0.0.1:514> local1 notice
> >
> > defaults
> > log global
> > mode http
> >
> > listen stats
> > bind :8077
> perhaps you would like to bind this port also to the first
> process.? so
> webgui will show the state also of the first PID.?
> > mode http
> > stats enable
> > stats scope web-backend
> > stats uri /
> > stats realm Haproxy\ Statistics
> >
> >
> > I just saw that I commented out stats bind-process 1
> > I did uncomment it and it seems to be working now for the echo "show
> > stat" | socat /var/run/haproxy/info.sock stdio part, it is not
> switching
> > to UP sometimes, but the web GUI is showing the server is UP. It did
> > show it in maintenance mode first but after a while it shows UP
> instead
> > of maintenance.
> >
> >
> > Thank you very much for your time.
> > regards
> > Johan
> >
> However.!
>
> If youve understood how nbproc works, it just means haproxy gets
> started
> several times simultaneously and each keeps its own state. That means
> you need to configure 8 separate stats sockets, and 8 stats websites,
> and when setting a server to maintenance you need to make sure all 8
> process are set to this new state.
>
> In your current config visit the stats page and press ctrl+F5 several
> times in the browser(firefox?), youl see the pid on the stats page
> change, and also if your 'lucky' you might see the server sometimes is
> in maintenance mode when you by chance are requesting the stats
> page of
> the same process / PID you changed that state on..
>
> Anyhow.. i don't have a example ready myself but have seen some
> pass on
> the mailinglist how to configure multiple sockets for this.. Hope
> above
> comments gets you going in the right idea :)
>
> Regards,
>
> PiBa-NL
>
> Thanks, I found out that each proces has its own metrics and can be
> controlled seperately using a unix socket.
> I have configured haproxy now in a way every proces has its own .sock
> file which i can control, and read metrics from.
> Reading the web I learned a lot about the proces. Also the option to
> chain a frontend to a proces is something i did not know, which makes
> separating metrics from different frontends simpler.
>
> Thank you for pushing me in the right direction.
> I will reply to this thread with my config. So other people can use
> that as an example. I am on a mobile device now, so no acces to the box.
>
> Regards
> Johan
>
I use the following config for test now, it all looks good. I do not use
cpu-map in my config because on my system it seems to degrade performance.
This is my config.
global
tune.maxrewrite 16384
tune.bufsize 49152
# tune.bufsize 32768
maxconn 20000
daemon
log 127.0.0.1:514 local1 notice
nbproc 8
stats socket /var/run/haproxy/info.1 mode 600 level admin process 1
stats socket /var/run/haproxy/info.2 mode 600 level admin process 2
stats socket /var/run/haproxy/info.3 mode 600 level admin process 3
stats socket /var/run/haproxy/info.4 mode 600 level admin process 4
stats socket /var/run/haproxy/info.5 mode 600 level admin process 5
stats socket /var/run/haproxy/info.6 mode 600 level admin process 6
stats socket /var/run/haproxy/info.7 mode 600 level admin process 7
stats socket /var/run/haproxy/info.8 mode 600 level admin process 8
defaults
log global
mode http
maxconn 1000
cookie SRVNAME insert
option httplog
option dontlognull
timeout connect 5000
timeout client 100000
timeout server 100000
errorfile 400 /usr/local/etc/haproxy/errors/400.http
errorfile 403 /usr/local/etc/haproxy/errors/403.http
errorfile 408 /usr/local/etc/haproxy/errors/408.http
errorfile 500 /usr/local/etc/haproxy/errors/500.http
errorfile 502 /usr/local/etc/haproxy/errors/502.http
errorfile 503 /usr/local/etc/haproxy/errors/503.http
errorfile 504 /usr/local/etc/haproxy/errors/504.http
frontend www_app1_http
bind <public_ip>:80
bind-process 1 2
option httplog
mode http
option http-server-close
option forwardfor
acl badbots hdr_reg(User-Agent) -i -f /usr/local/etc/haproxy/badbots.lst
http-request deny if badbots
reqadd X-Forwarded-Proto:\ https if { ssl_fc }
http-request redirect prefix http://www.%[hdr(host)] code 301 unless
{ hdr_beg(host) -i www. }
acl app1_admin path_beg /index.php/beheer
acl app1_admin path_beg /beheer
acl mobile_user_agent hdr_sub(User-Agent) -i Android
use_backend backend_app1 if app1_admin
default_backend backend_app1
frontend www_app1_https
bind <public_ip>:443 ssl crt
/usr/local/etc/ssl/private/star_my-domain.com.pem no-sslv3
bind-process 3 4 5 6 7 8
option httplog
mode http
option http-server-close
option forwardfor
acl badbots hdr_reg(User-Agent) -i -f /usr/local/etc/haproxy/badbots.lst
http-request deny if badbots
reqadd X-Forwarded-Proto:\ https if { ssl_fc }
http-request redirect prefix http://www.%[hdr(host)] code 301 unless
{ hdr_beg(host) -i www. }
acl app1_admin path_beg /index.php/beheer
acl app1_admin path_beg /beheer
acl mobile_user_agent hdr_sub(User-Agent) -i Android
use_backend backend_app1 if app1_admin
default_backend backend_app1
backend backend_app1
mode http
balance roundrobin
option http-server-close
server app150 192.168.10.10:80 weight 50 check
server app151 192.168.10.20:80 weight 50 check
backend backend_app1_admin
mode http
balance roundrobin
option http-server-close
server app150 192.168.10.10:80 weight 10 check
listen stats_proc1
bind-process 1
bind :1901
mode http
stats enable
stats hide-version
stats scope www_app1_http
stats scope app1_admin
stats scope backend_app1
stats scope backend_app1_admin
stats uri /
stats realm Haproxy\ Statistics
stats auth user:password
listen stats_proc2
bind-process 2
bind :1902
mode http
stats enable
stats hide-version
stats scope www_app1_http
stats scope app1_admin
stats scope backend_app1
stats scope backend_app1_admin
stats uri /
stats realm Haproxy\ Statistics
stats auth user:password
listen stats_proc3
bind-process 3
bind :1903
mode http
stats enable
stats hide-version
stats scope www_app1_https
stats scope app1_admin
stats scope backend_app1
stats scope backend_app1_admin
stats uri /
stats realm Haproxy\ Statistics
stats auth user:password
listen stats_proc4
bind-process 4
bind :1904
mode http
stats enable
stats hide-version
stats scope www_app1_https
stats scope app1_admin
stats scope backend_app1
stats scope backend_app1_admin
stats uri /
stats realm Haproxy\ Statistics
stats auth user:password
listen stats_proc5
bind-process 5
bind :1905
mode http
stats enable
stats hide-version
stats scope www_app1_https
stats scope app1_admin
stats scope backend_app1
stats scope backend_app1_admin
stats uri /
stats realm Haproxy\ Statistics
stats auth user:password
listen stats_proc6
bind-process 6
bind :1906
mode http
stats enable
stats hide-version
stats scope www_app1_https
stats scope app1_admin
stats scope backend_app1
stats scope backend_app1_admin
stats uri /
stats realm Haproxy\ Statistics
stats auth user:password
listen stats_proc7
bind-process 7
bind :1907
mode http
stats enable
stats hide-version
stats scope www_app1_https
stats scope app1_admin
stats scope backend_app1
stats scope backend_app1_admin
stats uri /
stats realm Haproxy\ Statistics
stats auth user:password
listen stats_proc8
bind-process 8
bind :1908
mode http
stats enable
stats hide-version
stats scope www_app1_https_dedi
stats scope app1_admin
stats scope backend_app1
stats scope backend_app1_admin
stats uri /
stats realm Haproxy\ Statistics
stats auth user:password