Loadbalancers: Difference between revisions

From Hobbynet Admin Wiki
Jump to navigation Jump to search
No edit summary
Line 76: Line 76:
=configuratie=
=configuratie=


= status van de servers bekijken =
= firewall lock down script =  
Dit doe je met het commando '''show servers''' vanaf de bng command prompt
= handleidingen=
<pre>
LB1# show servers
  no ipaddr        ipaddr6                    port prt net net6 sessions S targets backups
  -- -------------- --------------------------- ---- --- --- ---- -------- - ------- -------
  1 212.72.227.80  2a02:968:1:7:212:72:227:80    80 tcp  1    0        2 e 1,2
  2 172.31.1.100  -                          3306 tcp  2    0      509 e 3      4
  3 212.72.229.101 2a02:968:1:1:212:72:229:101  80 tcp  3    0      85 e 5,6
  4 212.72.229.101 2a02:968:1:1:212:72:229:101  443 tcp  3    0      24 e 7,8
  5 172.31.1.101  -                          3306 tcp  2    0        9 e 9      10
  6 212.72.227.82  2a02:968:1:7:212:72:227:82    80 tcp  1    0        2 e 11,12
  7 212.72.227.82  2a02:968:1:7:212:72:227:82  443 tcp  1    0        0 e 13,14
  8 212.72.227.80  2a02:968:1:7:212:72:227:80  443 tcp  1    0        0 e 15,16
  9 212.72.229.102 2a02:968:1:1:212:72:229:102  80 tcp  3    0      134 e 5,6
  10 212.72.229.102 2a02:968:1:1:212:72:229:102  443 tcp  3    0      39 e 7,8
  11 212.72.229.103 2a02:968:1:1:212:72:229:103  80 tcp  3    0        2 e 5,6
  12 212.72.229.103 2a02:968:1:1:212:72:229:103  443 tcp  3    0        0 e 7,8
</pre>
 
= server uitschakelen =
Stel we willen server 12 uitschakelen, dan doe je dat met volgende commando: '''disable server 12'''.<br>
Je zult zien, als je de status opvraagt, dat in de kolom S nu een '''D''' staat bij server 12
LB1# disable server 12
LB1# show server
  no ipaddr        ipaddr6                    port prt net net6 sessions S targets backups
  -- -------------- --------------------------- ---- --- --- ---- -------- - ------- -------
  1 212.72.227.80  2a02:968:1:7:212:72:227:80    80 tcp  1    0        2 e 1,2
  2 172.31.1.100  -                          3306 tcp  2    0      499 e 3      4
  3 212.72.229.101 2a02:968:1:1:212:72:229:101  80 tcp  3    0      100 e 5,6
  4 212.72.229.101 2a02:968:1:1:212:72:229:101  443 tcp  3    0      25 e 7,8
  5 172.31.1.101  -                          3306 tcp  2    0        9 e 9      10
  6 212.72.227.82  2a02:968:1:7:212:72:227:82    80 tcp  1    0        2 e 11,12
  7 212.72.227.82  2a02:968:1:7:212:72:227:82  443 tcp  1    0        0 e 13,14
  8 212.72.227.80  2a02:968:1:7:212:72:227:80  443 tcp  1    0        0 e 15,16
  9 212.72.229.102 2a02:968:1:1:212:72:229:102  80 tcp  3    0      133 e 5,6
  10 212.72.229.102 2a02:968:1:1:212:72:229:102  443 tcp  3    0      39 e 7,8
  11 212.72.229.103 2a02:968:1:1:212:72:229:103  80 tcp  3    0        3 e 5,6
  12 212.72.229.103 2a02:968:1:1:212:72:229:103  443 tcp  3    0        0 '''D''' 7,8
 
= server inschakelen =
Stel we willen server 12 inschakelen, dan doe je dat met volgende commando: '''enable server 12'''. <br>
Je zult zien, als je de status opvraagt, dat in de kolom S nu een '''e''' staat bij server 12
 
