<?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>MySQL How 2 &#187; Linux</title>
	<atom:link href="http://www.mysqlhow2.com/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlhow2.com</link>
	<description>MySQL DBA information and helpful tips and tricks to make life easier.</description>
	<lastBuildDate>Wed, 14 Jul 2010 15:54:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=2180</generator>
		<item>
		<title>Disk Raid Levels</title>
		<link>http://www.mysqlhow2.com/2010/02/20/disk-raid-levels/</link>
		<comments>http://www.mysqlhow2.com/2010/02/20/disk-raid-levels/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 17:07:16 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[redundancy]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=363</guid>
		<description><![CDATA[This article talks about raid levels and how they work. I like to use raid 5 and raid 10, this is based on performance testing that reads are faster on raid 5 and writes are faster on raid 10. I will be posting benchmark results soon so that you can see the differences of raid [...]]]></description>
			<content:encoded><![CDATA[<p>This article talks about raid levels and how they work. I like to use raid 5 and raid 10, this is based on performance testing that reads are faster on raid 5 and writes are faster on raid 10. I will be posting benchmark results soon so that you can see the differences of raid levels.</p>
<p><strong>RAID 1</strong><br />
RAID 1 mirrors the contents of the disks, making a form of 1:1 ratio realtime backup. The contents of each disk in the array are identical to that of every other disk in the array. A RAID 1 array requires a minimum of two drives. Although RAID 1&#8242;s writing process copies the data identically to all drives, a RAID 1 mirror would not be suitable as a permanent backup solution for businesses, since RAID architecture by design allows for certain failures to take place (e.g. vandalism or accidental file deletion). However for home or other applications, where vandalism is very unlikely and accidental file deletion is put up with, RAID 1 offers a good backup solution.<br />
<strong></strong></p>
<p><strong>RAID 3/4</strong><br />
RAID 3 or 4 (striped disks with dedicated parity) combines three or more disks in a way that protects data against loss of any one disk. Fault tolerance is achieved by adding an extra disk to the array, which is dedicated to storing parity information; the overall capacity of the array is reduced by one disk. A RAID 3 or 4 array requires a minimum of three drives: two to hold striped data, and a third for parity. With the minimum three drives needed for RAID 3, the storage efficiency is 66 percent. With six drives, the storage efficiency is 87 percent. The main disadvantage is poor performance for multiple, simultaneous, and independent read/write operations.<br />
<strong></strong></p>
<p><strong>RAID 5</strong><br />
Striped set with distributed parity or interleave parity requiring 3 or more disks. Distributed parity requires all drives but one to be present to operate; drive failure requires replacement, but the array is not destroyed by a single drive failure. Upon drive failure, any subsequent reads can be calculated from the distributed parity such that the drive failure is masked from the end user. The array will have data loss in the event of a second drive failure and is vulnerable until the data that was on the failed drive is rebuilt onto a replacement drive. A single drive failure in the set will result in reduced performance of the entire set until the failed drive has been replaced and rebuilt.<br />
<strong>RAID 6</strong><br />
RAID 6 (striped disks with dual parity) combines four or more disks in a way that protects data against loss of any two disks.<br />
<strong>RAID 10</strong><br />
RAID 1+0 (or 10) is a mirrored data set (RAID 1) which is then striped (RAID 0), hence the &#8220;1+0&#8243; name. A RAID 1+0 array requires a minimum of four drives: two mirrored drives to hold half of the striped data, plus another two mirrored for the other half of the data. In Linux MD RAID 10 is a non-nested RAID type like RAID 1, that only requires a minimum of two drives, and may give read performance on the level of RAID 0.<br />
<strong></strong></p>
<p><strong>RAID 01</strong><br />
RAID 0+1 (or 01) is a striped data set (RAID 0) which is then mirrored (RAID 1). A RAID 0+1 array requires a minimum of four drives: two to hold the striped data, plus another two to mirror the first pair.</p>
<p>RAID can involve significant computation when reading and writing information. With traditional &#8220;real&#8221; RAID hardware, a separate controller does this computation. In other cases the operating system or simpler and less expensive controllers require the host computer&#8217;s processor to do the computing, which reduces the computer&#8217;s performance on processor-intensive tasks (see Operating system based (&#8220;software RAID&#8221;) and Firmware/driver-based RAID below). Simpler RAID controllers may provide only levels 0 and 1, which require less processing.<br />
RAID systems with redundancy continue working without interruption when one (or possibly more, depending on the type of RAID) disks of the array fail, although they are then vulnerable to further failures. When the bad disk is replaced by a new one the array is rebuilt while the system continues to operate normally. Some systems have to be powered down when removing or adding a drive; others support hot swapping, allowing drives to be replaced without powering down. RAID with hot-swapping is often used in high availability systems, where it is important that the system remains running as much of the time as possible.<br />
Note that a RAID controller itself can become the single point of failure within a system.</p>
<p>We will talk about nested raid levels in the upcoming days as I start to benchmark for which ones have better performance with out risk</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/02/20/disk-raid-levels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Help to make your database and wordpress secure</title>
		<link>http://www.mysqlhow2.com/2010/02/09/help-to-make-your-database-and-website-secure/</link>
		<comments>http://www.mysqlhow2.com/2010/02/09/help-to-make-your-database-and-website-secure/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 04:47:12 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=315</guid>
		<description><![CDATA[Every now and then you see a site that has been hacked due to lack of security. I make it a practice to update my pass and secure my configuration files in a directory out of www/. I change my passwords every 60days on the database and on my account in wordpress, I use random [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and then you see a site that has been hacked due to lack of security. I make it a practice to update my pass and secure my configuration files in a directory out of www/. I change my passwords every 60days on the database and on my account in wordpress, I use random generated passwords to provide a little extra security. Im not saying this will prevent my site from being hacked, but it helps.</p>
<p>Every 60 days I add a user on the database that has the only needed privileges for the application to run. I show the current privileges and change user and password and add the new user. I record the old one in case I need to fail back. I also have changed the default user &#8220;root&#8221; to  another username, and I have deleted the testdb that is installed when you setup mysql initially.</p>
<p>I use the CLI to do all my mysql work but you can easily do this yourself using phpmyadmin, make sure the user you make the changes with has GRANT OPTION.</p>
<p>1)<strong> SHOW GRANTS FOR &#8216;&lt;username&gt; &#8216;@&#8217;&lt;host&gt;&#8217;;</strong></p>
<p><em>GRANT USAGE ON *.* TO &#8216;olduser&#8217;@'%&#8217; IDENTIFIED BY PASSWORD &#8216;*BCF0C51505BF07C0AC46B9AEBB7F9726EB4677B8&#8242;;<br />
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `databasename`.* TO &#8216;olduser&#8217;@'localhost&#8217;;</em></p>
<p>2) Now you need to change the use and password from GRANT. You have 4 otptions for setting password by calling the password function or by using plain text. Using plain text will put the plain text in the binary log!!!</p>
<p><strong>Option A:</strong> Generate the password hash using mysql</p>
<p><strong>SELECT PASSWORD(&#8216;somepassword&#8217;);</strong></p>
<p>this will out put<br />
<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| password(&#8216;somepassword&#8217;)                  |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| *DAABDB4081CCE333168409A6DB119E18D8EAA073 |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+</strong><br />
<strong>1 row in set (0.00 sec)</strong><br />
Now that we have the has of the password &#8220;somepassword&#8221; we can use that to update the password when applying grants.</p>
<p><em>GRANT USAGE ON *.* TO &#8216;newuser&#8217;@'%&#8217; IDENTIFIED BY PASSWORD &#8216;*DAABDB4081CCE333168409A6DB119E18D8EAA073&#8242;;<br />
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `databasename`.* TO &#8216;newuser&#8217;@'localhost&#8217;;</em></p>
<p><strong>Option B:</strong> You can use the password function to update the password during grant option.</p>
<p><em>GRANT USAGE ON *.* TO &#8216;newuser&#8217;@'%&#8217; IDENTIFIED BY PASSWORD(&#8216;somepassword&#8217;);<br />
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `databasename`.* TO &#8216;newuser&#8217;@'localhost&#8217;;</em></p>
<p><strong>Option C: </strong>You can set the password by removing the password from the old grant.</p>
<p><em>GRANT USAGE ON *.* TO &#8216;newuser&#8217;@'%&#8217; IDENTIFIED BY &#8216;somepassword&#8217;;<br />
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `databasename`.* TO &#8216;newuser&#8217;@'localhost&#8217;;</em></p>
<p><strong>Option D:</strong> I do not reccomend this as it is not a proper way to update grants for a user, but you can update the mysql.user table to change the user and passwords.</p>
<p><em>UPDATE mysql.user set user = &#8216;newuser&#8217;, password = PASSWORD(&#8216;newpassword&#8217;) where user = &#8216;olduser&#8217;;</em></p>
<p>This is not a proper way of updateing user but you can use it as long as you have rights to the mysql database.</p>
<p>The next step for any of these changes is to FLUSH PRIVILEGES: This flushes the new user to disk and refreshes the memory.</p>
<p>The final step will be to update the wp-config.php file in your www directory. In your www directory open your wp-config.php file with a text editor I use VIM for mine and look for these lines:<br />
<strong>/** MySQL database username */<br />
define(&#8216;DB_USER&#8217;, &#8216;olduser&#8217;);<br />
/** MySQL database password */<br />
define(&#8216;DB_PASSWORD&#8217;, &#8216;oldpassword&#8217;);</strong><br />
Update the user and password with your new information.</p>
<p>To try to secure my website I have changed my wp-config.php adn took the above lines out and put them in a seperate file and moved it to a directory outside of the www directory. I have my own server so I can put it anywhere as long as I know the absolute path. I have also encrypted the file using gpg which I will talk about in the near future. Once I make all the password and user updates I remove the old user from mysql and flush privileges once again.</p>
<p>Hopefully this article will help those who want to try to secure their site more effeciently. Please let me know if you have any questions or suggestions to secure a site.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/02/09/help-to-make-your-database-and-website-secure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Regular Expressions</title>
		<link>http://www.mysqlhow2.com/2010/02/05/mysql-reg-expressions/</link>
		<comments>http://www.mysqlhow2.com/2010/02/05/mysql-reg-expressions/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 19:15:37 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[Formulas]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Regular expressions]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=237</guid>
		<description><![CDATA[I added a page with a reg expression cheat sheet, so I wanted to post how MySQL can use reg expressions in select queries. I use these and they can be powerful. Using reg expressions in selects is about as basic as it comes. The format for reg expression for a SELECT is: SELECT something [...]]]></description>
			<content:encoded><![CDATA[<p>I added a page with a<a title="reg expression" href="http://www.mysqlhow2.com/reg-expression-cheat-sheet/"> reg expression cheat</a> sheet, so I wanted to post how MySQL can use reg expressions in select queries. I use these and they can be powerful. Using reg expressions in selects is about as basic as it comes.</p>
<p>The format for reg expression for a SELECT is:</p>
<pre class="brush: sql;">
SELECT something FROM table WHERE column REGEXP 'regexp'
</pre>
<p>For example, to select all columns from the table events where the values in the column id end with 5309, use:</p>
<pre class="brush: sql;">
SELECT * FROM events WHERE id REGEXP '5309$'
</pre>
<p>A more elaborate example selects all columns of the table reviews where the values in the column description contain the word &#8220;mysql&#8221;:</p>
<pre class="brush: sql;">
SELECT * FROM reviews WHERE description REGEXP '[[:&lt;:]]mysql[[:&gt;:]]'
</pre>
<p>MySQL allows the following regular expression metacharacters:. match any character</p>
<ul>
<li> ? match zero or one</li>
<li> * match zero or more</li>
<li> + match one or more</li>
<li> {n} match n times</li>
<li> {m,n} match m through n times</li>
<li> {n,} match n or more times</li>
<li> ^ beginning of line</li>
<li> $ end of line</li>
<li> [[:&lt;:]] match beginning of words [[:&gt;:]] match ending of words</li>
<li> [:class:] match a character class</li>
<li> i.e., [:alpha:] for letters</li>
<li> [:space:] for whitespace</li>
<li> [:punct:] for punctuation</li>
<li> [:upper:] for upper case letters</li>
<li> [abc] match one of enclosed chars</li>
<li> [^xyz] match any char not enclosed</li>
<li> | separates alternatives</li>
</ul>
<p>MySQL interprets a backslash (\) character as an escape character. To use a backslash in a regular expression, you must escape it with another backslash (\\).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/02/05/mysql-reg-expressions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Load Balancing with DSR</title>
		<link>http://www.mysqlhow2.com/2010/01/31/load-balancer/</link>
		<comments>http://www.mysqlhow2.com/2010/01/31/load-balancer/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 06:07:08 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[DSR Load Balance]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=150</guid>
		<description><![CDATA[I have many environments that use hardware load balancers. This can be very costly sending a lot of traffic through a load balancer. So we are starting to move to a DSR load balance design. A DSR load balance design is when a request comes into the load balancer the reply doesn&#8217;t go back through [...]]]></description>
			<content:encoded><![CDATA[<p>I have many environments that use hardware load balancers. This can be very costly sending a lot of traffic through a load balancer. So we are starting to move to a DSR load balance design.  A DSR load balance design is when a request comes into the load balancer the reply doesn&#8217;t go back through the load balancer, this keeps traffic through the load balancer at a minimal.  When you set up your network load balancer you have to pass the return ip to do this you need to set up a loop-back ip. once that is setup you use a loop-back ip on the server that will act as the load balancer to return to original source with out going back through the load balancer.</p>
<div id="attachment_158" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.mysqlhow2.com/wp-content/uploads/2010/01/300px-DSR1.png" rel="lightbox[150]"><img class="size-thumbnail wp-image-158" title="DSR Load Balance" src="http://www.mysqlhow2.com/wp-content/uploads/2010/01/300px-DSR1-150x150.png" alt="DSR Load Balance" width="150" height="150" /></a><p class="wp-caption-text">DSR Load Balance</p></div>
<p>To set up Loop-back<br />
Create a second lo file Make sure there is no ARP</p>
<pre class="brush: bash;">cp /etc/sysconfig/network-scripts/ifcfg-lo /etc/sysconfig/network-scripts/ifcfg-lo:0
vi /etc/sysconfig/network-scripts/ifcfg-lo:0</pre>
<pre class="brush: bash;">DEVICE=lo:0
IPADDR=1
#### Make sure you use nor arp
ARP=no
NETMASK=255.255.255.255
# If you're having problems with gated making 127.0.0.0/8 a martian,
# you can change this to something else (255.255.255.255, for example)
ONBOOT=yes</pre>
<p>Now bring up your loop-back</p>
<pre class="brush: bash;"> /sbin/ifup lo:0</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/01/31/load-balancer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kill long sleeping connections</title>
		<link>http://www.mysqlhow2.com/2010/01/31/kill-long-sleeping-connections/</link>
		<comments>http://www.mysqlhow2.com/2010/01/31/kill-long-sleeping-connections/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 05:50:58 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[long standing sleep]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=143</guid>
		<description><![CDATA[I have many servers that have applications that do not close connections properly or that use a connection pool. Sometimes I get a lot of sleeping connections that I want to kill. So here is a simple bash script you can use to kill the sleeping connections. #!/bin/bash user=&#38;lt;user name&#38;gt; pass=&#38;lt;password&#38;gt; for i in /tmp/*.sock [...]]]></description>
			<content:encoded><![CDATA[<p>I have many servers that have applications that do not close connections properly or that use a connection pool.  Sometimes I get a lot of sleeping connections that I want to kill. So here is a simple bash script you can use to kill the sleeping connections.</p>
<pre class="brush: bash;">
#!/bin/bash
user=&amp;lt;user name&amp;gt;
pass=&amp;lt;password&amp;gt;

for i in /tmp/*.sock ;
do
for j in $(mysql -u$user -p$pass -S $i  -e 'show processlist' | grep 'sleep' | awk '{print $1}' )
do
mysql -u$user -p$pass -S $i  -e &quot;kill $j&quot;
done
done</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2010/01/31/kill-long-sleeping-connections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transferring large files between servers</title>
		<link>http://www.mysqlhow2.com/2009/09/01/transferring-large-files-between-servers/</link>
		<comments>http://www.mysqlhow2.com/2009/09/01/transferring-large-files-between-servers/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 04:34:50 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[rebuild]]></category>
		<category><![CDATA[slave]]></category>
		<category><![CDATA[sync]]></category>
		<category><![CDATA[transfer]]></category>

		<guid isPermaLink="false">http://www.mysqlhow2.com/?p=97</guid>
		<description><![CDATA[In some of my environments I have to deal with large data sets that are well over 300GB. We have a master, a read only slave and a backup server. In order to rebuild one of the slaves I need to transfer data over the network. Many know doing this is time consuming and expensive, so I have done some benchmark tests to find the fastest possible way. I have tested 3 methods at this time to find a good solution, I will test a forth method this week and update this article to give you the results.
Our system runs on Linux and has a gig network connection so times may vary depending on your setup.]]></description>
			<content:encoded><![CDATA[<p><!-- @page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		A:link { so-language: zxx } --> <!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		A:link { so-language: zxx } -->In some of my environments I have to deal with large data sets that are well over 300GB. In this test I have a master, a read only slave and a backup server. In order to rebuild one of the slaves I need to transfer data over the network. Many know doing this is time consuming and expensive, so I have done some benchmark tests to find the fastest possible way. I have tested 3 methods at this time to find a good solution, I will test a forth method this week and update this article to give you the results.</p>
<p>Our system runs on Linux and has a gig network connection so times may vary depending on your setup.</p>
<p>First test was using <a href="%E2%80%9Dhttp://www.samba.org/rsync/%E2%80%9D" target="_blank"><strong>rsync</strong></a>. Using this method is great if you can recover with existing data as it can make the changes using incremental differences. If you are building from newer hardware or cannot use the existing data then the time is drastically longer. The first rsync will have to move the files over by using the scp method(later explained). You can use this method if you want to minimize downtime. You will need to set up ssh keys in order to proceed with rsync which I remove once the data transfer is complete. The step below are the tests I timed using this method.</p>
<p><em>1.Create a ssh key from the server running rsync<br />
ssh-keygen -t rsa<br />
2.cat the newly created key<br />
cat ~/.ssh/id_rsa_pub<br />
3.Copy the text and paste on the remote server.<br />
Vi /root/.ssh/authorized_keys<br />
4.Execute rsync on the server to be rebuilt<br />
/usr/bin/rsync -avzpogt –exclude=&#8221;*any files*&#8221; &#8211;delete -e ssh root@:/some/path* /some/path</em><br />
This test was conducted while MySQL is stopped(you can lock the tables dont forget to set wait_timout and interactive timeout to 28000).</p>
<p><strong>Timed Results first run<br />
<span style="color: #000000;"><span style="font-family: Verdana;"><span style="font-size: x-small;">real    677m28.259s<br />
user   228m48.514s<br />
sys     47m40.737s</span></span></span></strong></p>
<p><strong>Timed Results first (Final)</strong><strong><br />
<span style="color: #000000;"><span style="font-family: Verdana;"><span style="font-size: x-small;">real    2m21.259<br />
user   0m38.259s<br />
sys     1m00.252s</span></span></span></strong><br />
This test was conducted while MySQL was running, but you will need to stop MySQL on the final sync. I also uses an expect script to continue to run the rsync until I was ready to do the final transfer.</p>
<p><strong>Timed Results first run<br />
<span style="color: #000000;"><span style="font-family: Verdana;"><span style="font-size: x-small;">real    877m28.845s<br />
user   248m54.214s<br />
sys     30m22.231s</span></span></span></strong></p>
<p><strong><span style="color: #000000;"><span style="font-family: Verdana;"><span style="font-size: x-small;">expect average time</span></span></span></strong></p>
<p><strong><span style="color: #000000;"><span style="font-family: Verdana;"><span style="font-size: x-small;">real    48m32.156s<br />
user   22m59.781s<br />
sys     35m43.376s</span></span></span></strong></p>
<p><strong><span style="color: #000000;"><span style="font-family: Verdana;"><span style="font-size: x-small;">expect script ran until we locked table and ran the final </span></span></span></strong></p>
<p><strong><span style="color: #000000;"><span style="font-family: Verdana;"><span style="font-size: x-small;">real    22m45.101s<br />
user   8m09.563s<br />
sys     6m15.785s</span></span></span></strong></p>
<p>The second method was introduced to me by A friend of mine and his blog is <a href="%E2%80%9Dhttp://www.koopman.me/2008/11/tar-pipe-ssh/%E2%80%9D" target="_blank">Koopman.me</a> There are 2 methods and I chose the first one. With this method You will need to sop MySQL so transfer the files. This method will compress the files over the network and decompress on the remote host. Yes I could have used the lets tar up the data files on sending server, but this is expensive and will take time to do. Not to mention that you can run out of disk space quickly.</p>
<p>This is the basic commands:<br />
<em>A. tar cf – data files(*) | ssh user@remotehost &#8221; ( cd /some/path ; tar xf &#8211; ) &#8221;<br />
B. ssh user@remotehost &#8220;( cd /some/path ; tar cf – data file(*) ) &#8221; | tar xf -</em></p>
<p><strong>Timed Results:<br />
<span style="color: #000000;"><span style="font-family: Verdana;"><span style="font-size: x-small;">real    177m41.929s<br />
user   108m52.797s<br />
sys     47m40.737s</span></span></span></strong></p>
<p>The last method was using straight scp. This method is just like the first step of rsync, but simplified. Not a lot of explaining on this one.<br />
Command from the sending server.<br />
<em>scp data files(*) user@somehost:/some/path</em><br />
Please not that you will need to have ownership or a tmp directory on the remote server.</p>
<p><strong>Timed Results:<br />
<span style="color: #000000;"><span style="font-family: Verdana;"><span style="font-size: x-small;">real    599m48.729s<br />
user   203m52.992s<br />
sys     68m40.569s</span></span></span></strong></p>
<p>The next test to be conducted will be using scp with the -C flag for compression some state this will be the fastest. At this time the tar over ssh seems to be the fastest thanks koopman.me</p>
<p style="margin-bottom: 0in;">
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlhow2.com/2009/09/01/transferring-large-files-between-servers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->