<?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>Geert JM Vanderkelen</title>
	<atom:link href="http://geert.vanderkelen.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://geert.vanderkelen.org</link>
	<description>#$%!#€</description>
	<lastBuildDate>Fri, 04 May 2012 05:05:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>MySQL Connector/Python bugs reports on bugs.mysql.com</title>
		<link>http://geert.vanderkelen.org/post/843/</link>
		<comments>http://geert.vanderkelen.org/post/843/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 10:26:11 +0000</pubDate>
		<dc:creator>Geert Vanderkelen</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[myconnpy]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://geert.vanderkelen.org/?p=843</guid>
		<description><![CDATA[We have moved bugs for MySQL Connector/Python from Launchpad to the MySQL Bugs website http://bugs.mysql.com. Reports which are (probably) fixed in newer code were not taken with. If there is a bug which you really want to get tracked: please report it again. Please use the MySQL Bugs website to report problems using MySQL Connector/Python. [...]]]></description>
			<content:encoded><![CDATA[<p>We have moved bugs for MySQL Connector/Python from <a href="https://bugs.launchpad.net/myconnpy/" target="_blank">Launchpad</a> to the <a href="http://bugs.mysql.com" target="_blank">MySQL Bugs website</a> http://bugs.mysql.com. Reports which are (probably) fixed in newer code were not taken with. If there is a bug which you really want to get tracked: <a href="http://bugs.mysql.com/report.php" target="_blank">please report</a> it again.</p>
<p>Please use the MySQL Bugs website to report problems using MySQL Connector/Python. To see a list of active reports, <a href="http://bugs.mysql.com/search.php?cmd=display&amp;bug_type[]=Connector%2FPython&amp;status[]=Active&amp;os=0&amp;bug_age=0&amp;priority=all&amp;limit=30&amp;defect_class=all&amp;workaround_viability=all&amp;impact=all&amp;fix_risk=all&amp;fix_effort=all" target="_blank">click here</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgeert.vanderkelen.org%2Fpost%2F843%2F&amp;title=MySQL%20Connector%2FPython%20bugs%20reports%20on%20bugs.mysql.com" id="wpa2a_2"><img src="http://geert.vanderkelen.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://geert.vanderkelen.org/post/843/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic reconnect in MySQL Connector/Python?</title>
		<link>http://geert.vanderkelen.org/post/842/</link>
		<comments>http://geert.vanderkelen.org/post/842/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 16:22:38 +0000</pubDate>
		<dc:creator>Geert Vanderkelen</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[myconnpy]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://geert.vanderkelen.org/?p=842</guid>
		<description><![CDATA[There have been some request to have some reconnect possibilities in Connector/Python. I&#8217;m wondering now whether there should be some automatic reconnect on certain errors within the database driver. My personal feeling is to have no automatic reconnect within Connector/Python and the programmer has to come up with retrying transactions herself. For example: The above [...]]]></description>
			<content:encoded><![CDATA[<p>There have been some request to have some reconnect possibilities in <a href="http://launchpad.net/myconnpy" target="_blank">Connector/Python</a>. I&#8217;m wondering now whether there should be some automatic reconnect on certain errors within the database driver.</p>
<p>My personal feeling is to have no automatic reconnect within Connector/Python and the programmer has to come up with retrying transactions herself.</p>
<p>For example:</p>
<pre class="brush: python; title: (double click text to copy/paste); notranslate">
	cnx.disconnect() # For testing..
	tries = 2
	while tries &gt; 0:
		tries -= 1
		try:
			cursor.execute(&quot;INSERT INTO t1 (c1) VALUES ('ham')&quot;)
			cnx.commit()
		except mysql.connector.InterfaceError:
			if tries == 0:
				print &quot;Failed inserting data after retrying&quot;
				break
			else:
				print &quot;Reconnecting..&quot;
				cnx.reconnect()
		else:
			break
</pre>
<p>The above mimics how you would handle transactions and trying them reconnecting. I have ideas how to get this into Connector/Python, but it would not really fit <a href="http://www.python.org/dev/peps/pep-0249/" target="_blank">PEP-249</a>.</p>
<p>Would the above use case of reconnecting be enough?</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgeert.vanderkelen.org%2Fpost%2F842%2F&amp;title=Automatic%20reconnect%20in%20MySQL%20Connector%2FPython%3F" id="wpa2a_4"><img src="http://geert.vanderkelen.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://geert.vanderkelen.org/post/842/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>MySQL Connector/Python available through the Python Package Index</title>
		<link>http://geert.vanderkelen.org/post/825/</link>
		<comments>http://geert.vanderkelen.org/post/825/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 11:33:10 +0000</pubDate>
		<dc:creator>Geert Vanderkelen</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[myconnpy]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://geert.vanderkelen.org/?p=825</guid>
		<description><![CDATA[Today we registered MySQL Connector/Python with the Python Package Index (PyPI). It makes installing your favorite connector even easier (provided you first install setuptools or pip): Please report problems either using Launchpad or MySQL Bugs website.]]></description>
			<content:encoded><![CDATA[<p>Today we registered <a href="http://launchpad.net/myconnpy">MySQL Connector/Python</a> with the <a href="http://pypi.python.org/pypi/MySQL-Connector/">Python Package Index</a> (PyPI). It makes installing your favorite connector even easier (provided you first install <a href="http://pypi.python.org/pypi/setuptools">setuptools</a> or <a href="http://pip-installer.org">pip</a>):</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
shell&gt; easy_install mysql-connector
shell&gt; pip install mysql-connector
</pre>
<p>Please report problems either using <a href="https://bugs.launchpad.net/myconnpy">Launchpad</a> or <a href="http://bugs.mysql.com">MySQL Bugs website</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgeert.vanderkelen.org%2Fpost%2F825%2F&amp;title=MySQL%20Connector%2FPython%20available%20through%20the%20Python%20Package%20Index" id="wpa2a_6"><img src="http://geert.vanderkelen.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://geert.vanderkelen.org/post/825/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>MySQL Connector/Python bug category on bugs.mysql.com</title>
		<link>http://geert.vanderkelen.org/post/819/</link>
		<comments>http://geert.vanderkelen.org/post/819/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 18:38:11 +0000</pubDate>
		<dc:creator>Geert Vanderkelen</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[myconnpy]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://geert.vanderkelen.org/?p=819</guid>
		<description><![CDATA[In addition to reporting MySQL Connector/Python bugs on Launchpad, it is now also possible to enter them using http://bugs.mysql.com.]]></description>
			<content:encoded><![CDATA[<p>In addition to reporting <a href="http://launchpad.net/myconnpy" target="_blank">MySQL Connector/Python</a> bugs on Launchpad, it is now also possible to enter them using <a href="http://bugs.mysql.com" target="_blank">http://bugs.mysql.com</a>.</p>
<p><img alt="" src="http://geert.vanderkelen.org/media/MyConnPy_BugsMySQLCom.png" class="aligncenter" width="305" height="109" /></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgeert.vanderkelen.org%2Fpost%2F819%2F&amp;title=MySQL%20Connector%2FPython%20bug%20category%20on%20bugs.mysql.com" id="wpa2a_8"><img src="http://geert.vanderkelen.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://geert.vanderkelen.org/post/819/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My New Job at Oracle: Working on MySQL Connector/Python</title>
		<link>http://geert.vanderkelen.org/post/817/</link>
		<comments>http://geert.vanderkelen.org/post/817/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 09:55:46 +0000</pubDate>
		<dc:creator>Geert Vanderkelen</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[myconnpy]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://geert.vanderkelen.org/?p=817</guid>
		<description><![CDATA[After more than 6 years doing MySQL Support for MySQL AB, Sun Microsystems, and Oracle, it&#8217;s time for a change. Time to get back to development! As of November 2011 I&#8217;ll be working full-time on MySQL Connector/Python and other goodies within the MySQL development team at Oracle. Before, this was more or less a pet [...]]]></description>
			<content:encoded><![CDATA[<p>After more than 6 years doing MySQL Support for <a href="http://www.mysql.com">MySQL</a> AB, <a href="http://en.wikipedia.org/wiki/Sun_Microsystems">Sun Microsystems</a>, and <a href="http://www.oracle.com">Oracle</a>, it&#8217;s time for a change. Time to get back to development!</p>
<p>As of November 2011 I&#8217;ll be working full-time on <a href="http://launchpad.net/myconnpy">MySQL Connector/Python</a> and other goodies within the MySQL development team at Oracle. Before, this was more or less a pet project done after working hours. However, with the <a href="http://geert.vanderkelen.org/post/245/">birth of our son Tomas</a> more than a year ago, I&#8217;ve been slacking and family got priority.</p>
<p>The idea is to make MySQL Connector/Python the best choice for connecting to MySQL from within your <a href="http://python.org">Python</a> code. We still got a long road ahead of us, but I&#8217;m confident that we are on the right track.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgeert.vanderkelen.org%2Fpost%2F817%2F&amp;title=My%20New%20Job%20at%20Oracle%3A%20Working%20on%20MySQL%20Connector%2FPython" id="wpa2a_10"><img src="http://geert.vanderkelen.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://geert.vanderkelen.org/post/817/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Debugging MySQL Cluster installed using RPMs using gdb</title>
		<link>http://geert.vanderkelen.org/post/807/</link>
		<comments>http://geert.vanderkelen.org/post/807/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 14:22:52 +0000</pubDate>
		<dc:creator>Geert Vanderkelen</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://geert.vanderkelen.org/?p=807</guid>
		<description><![CDATA[This post explains how to debug MySQL Cluster 7.1, installed using the RPM packages, using gdb on a Linux box (Red Hat, Oracle Enterprise Linux, CentOS, ..). When a data node crashes lots of information goes into the error log, trace files and out log. However, it makes sometimes sense when you can repeat the [...]]]></description>
			<content:encoded><![CDATA[<p>This post explains how to debug <a href="http://dev.mysql.com/downloads/cluster/">MySQL Cluster 7.1</a>, installed using the <a href="http://rpm5.org/">RPM</a> packages, using gdb on a Linux box (Red Hat, Oracle Enterprise Linux, CentOS, ..).</p>
<p>When a data node crashes lots of information goes into the error log, trace files and out log. However, it makes sometimes sense when you can repeat the crash, to run the data node in debug mode, or using gdb.</p>
<p>First, using RPMs and a Linux distribution, <strong>make sure you have the &#8216;debuginfo&#8217; package installed</strong>. For example, for Red Hat or Oracle Enterprise Linux on a 64-bit machine, this package would be called: MySQL-Cluster-gpl-debuginfo-7.1.15-1.rhel5.x86_64.rpm .</p>
<p><strong>Create a file with the following commands</strong>, we will name it &#8216;ndbd.gdb&#8217;:</p>
<pre class="brush: plain; title: (double click text to copy/paste); notranslate">
set pagination off
set logging overwrite on
set logging file ndbd_gdb_backtrace.txt
set logging on
run --foreground -c &lt;YourMGM:1186&gt; --ndb-nodeid=&lt;YourID&gt;
thread apply all bt
set logging off
</pre>
<p><strong>Note line 5</strong>: pass the options to &#8216;run&#8217; which you usually pass when starting ndbd, but leave the &#8211;foreground option.<br />
Note line 3: you can save of course the logging file wherever you want to.</p>
<p>Then all you need to do is <strong>run gdb with the commands file and the ndbd binary</strong> you just created:</p>
<pre class="brush: bash; title: (double click text to copy/paste); notranslate">
shell&gt; gdb /usr/sbin/ndbd -x ndbd.gdb
</pre>
<p>A full backtrace of threads will be available in the logging file when ndbd crashes. This you can then upload when reporting <a href="http://bugs.mysql.com">bugs</a>.</p>
<p>There are probably more options and things you can do, please post them in the comments!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgeert.vanderkelen.org%2Fpost%2F807%2F&amp;title=Debugging%20MySQL%20Cluster%20installed%20using%20RPMs%20using%20gdb" id="wpa2a_12"><img src="http://geert.vanderkelen.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://geert.vanderkelen.org/post/807/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL Cluster: Rotating the log file of the Data Nodes</title>
		<link>http://geert.vanderkelen.org/post/697/</link>
		<comments>http://geert.vanderkelen.org/post/697/#comments</comments>
		<pubDate>Mon, 02 May 2011 11:34:15 +0000</pubDate>
		<dc:creator>Geert Vanderkelen</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://geert.vanderkelen.org/?p=697</guid>
		<description><![CDATA[There is a log file called ndb_&#60;NodeID&#62;_out.log created by the MySQL Cluster data nodes which can become quite big overtime. There is, unlike the cluster logs created by the management nodes, no rotation build in. So you have to revert to the basics and copy the file away, truncating the old one. For example, if [...]]]></description>
			<content:encoded><![CDATA[<p>There is a log file called <tt>ndb_&lt;NodeID&gt;_out.log</tt> created by the <a href="http://www.mysql.com/products/cluster/">MySQL Cluster</a> data nodes which can become quite big overtime. There is, unlike the cluster logs created by the management nodes, no rotation build in. So you have to revert to the basics and copy the file away, truncating the old one.</p>
<p>For example, if you want to &#8216;rotate&#8217; the log file of data node with NodeID 3:</p>
<pre class="brush: bash; title: (double click text to copy/paste); notranslate">
shell&gt; mv ndb_3_out.log.1.gz ndb_3_out.log.2.gz
shell&gt; cp ndb_3_out.log ndb_3_out.log.1
shell&gt; cat /dev/null &gt; ndb_3_out.log
shell&gt; gzip ndb_3_out.log.1
</pre>
<p>It&#8217;s not elegant, and you might lose some entries, but it will help you keeping disk usage minimal. If you don&#8217;t need the log at all, just line 3 would do the trick.</p>
<p>You can use <a href="http://www.google.com/search?q=linux+logrotate">logrotate</a>&#8216;s <em>copytruncate</em> to achieve something similar.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgeert.vanderkelen.org%2Fpost%2F697%2F&amp;title=MySQL%20Cluster%3A%20Rotating%20the%20log%20file%20of%20the%20Data%20Nodes" id="wpa2a_14"><img src="http://geert.vanderkelen.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://geert.vanderkelen.org/post/697/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Refactored: Poor man’s MySQL replication monitoring</title>
		<link>http://geert.vanderkelen.org/post/678/</link>
		<comments>http://geert.vanderkelen.org/post/678/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 06:53:01 +0000</pubDate>
		<dc:creator>Geert Vanderkelen</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[myconnpy]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://geert.vanderkelen.org/?p=678</guid>
		<description><![CDATA[This is a reply to the blog post Poor man’s MySQL replication monitoring. Haidong Ji had a few problems using MySQLdb (could use the &#8216;dict&#8217; cursor) and apparently he doesn&#8217;t want to much dependencies. I agree that using the mysql client tool is a nice alternative if you don&#8217;t want to use any 3rd party [...]]]></description>
			<content:encoded><![CDATA[<p>This is a reply to the blog post <a href="http://www.haidongji.com/2011/04/06/poor-mans-mysql-replication-monitoring/">Poor man’s MySQL replication monitoring</a>. Haidong Ji had a few problems using <a href="http://sourceforge.net/projects/mysql-python/files/">MySQLdb</a> (could use the &#8216;dict&#8217; cursor) and apparently he doesn&#8217;t want to much dependencies. I agree that using the <tt><a href="http://dev.mysql.com/doc/refman/5.5/en/mysql.html">mysql</a></tt> client tool is a nice alternative if you don&#8217;t want to use any 3rd party <a href="http://python.org">Python</a> modules. And the <a href="http://dev.mysql.com">MySQL</a> client tools are usually and should be installed with the server.</p>
<p>However, since <a href="http://launchpad.net/myconnpy">MySQL Connector/Python</a> only needs itself and Python, dependencies are reduced to a minimum. Here you&#8217;ll find a refactored version of Haidong&#8217;s version (can of course be made much more sophisticated) using the connector:</p>
<pre class="brush: python; title: (double click text to copy/paste); notranslate">
import sys
from socket import gethostname
import smtplib
import mysql.connector

emailSubject = &quot;Replication problem on slave %s&quot;
emailTo = &quot;recipient@example.com&quot;
emailFrom = &quot;monitor-tool@example.com&quot;

def runCmd(cmd):
    cnx = mysql.connector.connect(user='root',
                                  unix_socket='/path/to/mysql.sock')
    cur = cnx.cursor(buffered=True)
    cur.execute(cmd)
    columns = tuple( [d[0].decode('utf8') for d in cur.description] )
    row = cur.fetchone()
    if row is None:
        raise StandardError(&quot;MySQL Server not configured as Slave&quot;)
    result = dict(zip(columns, row))
    cur.close()
    cnx.close()
    return result

try:
    slave_status = runCmd(&quot;SHOW SLAVE STATUS&quot;)
except mysql.connector.Error, e:
    print &gt;&gt; sys.stderr, &quot;There was a MySQL error:&quot;, e
    sys.exit(1)
except StandardError, e:
    print &gt;&gt; sys.stderr, &quot;There was an error:&quot;, e
    sys.exit(1)

if (slave_status['Slave_IO_Running'] == 'Yes' and
    slave_status['Slave_SQL_Running'] == 'Yes' and
    slave_status['Last_Errno'] == 0):
    print &quot;Cool&quot;
else:
    emailBody = [
        &quot;From: %s&quot; % emailFrom,
        &quot;To: %s&quot; % emailTo,
        &quot;Subject: %s&quot; % (emailSubject %  gethostname()),
        &quot;&quot;,
        '\n'.join([ k + ' : ' + str(v) for k,v in slave_status.iteritems()]),
        &quot;\r\n&quot;,
        ]
    server = smtplib.SMTP(&quot;localhost&quot;)
    server.sendmail(emailFrom, [emailTo], '\r\n'.join(emailBody))
    server.quit()
</pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgeert.vanderkelen.org%2Fpost%2F678%2F&amp;title=Refactored%3A%20Poor%20man%E2%80%99s%20MySQL%20replication%20monitoring" id="wpa2a_16"><img src="http://geert.vanderkelen.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://geert.vanderkelen.org/post/678/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Custom logger for your MySQL Cluster data nodes</title>
		<link>http://geert.vanderkelen.org/post/667/</link>
		<comments>http://geert.vanderkelen.org/post/667/#comments</comments>
		<pubDate>Sun, 03 Apr 2011 11:05:05 +0000</pubDate>
		<dc:creator>Geert Vanderkelen</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://geert.vanderkelen.org/?p=667</guid>
		<description><![CDATA[The MySQL Cluster data node log files can become very big. The best solution is to actually fix the underlying problem. But if you know what you are doing, you can work around it and filter out these annoying log entries. An example of &#8216;annoying&#8217; entries is when you run MySQL Cluster on virtual machines [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://dev.mysql.com">MySQL</a> <a href="http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster.html">Cluster</a> data node log files can become very big. The best solution is to actually fix the underlying problem. But if you know what you are doing, you can work around it and filter out these annoying log entries.</p>
<p>An example of &#8216;annoying&#8217; entries is when you run MySQL Cluster on virtual machines (not good!) and disks and OS can&#8217;t follow any more; a few lines from the <tt>ndb_X_out.log</tt>:</p>
<pre>
2011-04-03 10:52:31 [ndbd] WARNING  -- Ndb kernel thread 0 is stuck in: Scanning Timers elapsed=100
2011-04-03 10:52:31 [ndbd] INFO     -- timerHandlingLab now: 1301820751642 sent: 1301820751395 diff: 247
2011-04-03 10:52:31 [ndbd] INFO     -- Watchdog: User time: 296  System time: 536
2011-04-03 10:52:31 [ndbd] INFO     -- Watchdog: User time: 296  System time: 536
2011-04-03 10:52:31 [ndbd] WARNING  -- Watchdog: Warning overslept 276 ms, expected 100 ms.
2011-04-03 10:53:33 [ndbd] WARNING  -- Ndb kernel thread 0 is stuck in: Performing Receive elapsed=100
2011-04-03 10:53:33 [ndbd] INFO     -- Watchdog: User time: 314  System time: 571
2011-04-03 10:53:33 [ndbd] INFO     -- timerHandlingLab now: 1301820813839 sent: 1301820813476 diff: 363
2011-04-03 10:53:33 [ndbd] INFO     -- Watchdog: User time: 314  System time: 571
</pre>
<p>You can&#8217;t set the <a href="http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-logging-management-commands.html">log levels</a> like you would do for the cluster logs produced by the management node. However, you can run the data nodes so they put messages to <tt>STDOUT</tt> and redirect it to a script:</p>
<pre class="brush: bash; gutter: false; title: (double click text to copy/paste); notranslate">
ndbd --nodaemon 2&gt;&amp;1 | ndbd_logger.py /var/log/ndb_3_out.log &amp;
</pre>
<p>And here&#8217;s the <tt>ndbd_logger.py</tt> script filtering out the &#8216;annoying&#8217; messages. Extra candy: it fixes lines which do not have a timestamp!</p>
<pre class="brush: python; title: (double click text to copy/paste); notranslate">
import sys
import os
import socket
from time import strftime

FILTERED = (
  'Watchdog',
  'timerHandlingLab',
  'time to complete',
)      

def main():
  try:
    log_file = sys.argv[1]
  except IndexError:
    print &quot;Need location for log file (preferable absolute path)&quot;
    sys.exit(1)

  try:
    fp = open(log_file,'ab')
  except IOError, e:
    print &quot;Failed openeing file: %s&quot; % e
    sys.exit(2)

  while True:
    line = sys.stdin.readline().strip()
    if line == '':
      break
    for f in FILTERED:
      if line.find(f) &gt; -1:
        continue
    if line.find('[ndbd]') == -1:
      line = strftime('%Y-%m-%d %H:%M:%S [ndbd] NA       -- ') + line
    fp.write(line + '\n')
    fp.flush()
  fp.write(strftime('%Y-%m-%d %H:%M:%S Closing log\n'))
  fp.close()

if __name__ == '__main__':
  main()
</pre>
<p>The above script can definitely be improved, but it shows the basics. I particularly like the timestamp fixing.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgeert.vanderkelen.org%2Fpost%2F667%2F&amp;title=Custom%20logger%20for%20your%20MySQL%20Cluster%20data%20nodes" id="wpa2a_18"><img src="http://geert.vanderkelen.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://geert.vanderkelen.org/post/667/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nostalgia: past logos from my past &#8216;business&#8217;</title>
		<link>http://geert.vanderkelen.org/post/655/</link>
		<comments>http://geert.vanderkelen.org/post/655/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 21:20:59 +0000</pubDate>
		<dc:creator>Geert Vanderkelen</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://geert.vanderkelen.org/?p=655</guid>
		<description><![CDATA[I was young. I had long(er) hair. The only thing that didn&#8217;t change was my goatee.. Thanks to Sander, a friend in Belgium, we recovered the older logo. 1998: The original fails, I must have it on some disks. I think I made this while in Le Mans (France), using some program on Windows. Note [...]]]></description>
			<content:encoded><![CDATA[<p>I was young. I had long(er) hair. The only thing that didn&#8217;t change was my goatee.. Thanks to Sander, a friend in Belgium, we recovered the older logo.</p>
<div>
<img style="float:right" src="http://geert.vanderkelen.org/media/KemuriSystems_logo1998.jpg" alt="Kemuri System Logo 1998" /><br />
<strong>1998</strong>: The original fails, I must have it on some disks. I think I made this while in <a href="http://en.wikipedia.org/wiki/Le_Mans">Le Mans (France)</a>, using some program on Windows. Note that &#8216;<a href="http://en.wikipedia.org/wiki/Kemuri">kemuri</a>&#8216; is Japanese for &#8216;smoke&#8217;, so the S somehow weaves along the K.
</div>
<div style="clear:both;">
<img style="clear:both; float:left" src="http://geert.vanderkelen.org/media/KemuriSystems_logo2002.jpg" alt="Kemuri System Logo 2002" /><strong>2001</strong>: Or was it 2002.. Revamped the logo so it was easier to print on paper. You know, making invoices. Not sure where I got the idea from, but maybe it was from <a href="http://en.wikipedia.org/wiki/Geeknet">VA Linux</a> logo (had a rack mountable server from them). I&#8217;m sure this one was made in a <a href="http://en.wikipedia.org/wiki/Basement">basement</a> in <a href="http://en.wikipedia.org/wiki/Brussels">Brussels</a>.
</div>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgeert.vanderkelen.org%2Fpost%2F655%2F&amp;title=Nostalgia%3A%20past%20logos%20from%20my%20past%20%E2%80%98business%E2%80%99" id="wpa2a_20"><img src="http://geert.vanderkelen.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://geert.vanderkelen.org/post/655/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