LB1# enable server 12
LB1# show server
  no ipaddr        ipaddr6                    port prt net net6 sessions S targets backups
  -- -------------- --------------------------- ---- --- --- ---- -------- - ------- -------
  1 212.72.227.80  2a02:968:1:7:212:72:227:80    80 tcp  1    0        2 e 1,2
  2 172.31.1.100  -                          3306 tcp  2    0      486 e 3      4
  3 212.72.229.101 2a02:968:1:1:212:72:229:101  80 tcp  3    0      100 e 5,6
  4 212.72.229.101 2a02:968:1:1:212:72:229:101  443 tcp  3    0      22 e 7,8
  5 172.31.1.101  -                          3306 tcp  2    0        9 e 9      10
  6 212.72.227.82  2a02:968:1:7:212:72:227:82    80 tcp  1    0        2 e 11,12
  7 212.72.227.82  2a02:968:1:7:212:72:227:82  443 tcp  1    0        0 e 13,14
  8 212.72.227.80  2a02:968:1:7:212:72:227:80  443 tcp  1    0        0 e 15,16
  9 212.72.229.102 2a02:968:1:1:212:72:229:102  80 tcp  3    0      128 e 5,6
  10 212.72.229.102 2a02:968:1:1:212:72:229:102  443 tcp  3    0      40 e 7,8
  11 212.72.229.103 2a02:968:1:1:212:72:229:103  80 tcp  3    0        3 e 5,6
  12 212.72.229.103 2a02:968:1:1:212:72:229:103  443 tcp  3    0        0 '''e''' 7,8
 
= status van target bekijken =
Met het commando '''show target''' zien we de status van alle targets
<pre>
LB1# show target
  no ipaddr        ipaddr6                    port prt net net6 srv sessions status      info                                              name
  -- ------------- -------------------------- ---- --- --- ---- --- -------- ----------- -------------------------------------------------- --------------------
  1 212.72.227.68 2a02:968:1:7:212:72:227:68  80 tcp  1    1  1        1 operational arp:up,nd6:up,ping:up,ping6:up,agent6:5,script:up  www-test-lb1
  2 212.72.227.69 2a02:968:1:7:212:72:227:69  80 tcp  1    1  1        1 operational arp:up,nd6:up,ping:up,ping6:up,agent6:1,script:up  www-test-lb2
  3 172.31.1.213  -                          3306 tcp  2    0  2      471 operational arp:up,ping:up,agent:1,script:up                  db01
  4 172.31.1.214  -                          3306 tcp  2    0  2        0 operational arp:up,ping:up,agent:5,script:up                  db02
  5 212.72.229.90 2a02:968:1:1:212:72:229:90  80 tcp  3    3  *      105 operational arp:up,nd6:up,ping:up,ping6:up,agent6:16,script:up php-joomla-lb1 http
  6 212.72.229.91 2a02:968:1:1:212:72:229:91  80 tcp  3    3  *      108 operational arp:up,nd6:up,ping:up,ping6:up,agent6:4,script:up  php-joomla-lb2 http
  7 212.72.229.90 2a02:968:1:1:212:72:229:90  443 tcp  3    3  *      28 operational arp:up,nd6:up,ping:up,ping6:up,agent6:16,script:up php-joomla-lb1 https
  8 212.72.229.91 2a02:968:1:1:212:72:229:91  443 tcp  3    3  *      26 operational arp:up,nd6:up,ping:up,ping6:up,agent6:4,script:up  php-joomla-lb2 https
  9 172.31.1.215  -                          3306 tcp  2    0  5        9 operational arp:up,ping:up,agent:1,script:up                  HCC-db03-int
  10 172.31.1.216  -                          3306 tcp  2    0  5        0 operational arp:up,ping:up,agent:1,script:up                  HCC-db04-int
  11 212.72.227.72 2a02:968:1:7:212:72:227:72  80 tcp  1    1  6        1 operational arp:up,nd6:up,ping:up,ping6:up,agent6:1,script:up  www-prod-lb1 http
  12 212.72.227.73 2a02:968:1:7:212:72:227:73  80 tcp  1    1  6        1 operational arp:up,nd6:up,ping:up,ping6:up,agent6:3,script:up  www-prod-lb2 http
  13 212.72.227.72 2a02:968:1:7:212:72:227:72  443 tcp  1    1  7        0 operational arp:up,nd6:up,ping:up,ping6:up,agent6:1,script:up  www-prod-lb1 https
  14 212.72.227.73 2a02:968:1:7:212:72:227:73  443 tcp  1    1  7        0 operational arp:up,nd6:up,ping:up,ping6:up,agent6:3,script:up  www-prod-lb2 https
  15 212.72.227.68 2a02:968:1:7:212:72:227:68  443 tcp  1    1  8        0 operational arp:up,nd6:up,ping:up,ping6:up,agent6:5,script:up  www-test-lb1 https
  16 212.72.227.69 2a02:968:1:7:212:72:227:69  443 tcp  1    1  8        0 operational arp:up,nd6:up,ping:up,ping6:up,agent6:1,script:up  www-test-lb2 https
