<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>loadbalancer Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/loadbalancer/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Thu, 21 Jun 2018 20:41:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>How to install and configure HAProxy loadbalancer on Ubuntu 18.04</title>
		<link>https://www.osradar.com/how-to-install-and-configure-haproxy-loadbalancer-on-ubuntu-18-04/</link>
					<comments>https://www.osradar.com/how-to-install-and-configure-haproxy-loadbalancer-on-ubuntu-18-04/#respond</comments>
		
		<dc:creator><![CDATA[Mel]]></dc:creator>
		<pubDate>Tue, 12 Jun 2018 08:36:22 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[HAProxy]]></category>
		<category><![CDATA[loadbalancer]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=3642</guid>

					<description><![CDATA[<p>A load balancer goes about as the &#8220;traffic cop&#8221; sitting before your servers and steering customer asks for over all servers fit for satisfying those solicitations in a way that boosts speed and limit use and guarantees that nobody server is exhausted, which could debase execution. In the event that a solitary server goes down, [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-and-configure-haproxy-loadbalancer-on-ubuntu-18-04/">How to install and configure HAProxy loadbalancer on Ubuntu 18.04</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>A load balancer goes about as the &#8220;traffic cop&#8221; sitting before your servers and steering customer asks for over all servers fit for satisfying those solicitations in a way that boosts speed and limit use and guarantees that nobody server is exhausted, which could debase execution. In the event that a solitary server goes down, the load balancer diverts activity to the staying on the web servers. At the point when another server is added to the server gathering, the heap balancer naturally begins to send demands to it.</p>
<p>To install and configure HAProxy loadbalancer on Ubuntu 18.04 we will consider three system as follows</p>
<p>1. One is web server1&gt;IP Address: 192.168.64.137&gt;Hostname:system1.osrader.com<br />
2. Two is web server2&gt;IP Address: 192.168.64.139&gt;Hostname:system2.osrader.com<br />
3. HAproxy loadbalancer&gt;IP Address: 192.168.64.141&gt;Hostname:loadbalancer.osrader.com</p>
<p><strong>Step 01:</strong> Make sure that system1 and system2 has apache2 installed. Please use below command for Ubuntu 18.04 to install apache2 for both system1 and system2.</p>
<pre><em><strong>$ sudo apt-get update</strong></em>
<em><strong>$ sudo apt-get install apache2</strong></em>
<em><strong>$sudo ufw app list</strong></em> (to check list of application profiles)<img loading="lazy" class="alignleft wp-image-3801 size-medium" src="https://www.osradar.com/wp-content/uploads/2018/06/app_list-300x86.png" alt="" width="300" height="86" srcset="https://www.osradar.com/wp-content/uploads/2018/06/app_list-300x86.png 300w, https://www.osradar.com/wp-content/uploads/2018/06/app_list.png 368w" sizes="(max-width: 300px) 100vw, 300px" /></pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<pre><em><strong>$sudo ufw allow 'Apache'</strong></em>
<em><strong>$sudo ufw status</strong></em> (for verifying)
<em><strong>$sudo systemctl status apache2</strong></em> (to check service status)</pre>
<p>Now type system1 and system2 IP address on web browser and visit apach2 default web page.<img loading="lazy" class="aligncenter wp-image-3798 size-full" src="https://www.osradar.com/wp-content/uploads/2018/06/Default_Page1.png" alt="" width="807" height="501" srcset="https://www.osradar.com/wp-content/uploads/2018/06/Default_Page1.png 807w, https://www.osradar.com/wp-content/uploads/2018/06/Default_Page1-300x186.png 300w, https://www.osradar.com/wp-content/uploads/2018/06/Default_Page1-768x477.png 768w, https://www.osradar.com/wp-content/uploads/2018/06/Default_Page1-356x220.png 356w, https://www.osradar.com/wp-content/uploads/2018/06/Default_Page1-696x432.png 696w, https://www.osradar.com/wp-content/uploads/2018/06/Default_Page1-677x420.png 677w" sizes="(max-width: 807px) 100vw, 807px" /></p>
<p>You can change default <strong>index.html</strong> file from <strong>/var/www/html</strong>.<br />
You can also change <strong>/etc/hosts</strong> file to visit web page by host name, like I did.</p>
<p><img loading="lazy" class="wp-image-3799 size-medium alignleft" src="https://www.osradar.com/wp-content/uploads/2018/06/cwp_sys1-300x199.png" alt="" width="300" height="199" srcset="https://www.osradar.com/wp-content/uploads/2018/06/cwp_sys1-300x199.png 300w, https://www.osradar.com/wp-content/uploads/2018/06/cwp_sys1.png 480w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p><img loading="lazy" class="alignright wp-image-3800 size-medium" src="https://www.osradar.com/wp-content/uploads/2018/06/cwp_sys2-300x222.png" alt="" width="300" height="222" srcset="https://www.osradar.com/wp-content/uploads/2018/06/cwp_sys2-300x222.png 300w, https://www.osradar.com/wp-content/uploads/2018/06/cwp_sys2-80x60.png 80w, https://www.osradar.com/wp-content/uploads/2018/06/cwp_sys2.png 475w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Step 02: </strong></p>
<p>We will now configure loadbalancer machine. At first we will install HAProxy by executing below commands</p>
<pre><em><strong>$ sudo add-apt-repository ppa:vbernat/haproxy-1.7</strong></em>
<em><strong>$ sudo apt-get update</strong></em>
<em><strong>$ sudo apt-get install haproxy</strong></em></pre>
<p><strong>Step 03:</strong></p>
<p>Edit haproxy default configuration file /etc/haproxy/haproxy.cfg and start configuration.</p>
<pre><em><strong>$ vim /etc/haproxy/haproxy.cfg</strong></em></pre>
<p>At the end of the file we will add folowing information</p>
<pre><em>frontend Local_Server</em>
<em>bind 192.168.64.141:80</em>
<em>mode http</em>
<em>default_backend webserver</em>

<em>backend webserver</em>
<em>mode http</em>
<em>balance roundrobin</em>
<em>option forwardfor</em>
<em>http-request set-header X-Forwarded-Port %[dst_port]</em>
<em>http-request add-header X-Forwarded-Proto https if { ssl_fc }</em>
<em>option httpchk HEAD / HTTP/1.1rnHost:localhost</em>
<em>server system1.osradar.com 192.168.64.137:80</em>
<em>server system2.osradar.com 192.168.64.139:80</em></pre>
<p><strong>Step 04:</strong></p>
<p>To verify the configuration</p>
<pre><em><strong>$ sudo haproxy -c -f /etc/haproxy/haproxy.cfg</strong></em></pre>
<p>It will show output : Configuration file is valid</p>
<p><strong>Step 05: </strong></p>
<p>Restart HAproxy</p>
<pre><em><strong>$ sudo service haproxy restart</strong></em></pre>
<p>Now type 192.168.64.141(loadbalancer system ip) on web browser and refresh 2/3times. You will see HAProxy loadbalancer is working.<br />
<img loading="lazy" class="alignleft wp-image-3802 size-medium" src="https://www.osradar.com/wp-content/uploads/2018/06/load_sys1-300x236.png" alt="" width="300" height="236" srcset="https://www.osradar.com/wp-content/uploads/2018/06/load_sys1-300x236.png 300w, https://www.osradar.com/wp-content/uploads/2018/06/load_sys1.png 445w" sizes="(max-width: 300px) 100vw, 300px" /> <img loading="lazy" class="alignright wp-image-3803 size-medium" src="https://www.osradar.com/wp-content/uploads/2018/06/load_sys2-300x214.png" alt="" width="300" height="214" srcset="https://www.osradar.com/wp-content/uploads/2018/06/load_sys2-300x214.png 300w, https://www.osradar.com/wp-content/uploads/2018/06/load_sys2-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/06/load_sys2-485x347.png 485w, https://www.osradar.com/wp-content/uploads/2018/06/load_sys2.png 486w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Thank you.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-and-configure-haproxy-loadbalancer-on-ubuntu-18-04/">How to install and configure HAProxy loadbalancer on Ubuntu 18.04</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-install-and-configure-haproxy-loadbalancer-on-ubuntu-18-04/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to configure HAProxy Load Balancing on Centos 7</title>
		<link>https://www.osradar.com/how-to-configure-haproxy-load-balancing-on-centos-7/</link>
					<comments>https://www.osradar.com/how-to-configure-haproxy-load-balancing-on-centos-7/#respond</comments>
		
		<dc:creator><![CDATA[Mel]]></dc:creator>
		<pubDate>Tue, 05 Jun 2018 11:31:43 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Centos7]]></category>
		<category><![CDATA[HAProxy]]></category>
		<category><![CDATA[loadbalancer]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=3474</guid>

					<description><![CDATA[<p>Load balancing refers to efficiently distributing incoming network traffic across a group of backend servers, also known as a server farm or server pool. A load balancer acts as the “traffic cop” sitting in front of your servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-configure-haproxy-load-balancing-on-centos-7/">How to configure HAProxy Load Balancing on Centos 7</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Load balancing refers to efficiently distributing incoming network traffic across a group of backend servers, also known as a server farm or server pool.<br />
A load balancer acts as the “traffic cop” sitting in front of your servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes speed and capacity utilization and ensures that no one server is overworked, which could degrade performance. If any server goes down, the load balancer redirects traffic to the remaining online servers. When a new server is added to the server group, the load balancer automatically starts to send requests to it.<br />
In this manner, a load balancer performs the following functions:<br />
• Distributes client requests or network load efficiently across multiple servers<br />
• Ensures high availability and reliability by sending requests only to servers that are online<br />
• Provides the flexibility to add or subtract servers as demand dictates</p>
<p>To install and configure HAProxy loadbalancer we will consider below senario</p>
<ol>
<li>One is web server1&gt;IP Address: 192.168.248.132&gt;Hostname:system1.osradar.com</li>
<li>Two is web server2&gt;IP Address: 192.168.248.133&gt;Hostname:system2.osradar.com</li>
<li>HAproxyloadbalancer&gt;IPAddress:192.168.248.134&gt;Hostname:loadbalancer.osradar.com</li>
</ol>
<p>First make sure that you systems has above host name and IP Address.</p>
<p>Step 01: To check hostname (for three systems)<br />
<em><strong>#hostnamectl status</strong></em><br />
<em>Static hostname: system1.osradar.com</em><br />
<em>Static hostname: system2.osradar.com</em><br />
<em>Static hostname: loadbalancer.osradar.com</em></p>
<p>Step 02: To Check IP Address (for three system)<br />
<em><strong>#ip addr</strong></em><br />
or<br />
<em><strong>#ifconfig</strong></em><br />
<em>inet 192.168.248.132 netmask 255.255.255.0 broadcast 192.168.248.255</em><br />
<em>inet 192.168.248.133 netmask 255.255.255.0 broadcast 192.168.248.255</em><br />
<em>inet 192.168.248.134 netmask 255.255.255.0 broadcast 192.168.248.255</em></p>
<p>Step 03: Insert below information to all systems(system1, system2 and loadbalancer) <strong>/etc/hosts</strong> file<br />
<em><strong>#vim /ete/hosts</strong></em><br />
<em>192.168.248.132 system1.osradar.com system1</em><br />
<em>192.168.248.133 system2.osradar.com system2</em><br />
<em>192.168.248.134 loadbalancer.osradar.com loadbalancer</em><br />
<img loading="lazy" class="alignnone wp-image-3762 size-full" src="https://www.osradar.com/wp-content/uploads/2018/06/hosts-1.png" alt="" width="929" height="156" srcset="https://www.osradar.com/wp-content/uploads/2018/06/hosts-1.png 929w, https://www.osradar.com/wp-content/uploads/2018/06/hosts-1-300x50.png 300w, https://www.osradar.com/wp-content/uploads/2018/06/hosts-1-768x129.png 768w, https://www.osradar.com/wp-content/uploads/2018/06/hosts-1-696x117.png 696w" sizes="(max-width: 929px) 100vw, 929px" /></p>
<p>Step 04: To check that you can reach each system<br />
<em><strong>#ping system1</strong></em><br />
<em><strong>#ping system2</strong></em><br />
<em><strong>#Pint loadbalancer</strong></em></p>
<p>Step 05: Now install httpd to systems (system1, system2)<br />
<em><strong>#yum install httpd -y</strong></em><br />
<em><strong>#systemctl start httpd</strong></em><br />
<em><strong>#systemctl enable httpd</strong></em><br />
<em><strong>#firewall-cmd &#8211;permanent &#8211;zone=public &#8211;add-service=http</strong></em><br />
<em><strong>#firewall-cmd &#8211;permanent &#8211;zone=public &#8211;add-service=https</strong></em><br />
<em><strong>#firewall-cmd &#8211;reload</strong></em><br />
<em><strong>#firewall-cmd &#8211;list-all</strong></em> (to ckeck status)</p>
<p>Step 06: To check your web service is ok visit 192.168.248.132 and 192.168.248.133 from your systems browser. You will find that Apahe test page appears.<br />
<img loading="lazy" class="alignnone wp-image-3765 size-large" src="https://www.osradar.com/wp-content/uploads/2018/06/test123-1024x365.png" alt="" width="696" height="248" srcset="https://www.osradar.com/wp-content/uploads/2018/06/test123-1024x365.png 1024w, https://www.osradar.com/wp-content/uploads/2018/06/test123-300x107.png 300w, https://www.osradar.com/wp-content/uploads/2018/06/test123-768x274.png 768w, https://www.osradar.com/wp-content/uploads/2018/06/test123-696x248.png 696w, https://www.osradar.com/wp-content/uploads/2018/06/test123-1068x381.png 1068w, https://www.osradar.com/wp-content/uploads/2018/06/test123-1178x420.png 1178w, https://www.osradar.com/wp-content/uploads/2018/06/test123.png 1330w" sizes="(max-width: 696px) 100vw, 696px" /></p>
<p>You can make different index.html files for system1 and system2. So that you can get the difference. Here, we create <strong>index.html</strong> for system1 and system2 under <strong>/var/www/html</strong></p>
<p><em><strong>#vim /var/www/html/index.html</strong></em> (for system1)<br />
<em>This is &lt;h1&gt;system1&lt;/h1&gt;.osradar.com</em><br />
<em>Website</em><br />
<em>&lt;h3&gt;IP: 192.168.248.132&lt;/h3&gt;</em><br />
<em>#vim /var/www/html/index.html (for system2)</em><br />
<em>This is &lt;h1&gt;system2&lt;/h1&gt;.osradar.com</em><br />
<em>Website</em><br />
<em>&lt;h3&gt;IP: 192.168.248.133&lt;/h3&gt;</em></p>
<p><img loading="lazy" class="alignnone wp-image-3767 size-large" src="https://www.osradar.com/wp-content/uploads/2018/06/system1-1024x446.png" alt="" width="696" height="303" srcset="https://www.osradar.com/wp-content/uploads/2018/06/system1-1024x446.png 1024w, https://www.osradar.com/wp-content/uploads/2018/06/system1-300x131.png 300w, https://www.osradar.com/wp-content/uploads/2018/06/system1-768x335.png 768w, https://www.osradar.com/wp-content/uploads/2018/06/system1-696x303.png 696w, https://www.osradar.com/wp-content/uploads/2018/06/system1-1068x466.png 1068w, https://www.osradar.com/wp-content/uploads/2018/06/system1-963x420.png 963w, https://www.osradar.com/wp-content/uploads/2018/06/system1.png 1360w" sizes="(max-width: 696px) 100vw, 696px" /> <img loading="lazy" class="alignnone wp-image-3768 size-large" src="https://www.osradar.com/wp-content/uploads/2018/06/system2-1024x446.png" alt="" width="696" height="303" srcset="https://www.osradar.com/wp-content/uploads/2018/06/system2-1024x446.png 1024w, https://www.osradar.com/wp-content/uploads/2018/06/system2-300x131.png 300w, https://www.osradar.com/wp-content/uploads/2018/06/system2-768x335.png 768w, https://www.osradar.com/wp-content/uploads/2018/06/system2-696x303.png 696w, https://www.osradar.com/wp-content/uploads/2018/06/system2-1068x466.png 1068w, https://www.osradar.com/wp-content/uploads/2018/06/system2-963x420.png 963w, https://www.osradar.com/wp-content/uploads/2018/06/system2.png 1360w" sizes="(max-width: 696px) 100vw, 696px" /></p>
<p>Step 07: Install HAProxy on loadbalancer system and configure<br />
<em><strong>#yum install haproxy.x86_64 -y</strong></em><br />
<em><strong>#vim /etc/haproxy/haproxy.cfg</strong></em><br />
at the end of this file paste following information, save and exit.</p>
<h6>##############Frontend Server Configuration##########<br />
<em>frontend webapp</em><br />
<em>bind *:80</em><br />
<em>default_backend webserver</em></h6>
<p>#####################Backend Server Configuration##########</p>
<p><em>backend webserver</em><br />
<em>balance roundrobin</em><br />
<em>server system1 192.168.248.132:80 check</em><br />
<em>server system2 192.168.248.133:80 check</em></p>
<p>Step 08: Now we will check firewall status<br />
<em><strong>#firewall-cmd &#8211;list-all</strong></em><br />
If we found that port 80 and 8080 is not added in firewall then we have to add</p>
<p><em><strong>#firewall-cmd &#8211;permanent &#8211;zone=public &#8211;add-port=80/tcp</strong></em><br />
<em><strong>#firewall-cmd &#8211;permanent &#8211;zone=public &#8211;add-port=8080/tcp</strong></em><br />
<em><strong>#firewall-cmd &#8211;reload</strong></em></p>
<p>Step 09: We will change SeLinux status from enforcing to permissive<br />
<em><strong>#setenforce 0</strong></em></p>
<p>Step 10:<br />
<em><strong>#systemctl start haproxy.service</strong></em><br />
<em><strong>#systemctl enable haproxy.service</strong></em></p>
<p>From loadbalancer system web browser visit 192.168.248.134. Hit(refresh) this IP two/three times and you will see web page from system1 and system2 are visible.</p>
<p><img loading="lazy" class="aligncenter size-full wp-image-3773" src="https://www.osradar.com/wp-content/uploads/2018/06/loadbalance.png" alt="" width="560" height="321" srcset="https://www.osradar.com/wp-content/uploads/2018/06/loadbalance.png 560w, https://www.osradar.com/wp-content/uploads/2018/06/loadbalance-300x172.png 300w" sizes="(max-width: 560px) 100vw, 560px" /></p>
<p>That&#8217;s how loadbalancer works.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-configure-haproxy-load-balancing-on-centos-7/">How to configure HAProxy Load Balancing on Centos 7</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-configure-haproxy-load-balancing-on-centos-7/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
