diff --git a/conf/kapitel/kapitel_13.conf b/conf/kapitel/kapitel_13.conf new file mode 100644 index 0000000..54a1048 --- /dev/null +++ b/conf/kapitel/kapitel_13.conf @@ -0,0 +1,136 @@ +##### Kapitel 13 + +### Web-Worker Definition + + + DocumentRoot /usr/local/apache2/htdocs-webworkerX.sv + ServerName webworker1.sv + DirectoryIndex index.php index.html + CustomLog logs/webworker1-access.log combined + ErrorLog logs/webworker1-error.log + + + + DocumentRoot /usr/local/apache2/htdocs-webworkerX.sv + ServerName webworker2.sv + DirectoryIndex index.php index.html + CustomLog logs/webworker2-access.log combined + ErrorLog logs/webworker2-error.log + + +### Loadbalancer pen + +# % pen -f -l /tmp/pen.log 172.31.31.113:8888 172.31.31.111:80 172.31.31.112:80 + +### Balancer plus Manager + +LoadModule proxy_balancer_module modules/mod_proxy_balancer.so +LoadModule slotmem_shm_module modules/mod_slotmem_shm.so +LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so +#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so +#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so +#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so + +# BalancerPersist On + + + ServerName revproxy-manager.sv + + + SetHandler balancer-manager + Require ip 172.31.31.0/24 + + + + BalancerMember http://172.31.31.111 + BalancerMember http://172.31.31.112 + + + ProxyPass /balancer-manager ! + ProxyPass / balancer://webworker/ + + CustomLog logs/revproxy-manager_access.log combined + ErrorLog logs/revproxy-manager_error.log + + +### Weiteres: Balancer Sticky + +# Testen (mehrfach hintereinander!) mit +# % curl -i http://revproxy-sticky.sv +# % curl -i --cookie "ROUTEID=.w2; path=/" http://revproxy-sticky.sv + +#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so +#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so +#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so +#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so +#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so +#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so + +# BalancerPersist On + + + ServerName revproxy-sticky.sv + + Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED + + + SetHandler balancer-manager + Require ip 172.31.31.0/24 + + + + BalancerMember http://172.31.31.111 route=w1 + BalancerMember http://172.31.31.112 route=w2 + + ProxySet stickysession=ROUTEID + + + ProxyPass /balancer-manager ! + ProxyPass / balancer://webworker/ + + CustomLog logs/revproxy-sticky_access.log combined + ErrorLog logs/revproxy-sticky_error.log + + +### Tomcat Loadbalancer mit Sticky-Sessions + + + ServerName tomcat-lb.sv + + DocumentRoot /usr/share/tomcat9-examples/ + + + BalancerMember ajp://localhost:8009 route=t0 + BalancerMember ajp://192.168.1.101:8009 route=t1 + BalancerMember ajp://192.168.1.102:8009 route=t2 status=+H + BalancerMember ajp://192.168.1.103:8009 route=t3 status=+R + ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On + + + BalancerMember ws://localhost:8080 route=t0 + BalancerMember ws://192.168.1.101:8080 route=t2 + BalancerMember ws://192.168.1.102:8080 route=t3 status=+H + BalancerMember ws://192.168.1.103:8080 route=t4 status=+R + ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On + + + RewriteEngine On + RewriteRule ^/examples/(.*)\.jsp(x?)$ balancer://tomcat-ajp/examples/$1.jsp$2 [P,L] + + RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f + RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d + RewriteRule ^/examples/websocket/(.*)$ balancer://tomcat-ws/examples/websocket/$1 [P,L] + + RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f + RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d + RewriteRule ^/examples/(.*)$ ajp://tomcat-ajp/examples/$1 [P,L] + + + Require all granted + Options Indexes + + + CustomLog logs/tomcat-lb_access.log combined + ErrorLog logs/tomcat-lb_error.log + +