</pre>
 
= target uitschakelen =
Stel je wilt target 8 uitschakelen dan geef je het commando '''disable target 8''', als je dan de status van de targets opvraagt zul je zien dat bij target 8 '''disabled''' staat:
<pre>
LB1# disable target 8
LB1# show target
  no ipaddr        ipaddr6                    port prt net net6 srv sessions status      info                                              name
  -- ------------- -------------------------- ---- --- --- ---- --- -------- ----------- -------------------------------------------------- --------------------
  1 212.72.227.68 2a02:968:1:7:212:72:227:68  80 tcp  1    1  1        1 operational arp:up,nd6:up,ping:up,ping6:up,agent6:7,script:up  www-test-lb1
  2 212.72.227.69 2a02:968:1:7:212:72:227:69  80 tcp  1    1  1        1 operational arp:up,nd6:up,ping:up,ping6:up,agent6:2,script:up  www-test-lb2
  3 172.31.1.213  -                          3306 tcp  2    0  2      444 operational arp:up,ping:up,agent:1,script:up                  db01
  4 172.31.1.214  -                          3306 tcp  2    0  2        0 operational arp:up,ping:up,agent:1,script:up                  db02
  5 212.72.229.90 2a02:968:1:1:212:72:229:90  80 tcp  3    3  *      90 operational arp:up,nd6:up,ping:up,ping6:up,agent6:2,script:up  php-joomla-lb1 http
  6 212.72.229.91 2a02:968:1:1:212:72:229:91  80 tcp  3    3  *      85 operational arp:up,nd6:up,ping:up,ping6:up,agent6:7,script:up  php-joomla-lb2 http
  7 212.72.229.90 2a02:968:1:1:212:72:229:90  443 tcp  3    3  *      27 operational arp:up,nd6:up,ping:up,ping6:up,agent6:2,script:up  php-joomla-lb1 https
  8 212.72.229.91 2a02:968:1:1:212:72:229:91  443 tcp  3    3  *      28 disabled    disabled                                          php-joomla-lb2 https
  9 172.31.1.215  -                          3306 tcp  2    0  5        9 operational arp:up,ping:up,agent:1,script:up                  HCC-db03-int
  10 172.31.1.216  -                          3306 tcp  2    0  5        0 operational arp:up,ping:up,agent:38,script:up                  HCC-db04-int
  11 212.72.227.72 2a02:968:1:7:212:72:227:72  80 tcp  1    1  6        2 operational arp:up,nd6:up,ping:up,ping6:up,agent6:1,script:up  www-prod-lb1 http
  12 212.72.227.73 2a02:968:1:7:212:72:227:73  80 tcp  1    1  6        1 operational arp:up,nd6:up,ping:up,ping6:up,agent6:10,script:up www-prod-lb2 http
  13 212.72.227.72 2a02:968:1:7:212:72:227:72  443 tcp  1    1  7        0 operational arp:up,nd6:up,ping:up,ping6:up,agent6:1,script:up  www-prod-lb1 https
  14 212.72.227.73 2a02:968:1:7:212:72:227:73  443 tcp  1    1  7        0 operational arp:up,nd6:up,ping:up,ping6:up,agent6:10,script:up www-prod-lb2 https
  15 212.72.227.68 2a02:968:1:7:212:72:227:68  443 tcp  1    1  8        0 operational arp:up,nd6:up,ping:up,ping6:up,agent6:7,script:up  www-test-lb1 https
  16 212.72.227.69 2a02:968:1:7:212:72:227:69  443 tcp  1    1  8        0 operational arp:up,nd6:up,ping:up,ping6:up,agent6:2,script:up  www-test-lb2 https
</pre>
 
