Friday, December 17, 2010

Software loadbalancer with Subdomain

NameVirtualHost Public IP Address:80


ServerName www.websitename.com
ServerAlias websitename.com
DocumentRoot /var/www/

Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED

Options +FollowSymlinks
RewriteEngine on
Order deny,allow
Allow from all



BalancerMember http://Local IP Address route=node1
BalancerMember http://Local IP Address route=node2
ProxySet stickysession=ROUTEID
ProxySet lbmethod=byrequests


ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/
ProxyPassReverse / http://Local IP Address/
ProxyPassReverse / http://Local IP Address/

SetHandler balancer-manager
Options FollowSymLinks
Order deny,allow
Allow from all


ErrorLog logs/sitename_error
CustomLog logs/sitename_custom "%t Time=%D %h LocalIP=%A FileName=%f FirstLineOfReq=%r RequestedURLWOQueryString=%U CanonicalServerName=%v Referrer=\"%{Referer}i\" Node=%{ROUTEID}C Worker=\"%{BALANCER_WORKER_NAME}e\""




ServerName www.Subdomain.websitename.com
ServerAlias subdomain.websitename.com
DocumentRoot /var/www/

Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED

Options +FollowSymlinks
RewriteEngine on
Order deny,allow
Allow from all



BalancerMember http://Local IP Address/advertiser route=node1
BalancerMember http://Local IP Address/advertiser route=node2
ProxySet stickysession=ROUTEID
ProxySet lbmethod=byrequests


ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/
ProxyPassReverse / http://Local IP Address/advertiser/
ProxyPassReverse / http://Local IP Address/advertiser/

SetHandler balancer-manager
Options FollowSymLinks
Order deny,allow
Allow from all


ErrorLog logs/sitename_error
#CustomLog logs/sitename_custom "%t %T %h %A %r %f %U %{ROUTEID}C %v %V %>s %b \"%{Referer}i\" \"%{BALANCER_WORKER_NAME}e\""
CustomLog logs/sitename_custom "%t Time=%D %h LocalIP=%A FileName=%f FirstLineOfReq=%r RequestedURLWOQueryString=%U CanonicalServerName=%v Referrer=\"%{Referer}i\" Node=%{ROUTEID}C Worker=\"%{BALANCER_WORKER_NAME}e\""




ServerName www.subdomain.websitename.com
ServerAlias subdomain.websitename.com
DocumentRoot /var/www/

Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED


Order deny,allow
Allow from all



BalancerMember http://Local IP Address/corporate route=node1
BalancerMember http://Local IP Address/corporate route=node2
ProxySet stickysession=ROUTEID
ProxySet lbmethod=byrequests


ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/
ProxyPassReverse / http://Local IP Address/corporate/
ProxyPassReverse / http://Local IP Address/corporate/

SetHandler balancer-manager
Order deny,allow
Allow from all


ErrorLog logs/sitename_error
#CustomLog logs/sitename_custom "%t %T %h %A %r %f %U %{ROUTEID}C %v %V %>s %b \"%{Referer}i\" \"%{BALANCER_WORKER_NAME}e\""
CustomLog logs/sitename_custom "%t Time=%D %h LocalIP=%A FileName=%f FirstLineOfReq=%r RequestedURLWOQueryString=%U CanonicalServerName=%v Referrer=\"%{Referer}i\" Node=%{ROUTEID}C Worker=\"%{BALANCER_WORKER_NAME}e\""

0 comments:

Post a Comment