<?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>Technology: Learn and Share &#187; innodb</title>
	<atom:link href="http://crazytoon.com/category/innodb/feed/" rel="self" type="application/rss+xml" />
	<link>http://crazytoon.com</link>
	<description>Enterprise level solutions, LAMP, Linux, Apache, MySQL, PHP, Perl, Windows, Cache, Optimization</description>
	<lastBuildDate>Fri, 16 Jul 2010 20:24:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MySQL: How do you install innotop to monitor innodb in real time?</title>
		<link>http://crazytoon.com/2008/05/21/mysql-how-do-you-install-innotop-to-monitor-innodb-in-real-time/</link>
		<comments>http://crazytoon.com/2008/05/21/mysql-how-do-you-install-innotop-to-monitor-innodb-in-real-time/#comments</comments>
		<pubDate>Wed, 21 May 2008 09:06:11 +0000</pubDate>
		<dc:creator>Sunny Walia</dc:creator>
				<category><![CDATA[Linux Apache MySQL PHP]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[innodb]]></category>
		<category><![CDATA[innotop]]></category>
		<category><![CDATA[mysql monitoring]]></category>

		<guid isPermaLink="false">http://crazytoon.com/?p=78</guid>
		<description><![CDATA[Innotop is a very useful tool to monitor innodb information in real time.  This tool is written by Baron Schwartz who is also an author of &#8220;High Performance MySQL, Second edition&#8221; book. [Side note: I highly recommend getting this book when it comes out (in June, 08?).  Other authors include: Peter Zaitsev, Jeremy [...]]]></description>
			<content:encoded><![CDATA[<p>Innotop is a very useful tool to monitor innodb information in real time.  This tool is written by Baron Schwartz who is also an author of &#8220;High Performance MySQL, Second edition&#8221; book. <small>[Side note: I highly recommend getting this book when it comes out (in June, 08?).  Other authors include: Peter Zaitsev, Jeremy Zawodny, Arjen Lentz, Vadim Tkachenko and Derek J. Balling.]</small> Quick summary of what innotop can monitor (from: http://innotop.sourceforge.net/):  InnoDB transactions and internals, queries and processes, deadlocks, foreign key errors, replication status, system variables and status and much more.</p>
<p>Following are the instructions on how to install innotop on CentOS x64/Fedora/RHEL (Redhat enterprise).  Most probably same instructions can be used on all flavors of Linux.  If not, leave me a comment and I will research a solution for you.  Let us start with downloading innotop.  I used version 1.6.0 which is the latest at the time of writing.</p>
<p><code>wget http://internap.dl.sourceforge.net/sourceforge/innotop/innotop-1.6.0.tar.gz</code></p>
<p>Now let us go ahead and unzip and create the MakeFile to get it ready for install</p>
<p><code>tar zxpf innotop-1.6.0.tar.gz<br />
cd innotop-1.6.0<br />
perl Makefile.PL</code></p>
<p>At this point if you get the following output, you are good to continue:</p>
<p><code>Checking if your kit is complete...<br />
Looks good<br />
Writing Makefile for innotop</code></p>
<p>If you get something similar to following, you will need to take care of the prerequisites:</p>
<p><code>Looks good<br />
Warning: prerequisite DBD::mysql 1 not found.<br />
Warning: prerequisite DBI 1.13 not found.<br />
Warning: prerequisite Term::ReadKey 2.1 not found.<br />
Writing Makefile for innotop</code></p>
<p>Just because they are warnings does not mean you ignore them.  So let us install those prerequisites.  We will use perl&#8217;s cpan shell to get this installed (visit my post on <a title="How do I install Perl modules? eg. Installing LWP module for Perl." href="http://crazytoon.com/2007/05/21/perl-how-do-i-install-perl-modules-eg-installing-lwp-module-for-perl/">how to install perl modules</a> for more details).  If it is your first time starting this up, you will have to answer some questions.  Defaults will work fine in all cases.</p>
<p><code>perl -MCPAN -eshell<br />
install Term::ReadKey<br />
install DBI<br />
install DBD::mysql</code></p>
<p>Note:  you must install DBI before you can install DBD::mysql.</p>
<p>If you get an error like following when you are installing DBD::mysql:</p>
<p><code>Error:  Can't load '/root/.cpan/build/DBD-mysql-4.007/blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.15: cannot open shared object file: No such file or directory at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DynaLoader.pm line 230.</code></p>
<p>You will have to create a symlink to the object file in your lib64 (or lib if you are not using x64 version) folder:</p>
<p><code>ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.15 /lib64/</code></p>
<p>Once all prerequisites are done, type  perl Makefile.PL and you should have no warnings.  Continue the install:</p>
<p><code>make install</code></p>
<p>At this point you should have innotop installed on your system.  Let us do some quick set up so you can start using innotop.  We start with configuring your .my.cnf to include connection directives.<br />
<code><br />
vi ~/.my.cnf</code></p>
<p>Add the following (edit to reflect your install) and save/exit</p>
<p><code>[mysql]<br />
port            = 3306<br />
socket          = /tmp/mysql.sock</code></p>
<p>Start up innotop by typing innotop at your shell prompt.  First prompt will ask you to &#8220;Enter a name:&#8221;.  I just put localhost since this will be used to connect locally.  Next prompt asks you about DSN entry.  I use:  DBI:mysql:;mysql_read_default_group=mysql</p>
<p>This tells innotop to read .my.cnf file and use group [mysql] directives.  Next prompt is optional (I just press enter).  Next two prompts you enter information if you need to.</p>
<p>At this point your innotop installation / testing is complete.  You can read <a title="man innotop - Man page for innotop" href="http://www.lamp-tips.com/man-pages/innotop/" target="_blank">man innotop</a> to get more details on how to use innotop.</p>
<p>————————————-<br />
<small>DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. <strong>Use at your own risk</strong>.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://crazytoon.com/2008/05/21/mysql-how-do-you-install-innotop-to-monitor-innodb-in-real-time/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL:  ibdata files do not shrink on database deletion [innodb]</title>
		<link>http://crazytoon.com/2007/04/03/mysql-ibdata-files-do-not-shrink-on-database-deletion-innodb/</link>
		<comments>http://crazytoon.com/2007/04/03/mysql-ibdata-files-do-not-shrink-on-database-deletion-innodb/#comments</comments>
		<pubDate>Tue, 03 Apr 2007 23:07:03 +0000</pubDate>
		<dc:creator>Sunny Walia</dc:creator>
				<category><![CDATA[Data Backup]]></category>
		<category><![CDATA[Enterprise level solutions]]></category>
		<category><![CDATA[Linux System]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[MySQL backup]]></category>
		<category><![CDATA[System admin]]></category>
		<category><![CDATA[innodb]]></category>

		<guid isPermaLink="false">http://crazytoon.com/2007/04/03/mysql-ibdata-files-do-not-shrink-on-database-deletion-innodb/</guid>
		<description><![CDATA[One very interesting thing I noticed with MySQL was that if you delete a database, ibdata file doesn&#8217;t shrink by that much space to minimize disk usage.  I deleted the database and checked usage of /usr/local/mysql/var folder and noticed that ibdata file is still the same size.  So the problem I face now [...]]]></description>
			<content:encoded><![CDATA[<p>One very interesting thing I noticed with MySQL was that if you delete a database, ibdata file doesn&#8217;t shrink by that much space to minimize disk usage.  I deleted the database and checked usage of /usr/local/mysql/var folder and noticed that ibdata file is still the same size.  So the problem I face now is, how do I claim back this space?</p>
<p>After searching for a bit on google about this problem, apparently only way you can do that is by exporting your mysql databases, delete ibdata1 file, import databases.  This creates new ibdata file with correct space usage.  Atleast there is a way to get around this issue.  But honestly, too much pain on production boxes where we might be trying to remove old databases to reclaim some of the hard drive space.</p>
<p>An preventive measure one can use is to use option: <code>innodb_file_per_table</code> (&#8216;put innodb_file_per_table&#8217; in your my.cnf file under [mysqld] section).  This will create individual files for tables under database directory.  So now when I delete the database, all the space is returned since the directory is now deleted along with database along with all the tables inside the directory.  In my test after you put option <code>innodb_file_per_table </code>your my.cnf, you will have to still do export/import to be able to minimize disk usage and have the ability to delete database at your leisure without worrying about reclaiming the disk space.  Here are the steps I took.  DISCLAIMER:  Please make backup of your data and use following steps at your own risk.  Doing it on test server is <strong>HIGHLY</strong> recommended.  Please don&#8217;t come back and tell me that you lost your data because you followed my steps.  They work for <em>me</em> and they <em>may not </em>work for <em>you</em>!</p>
<p>That said, here are the steps:</p>
<ol>
<li>Add  <code>innodb_file_per_table </code>in your my.cnf file under [mysqld] section</li>
<li>run following commands at the prompt.  Your path to binaries might be different.</li>
<p><code>#note:  following assumes you are logged in as root<br />
mkdir -p /temp  #temp dir to save our sql dump<br />
#lets make a backup of current database. -p is used if there is pw set<br />
/usr/local/mysql/bin/mysqldump -R -q -p --all-databases &gt; /temp/all.sql<br />
#stop mysql so we can remove all the files in the dir<br />
/etc/init.d/mysql stop<br />
rm -fr /usr/local/mysql/var/* #remove all the files<br />
/usr/local/mysql/bin/mysql_install_db  #install default dbs<br />
#change ownership so mysql user can read/write to/from files<br />
chown -R mysql.mysql /usr/local/mysql/var/<br />
#start mysql so we can import our dump<br />
/etc/init.d/mysql start<br />
#note there is no -p since defaults don't have mysql pw set<br />
/usr/local/mysql/bin/mysql &lt; /temp/all.sql<br />
/etc/init.d/mysql restart</code></ol>
<p>This should be all you need to do.  At this point when you remove a database, it will delete the directory of the db and all the data contained within which in turn will give you your disk space back.</p>
<p>REMEMBER:  <strong>Backup your data</strong> and be smart about using code found on internet.  If you don&#8217;t know what you are doing, hire a consultant who does.</p>
]]></content:encoded>
			<wfw:commentRss>http://crazytoon.com/2007/04/03/mysql-ibdata-files-do-not-shrink-on-database-deletion-innodb/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
	</channel>
</rss>