= target inschakelen =
Stel je wilt target 8 inschakelen dan geef je het commando '''enable target 8''', als je dan de status van targets op vraagt zul je zien dat bij target 8 '''operational''' staat:
<pre>
LB1# show target
  no ipaddr        ipaddr6                    port prt net net6 srv sessions status      info                                              name
  -- ------------- -------------------------- ---- --- --- ---- --- -------- ----------- ------------------------------------------------- --------------------
  1 212.72.227.68 2a02:968:1:7:212:72:227:68  80 tcp  1    1  1        1 operational arp:up,nd6:up,ping:up,ping6:up,agent6:1,script:up www-test-lb1
  2 212.72.227.69 2a02:968:1:7:212:72:227:69  80 tcp  1    1  1        1 operational arp:up,nd6:up,ping:up,ping6:up,agent6:1,script:up www-test-lb2
  3 172.31.1.213  -                          3306 tcp  2    0  2      422 operational arp:up,ping:up,agent:1,script:up                  db01
  4 172.31.1.214  -                          3306 tcp  2    0  2        0 operational arp:up,ping:up,agent:1,script:up                  db02
  5 212.72.229.90 2a02:968:1:1:212:72:229:90  80 tcp  3    3  *      97 operational arp:up,nd6:up,ping:up,ping6:up,agent6:3,script:up php-joomla-lb1 http
  6 212.72.229.91 2a02:968:1:1:212:72:229:91  80 tcp  3    3  *      96 operational arp:up,nd6:up,ping:up,ping6:up,agent6:6,script:up php-joomla-lb2 http
  7 212.72.229.90 2a02:968:1:1:212:72:229:90  443 tcp  3    3  *      25 operational arp:up,nd6:up,ping:up,ping6:up,agent6:3,script:up php-joomla-lb1 https
  8 212.72.229.91 2a02:968:1:1:212:72:229:91  443 tcp  3    3  *      18 operational arp:up,nd6:up,ping:up,ping6:up,agent6:6,script:up php-joomla-lb2 https
  9 172.31.1.215  -                          3306 tcp  2    0  5        9 operational arp:up,ping:up,agent:1,script:up                  HCC-db03-int
  10 172.31.1.216  -                          3306 tcp  2    0  5        0 operational arp:up,ping:up,agent:6,script:up                  HCC-db04-int
  11 212.72.227.72 2a02:968:1:7:212:72:227:72  80 tcp  1    1  6        1 operational arp:up,nd6:up,ping:up,ping6:up,agent6:3,script:up www-prod-lb1 http
  12 212.72.227.73 2a02:968:1:7:212:72:227:73  80 tcp  1    1  6        1 operational arp:up,nd6:up,ping:up,ping6:up,agent6:7,script:up www-prod-lb2 http
  13 212.72.227.72 2a02:968:1:7:212:72:227:72  443 tcp  1    1  7        0 operational arp:up,nd6:up,ping:up,ping6:up,agent6:3,script:up www-prod-lb1 https
  14 212.72.227.73 2a02:968:1:7:212:72:227:73  443 tcp  1    1  7        0 operational arp:up,nd6:up,ping:up,ping6:up,agent6:7,script:up www-prod-lb2 https
  15 212.72.227.68 2a02:968:1:7:212:72:227:68  443 tcp  1    1  8        0 operational arp:up,nd6:up,ping:up,ping6:up,agent6:1,script:up www-test-lb1 https
  16 212.72.227.69 2a02:968:1:7:212:72:227:69  443 tcp  1    1  8        0 operational arp:up,nd6:up,ping:up,ping6:up,agent6:1,script:up www-test-lb2 https
</pre>
 
