<?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>Hostmedic &#187; MySQL</title>
	<atom:link href="http://www.hostmedic.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hostmedic.com</link>
	<description>Emergency Medicine for Hosting &#38; Server Admins</description>
	<lastBuildDate>Sat, 24 Sep 2011 04:51:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>MySQL Cluster Bandwidth Relief</title>
		<link>http://www.hostmedic.com/admin/open-source-solutions/mysql-cluster-bandwidth-relief/</link>
		<comments>http://www.hostmedic.com/admin/open-source-solutions/mysql-cluster-bandwidth-relief/#comments</comments>
		<pubDate>Sat, 15 May 2010 04:34:02 +0000</pubDate>
		<dc:creator>Glenn Kelley</dc:creator>
				<category><![CDATA[cPanel]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Network Admin]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[WISP]]></category>
		<category><![CDATA[mysql bandwidth]]></category>
		<category><![CDATA[mysql cluster]]></category>
		<category><![CDATA[slave_compressed_protocol setting]]></category>

		<guid isPermaLink="false">http://www.hostmedic.com/?p=835</guid>
		<description><![CDATA[I have been toying with having offsite backups for our MySQL databases -  The idea is &#8211; all data could be offsite in case of a major fire or another issue. I setup a radio link between our new office and our old using a Ubiquity NanoStation &#8211; and the bandwidth is Awesome &#8211; however&#8230; [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.hostmedic.com%2Fadmin%2Fopen-source-solutions%2Fmysql-cluster-bandwidth-relief%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.hostmedic.com%2Fadmin%2Fopen-source-solutions%2Fmysql-cluster-bandwidth-relief%2F&amp;source=churchmedic&amp;style=normal&amp;service=TinyURL.com&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div>
<p>I have been toying with having offsite backups for our MySQL databases -  The idea is &#8211; all data could be offsite in case of a major fire or another issue.</p>
<p>I setup a radio link between our new office and our old using a Ubiquity NanoStation &#8211; and the bandwidth is Awesome &#8211; however&#8230; so is the amount of informaiton.</p>
<p>MySQL replication however &#8211; as its nature is &#8211; any Insert, Update,  or Delete statements are written to the binary log,  then sent from the  master server in the datacenter to our new office.</p>
<p>I have been running this setup now for a short time &#8211; however I noticed today &#8211; that the slave server has been crawling &#8211; and unable to keep up.  So &#8211; in hunting &#8211; I cound that there is a sizable amount of bandwidth flowing between the two &#8211; not counting the other file backups going over the same link.</p>
<p>It seems that there is not enough bandwidth over this radio link to keep up with the replication&#8230; After a bit of hunting -  I found the<a href="http://dev.mysql.com/doc/refman/5.0/en/replication-options.html"> slave_compressed_protocol  setting</a> in MySQL which allows the master and slave to compress the  replication data between the two servers exists..    After enabling that, the  slave was able to catch up within a matter of minutes and has stayed  caught up just fine.    The bandwidth usage has dropped a huge amount.    Next is coming the SSH compression &#8211; and I think the logs &#8211; which go through the SSH tunnel will most likely have similar success.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.hostmedic.com/admin/open-source-solutions/mysql-cluster-bandwidth-relief/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Dump to another server</title>
		<link>http://www.hostmedic.com/admin/operating_systems/linux-operating_systems/mysql-dump-to-another-server/</link>
		<comments>http://www.hostmedic.com/admin/operating_systems/linux-operating_systems/mysql-dump-to-another-server/#comments</comments>
		<pubDate>Sat, 15 May 2010 04:14:36 +0000</pubDate>
		<dc:creator>Glenn Kelley</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[dump]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.hostmedic.com/?p=832</guid>
		<description><![CDATA[Recently &#8211; while doing some work for COR.org &#8211; I was asked how to dump a database from one server to another&#8230; (mysql) The first thought was to run mysqldump dump on the destination machine, and to access the database over the network. That however, doesn’t compress or encrypt the data. Plus I would have [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.hostmedic.com%2Fadmin%2Foperating_systems%2Flinux-operating_systems%2Fmysql-dump-to-another-server%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.hostmedic.com%2Fadmin%2Foperating_systems%2Flinux-operating_systems%2Fmysql-dump-to-another-server%2F&amp;source=churchmedic&amp;style=normal&amp;service=TinyURL.com&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div>
<p>Recently &#8211; while doing some work for COR.org &#8211; I was asked how to dump a database from one server to another&#8230; (mysql)</p>
<p>The first thought was to run  mysqldump dump on the destination machine, and to access the database  over the network.  That however, doesn’t compress or encrypt the data.   Plus I would have had to create a mysql user with permission to access  the database remotely.</p>
<p>The solution used instead worked out  well: mysqldump directly to the remote host with this command:</p>
<pre>mysqldump &lt;DATABASE_NAME&gt; [mysqldump options] | gzip -c | ssh user@remotehost "cat &gt; /path/to/some-file.sql.gz"
</pre>
<p>In short &#8211; this method pipes the mysqldump command through gzip, then to through  and SSH connection.  SSH on the remote side runs the ‘cat’ command to  read the stdin, then redirects that to the actual file where you want it  saved.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.hostmedic.com/admin/operating_systems/linux-operating_systems/mysql-dump-to-another-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Master &#8211; Slave Replication</title>
		<link>http://www.hostmedic.com/admin/systems-administration/database_administration/master-slave-replication/</link>
		<comments>http://www.hostmedic.com/admin/systems-administration/database_administration/master-slave-replication/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 01:51:20 +0000</pubDate>
		<dc:creator>Glenn Kelley</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[citrt]]></category>
		<category><![CDATA[debugging mysql]]></category>
		<category><![CDATA[master]]></category>
		<category><![CDATA[master-slave]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[replication]]></category>
		<category><![CDATA[slave]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[typo3 tuning]]></category>
		<category><![CDATA[Web 2.0 minus or plus]]></category>

		<guid isPermaLink="false">http://churchmedic.com/?p=379</guid>
		<description><![CDATA[There are many reasons to use master-slave replication including but not limited to: 1) Offload some of the queries from one server to another thus helping spread the load: One of the biggest advantages to have master-slave set up in MySQL is to be able to use master for all of the inserts and send [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.hostmedic.com%2Fadmin%2Fsystems-administration%2Fdatabase_administration%2Fmaster-slave-replication%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.hostmedic.com%2Fadmin%2Fsystems-administration%2Fdatabase_administration%2Fmaster-slave-replication%2F&amp;source=churchmedic&amp;style=normal&amp;service=TinyURL.com&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>There are many reasons to use master-slave replication including but not limited to:</p>
<p>1) Offload some of the queries from one server to another thus helping spread the load: One of the biggest advantages to have master-slave set up in MySQL is to be able to use master for all of the inserts and send some, if not all, select queries to a slave (or even a series of slaves). This will most probably speed up your application without having to diving into optimizing all the queries or buying more hardware-  This is especially handy if your using some off the shelf application such as <a href="http://www.webempoweredchurch.com">WebEmpoweredChurch.com</a> / <a href="http://www.typo3usa.com">Typo3</a>,  Magento , WordPress, Drupal, etc . . .</p>
<p>2) Backups can hurt a DB server @ times.   Here @ Typo3USA &#8211; We always Do backups from slave.  Most techs simply just overlook this simple but highly effective advantage.   We have some databases that are quite large &#8211; super large and others that are just a few megs &#8211; to a few gigs.   Sadly &#8211; when the size of a database becomes a big deal is when it has grown to multiple gigs and mysqldump causes the site to lag when it locks tables.  For some sites, this could mean that site goes down for few secs to minutes. If you have slave, you just take slave out of rotation (we have built this into our backup scripts now) and run backups off the slave. You can even stop slave MySQL instance and copy the /etc/mysql/mysql or /var/lib/mysql  (or whatever your database directory ) folder instead of doing mysqldump&#8230;</p>
<p>Recently &#8211; we moved forward into using the <a href="http://www.r1soft.com" target="_blank">R1Soft.com Backup System</a> (in fact we also had a good hand with the Vine Staff and Ron Hall in building up their new website &#8211; check it out @ www.R1soft.com ) WE ABSOLUTELY LOVE THIS SYSTEM BECAUSE IT IS SO FAST IN ITS BACKUPS FOR MYSQL</p>
<p>Ok let us dive into how to setup master-slave replication under MySQL. There are many configuration changes you can do to optimize your MySQL set up. I will just touch on very basic ones to get the replication to work. Here are some assumptions:</p>
<blockquote><p>Master server ip:  10.100.1.1<br />
Slave server ip:  10.100.1.2<br />
Slave username:  slavemysqluser<br />
Slave pw:  slavepw<br />
Your data directory is:  /usr/local/mysql/var/</p></blockquote>
<p>Put the following in your master my.cnf file under [mysqld] section:</p>
<p style="padding-left: 30px;"><code># changes made to do master<br />
server-id           = 1<br />
relay-log           = /usr/local/mysql/var/mysql-relay-bin<br />
relay-log-index     = /usr/local/mysql/var/mysql-relay-bin.index<br />
log-error           = /usr/local/mysql/var/mysql.err<br />
master-info-file    = /usr/local/mysql/var/mysql-master.info<br />
relay-log-info-file = /usr/local/mysql/var/mysql-relay-log.info<br />
datadir             = /usr/local/mysql/var<br />
log-bin             = /usr/local/mysql/var/mysql-bin<br />
# end master</code></p>
<p>Copy the following to slave’s my.cnf under [mysqld] section:</p>
<p style="padding-left: 30px;"><code># changes made to do slave<br />
server-id           = 2<br />
relay-log           = /usr/local/mysql/var/mysql-relay-bin<br />
relay-log-index     = /usr/local/mysql/var/mysql-relay-bin.index<br />
log-error           = /usr/local/mysql/var/mysql.err<br />
master-info-file    = /usr/local/mysql/var/mysql-master.info<br />
relay-log-info-file = /usr/local/mysql/var/mysql-relay-log.info<br />
datadir             = /usr/local/mysql/var<br />
# end slave setup</code></p>
<p style="padding-left: 30px;">Create user on master:<br />
<code>mysql&gt; grant replication slave on *.* to slavemysqluser@'10.100.1.2' identified by 'slavepw';</code></p>
<p style="padding-left: 30px;">Do a dump of data to move to slave<br />
<code>mysqldump -u root --all-databases --single-transaction --master-data=1 &gt; masterdump.sql</code></p>
<p style="padding-left: 30px;">import dump on slave<br />
<code>mysql &lt; masterdump.sql</code></p>
<p style="padding-left: 30px;">After dump is imported go in to mysql client by typing mysql. Let us tell the slave which master to connect to and what login/password to use:<br />
<code>mysql&gt; CHANGE MASTER TO MASTER_HOST='10.100.1.1',  MASTER_USER='slaveuser', MASTER_PASSWORD='slavepw';</code></p>
<p style="padding-left: 30px;">Let us start the slave:<br />
<code>mysql&gt; start slave;</code></p>
<p style="padding-left: 30px;">You can check the status of the slave by typing<br />
<code>mysql&gt; show slave status\G</code></p>
<p>The last command will let you know how up to date the slave is from the master in seconds.  I have had many folks worry about this being behind the master &#8211; it is okay if it does not say ZERO right away &#8211; if you check it you should see the number going down over time until it finally catchs up with the master.</p>
<p>NOTE* if it shows NULL, &#8211; it could be that the slave has not started or that it has an error:  (if this is the case it should show up in Last_errno; and Last_error under the: show slave status\G )</p>
<p>We suggest a number of different tools as well for MySQL including:</p>
<p><strong>Maatkit</strong><br />
<a href="http://www.maatkit.org/">Maatkit</a> is a great set of tools for MySQL Performance Analyses and maintainence.  Must know and have for any MySQL User.</p>
<p><strong>mysqladmin </strong><br />
<em>mysqladmin extended -i100 -r</em> is very nice way to look how MySQL performance counters increment and it can tell you a lot about server run status.</p>
<p><strong>mysqlreport</strong><br />
<a href="http://hackmysql.com/mysqlreport">MySQL Report</a> is a tool which would look at status variables same as <em>mysqladmin extended</em> but will group them together nicely and provide some hints on what are good and bad values.</p>
<p><strong>mysqlsla</strong><br />
This is nice tool to analyze slow query log. It reads bunch of different log formats and has various stats, and it was there before <em>mk-log-parser </em> appeared.</p>
<p><strong>innotop </strong><br />
<a href="http://sourceforge.net/projects/innotop">Innotop</a> is great top like tool for MySQL and is helpful even if you do not use Innodb tables. Very nice to watch what happens to server in the real time.</p>
<p><strong>oprofile</strong><br />
<a href="http://oprofile.sourceforge.net/about/">oprofile</a> is usually used for advanced MySQL tuning when the load is CPU bound – it will tell you where exactly inside MySQL or Kernel CPU time is spent.</p>
<p><strong>iohist</strong><br />
<a href="http://jcole.us/software/iohist/iohist.pl">iohist</a> is a little tool to show histogram for IO response time. The main use for it is to see how response time is split for read and write request rather than seeing the average reported by iostat. These can be very different.</p>
<p><strong>sysbench</strong><br />
<a href="http://sysbench.sf.net/">sysbench</a> is a tool to check performance of system and MySQL. Helpful to check different hardware and OS characteristic.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hostmedic.com/admin/systems-administration/database_administration/master-slave-replication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

