<?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>Load balancing &#8211; lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</title>
	<atom:link href="https://lifelinux.com/tag/load-balancing/feed/" rel="self" type="application/rss+xml" />
	<link>https://lifelinux.com</link>
	<description>All About Linux !</description>
	<lastBuildDate>Thu, 25 Nov 2010 08:46:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.3</generator>
	<item>
		<title>How To Keep Data Sync&#8217;d Between Two Load Balanced Servers</title>
		<link>https://lifelinux.com/how-to-keep-data-syncd-between-two-load-balanced-servers/</link>
					<comments>https://lifelinux.com/how-to-keep-data-syncd-between-two-load-balanced-servers/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Thu, 25 Nov 2010 07:35:59 +0000</pubDate>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[Data Sync]]></category>
		<category><![CDATA[Load balancing]]></category>
		<category><![CDATA[mirror server]]></category>
		<category><![CDATA[rsync command]]></category>
		<category><![CDATA[sync server]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=186</guid>

					<description><![CDATA[<p>Load balancing helps provide redundancy to your website. However, one often asked question is how to keep your content synchronized on each server. If you put a new web page on one server, how does it get copied over to the second server? In this article, i&#8217;ll explain how to use rsync command to synchronize [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://lifelinux.com/how-to-keep-data-syncd-between-two-load-balanced-servers/">How To Keep Data Sync&#8217;d Between Two Load Balanced Servers</a> appeared first on <a rel="nofollow" href="https://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p><strong>Load balancing</strong> helps provide redundancy to your website. However, one often asked question is how to keep your content synchronized on each server. If you put a new web page on one server, how does it get copied over to the second server? In this article, i&#8217;ll explain how to use rsync command to synchronize data between a specific directory on each server.<span id="more-186"></span></p>
<h2>Install rsync</h2>
<p>On Centos Linux type the following command:</p>
<pre>yum install rsync
</pre>
<h2>Using rsync command with password authentication</h2>
<p>For example, i have two servers using for load balanced and called server1(192.168.1.101) and server2(192.168.1.102). I wanted to keep data in /var/www/html sync between to servers. Type the following command on server1:</p>
<pre>rsync -avr --progress --links --rsh='/usr/bin/ssh' 192.168.1.102:/var/www/html /var/www/html
</pre>
<p><strong>With:</strong><br />
-avr : archive mode (a), verbose (v), recurse into directories (r).<br />
&#8211;progress: Show progress.<br />
&#8211;links: copy symlinks as symlinks.<br />
&#8211;rsh: use to specify the remote shell ssh to use.<br />
192.168.1.102:/var/www/html: IP address of server2 and path to synchronize to server1<br />
/var/www/html: Server1 path</p>
<h2>Using rsync command with <a href="http://www.lifelinux.com/setting-up-an-ssh-certificate/">SSH certificate</a></h2>
<p>Replace above command with following command:</p>
<pre>rsync -avr --progress --links --rsh='/usr/bin/ssh -i /path_to_private_key' 192.168.1.102:/var/www/html /var/www/html
</pre>
<h2>A sample shell script</h2>
<pre>#!/bin/bash
SOURCEPATH='source'
DESTPATH='destination'
SOURCEHOST='ip_address'
PRIVATEKEY='private_key'
LOGFILE='log_file'
SSH='/usr/bin/ssh'
rsync -avr --progress --links --rsh="'$SSH -i $PRIVATEKEY'" $SOURCEHOST:$SOURCEPATH $DESTPATH 2&gt;&amp;1 &gt;&gt; $LOGFILE
</pre>
<g:plusone href="https://lifelinux.com/how-to-keep-data-syncd-between-two-load-balanced-servers/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="https://lifelinux.com/how-to-keep-data-syncd-between-two-load-balanced-servers/">How To Keep Data Sync&#8217;d Between Two Load Balanced Servers</a> appeared first on <a rel="nofollow" href="https://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lifelinux.com/how-to-keep-data-syncd-between-two-load-balanced-servers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