=handige links=
[http://www.inlab.de/balanceng De site van de maker van BalanceNG]
 
=handleiding=
[[Media:handleiding-ng.pdf]]
 
=Vereisten voor installatie loadbalancer software=
 
== software ==
Het ubuntu pakket mon en mysql-client moet worden geinstalleerd, daar moet mon service wel gedeactiveerd worden:
update-rc.d mon disable
 
Daarnaast moet de dbi perl module worden geinstalleerd als volgt:
 
perl -MCPAN -e 'install DBI'
 
Deze pakket zijn voor de check plugins
== firewall ==
De firewall dient uitgeschakeld te worden
 
== sysctl.conf ==
Deze settings moeten worden toegevoegd worden aan sysctl.conf
# Disable IPv6 on internal network
net.ipv6.conf.eth1.disable_ipv6=1
#
# Disable auto generated IPv6 address on eth0
net.ipv6.conf.eth0.autoconf=0
#
# Disable auto generated IPv6 address on eth2
net.ipv6.conf.eth2.autoconf=0
#
# Disable auto generated IPv6 address on eth2
net.ipv6.conf.eth3.autoconf=0
 
=licentie=
De licentie is gekoppeld aan de machine moet opnieuwe gegeneren bij inlab
 
= upgrade procedure =
Volgende omschrijft de upgrade procedure voor de loadbalancers.
 
* Download de i386 en amd64 .deb files bij inlab  https://www.inlab.de/balanceng/download.html
* ga naar backup2bit ga naar de directory /disk/site/hobbynet/www/repo/pool/non-free/b
* verwijderder de oude deb files ('''Niet rename of wat dan ook ze mogen niet meer in deze dir staan''')
* plaats hier de 2 gedownloaden deb files
* draai 'mkpackes' om de repostory te updaten
* ga naar lb1 draai bng stop om de loadbalancer te stoppen
* kijk of lb2 het goed heeft overgenomen (bezoek www.hcc.nl)
* draai 'apt-get update'
* draai 'apt-get dist-upgrade'
* doe 'bng start'
* ga in control modus met 'bng control'
* check of alle targets up zijn met commando 'sh tar'
  Er kunnen altijd een paar targets down zijn of gedisabled maar het overgrote deel moet de status 'operational' hebben
  Het kan soms even duren voor dat alles operational is !
* doe 'sh vrrp', de state moet BACKUP zijn
* herhaal deze procedure voor lb2
* vergeet niet te controleren of hcc.nl werkt
= herinstalatie procedure =
De herinstalatie procedure staat apart beschreven hier [[Herinstallatie Loadbalancer]]

Revision as of 09:56, 28 September 2020

doel

De loadbalancer zorgt er voor dat onze webdiensten redundant uitgevoerd worden.

opzet

We hebben 2 virutele loadbalancer loadbalancer1 en loadbalancer2. Elk draai op een andere hypervisor te weten vmware1 en vmware2


normale situatie

Dit geeft weer hoe in normale situaties het verkeer loopt.

File:Normaal.dia

webserver faalt

Dit geeft weer hoe het verkeer loopt wanneer een webserver faalt.

File:Webserverfaalt.dia

loadbalancer faalt

Dit geeft weer hoe het verkeer loopt wanneer een loadbalancer faalt.

File:Lbfaalt.dia

IP plan

servers

Gereserveerd

212.72.224 IP reeks

212.72.224.240 2a02:968:1:2:212:72:224:240  loadbalancer1-vlan100.hobby.nl     (IP adressen voor loadbalancer zelf)
212.72.224.241 2a02:968:1:2:212:72:224:241  loadbalancer2-vlan100.hobby.nl     (IP adressen voor loadbalancer zelf)

212.72.227 IP reeks

212.72.227.88 en 2a02:968:1:7:212:72:227:88  loadbalancer1-vlan107.hobby.nl     (IP adressen voor loadbalancer zelf)
212.72.227.89 en 2a02:968:1:7:212:72:227:89  loadbalancer2-vlan107.hobby.nl     (IP adressen voor loadbalancer zelf)

212.72.229 IP reeks

212.72.229.240 2a02:968:1:1:212:72:229:240  loadbalancer1-vlan102.hobby.nl     (IP adressen voor loadbalancer zelf)
212.72.229.241 2a02:968:1:1:212:72:229:241  loadbalancer2-vlan102.hobby.nl     (IP adressen voor loadbalancer zelf)

172.31.1 IP reeks

172.31.1.240 2a02:968:ffff:999:172:31:1:240  loadbalancer1-vlan100.hobby.nl     (IP adressen voor loadbalancer zelf)
172.31.1.241 2a02:968:ffff:999:172:31:1:241  loadbalancer2-vlan100.hobby.nl     (IP adressen voor loadbalancer zelf)
dns aliassen

Via interne netwerk zijn de dns aliassen aangemaakt loadbalancer1-int.hobby.nl en loadbalancer2-int.hobby.nl op die manier konden gebruik blijven maken van hobbynet wildcard certificaat.

targets

Target vallen in de gewone ip space en is dus geen ruimte voor gereserveerd

toegekend

extern

  • 212.72.227.68 www-test-lb1
  • 212.72.227.69 www-test-lb2
  • 212.72.227.72 www-prod-lb1
  • 212.72.227.73 www-prod-lb2
  • 212.72.229.90 php-joomla-lb1
  • 212.72.229.91 php-joomla-lb2
  • 212.72.229.110 www.scouting.nl
  • 212.72.229.111 www.scoutingschipluiden.nl

intern

  • 172.31.1.213 db01
  • 172.31.1.214 db02
  • 172.31.1.215 HCC-db03
  • 172.31.1.216 HCC-db04

configuratie

firewall lock down script

handleidingen