<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Why MySQL says the server is not configured as a slave</title>
	<link>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/</link>
	<description>Stay curious!</description>
	<pubDate>Fri, 16 May 2008 03:35:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>

	<item>
		<title>By: Anonymous</title>
		<link>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/#comment-13898</link>
		<author>Anonymous</author>
		<pubDate>Sat, 08 Dec 2007 01:14:18 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/#comment-13898</guid>
		<description>If this is on the master 

character-set-server=utf8
collation-server=utf8_unicode_ci

default-character-set=utf8
default-collation=utf8_unicode_ci

Make sure it is on the slave too (my.cnf)</description>
		<content:encoded><![CDATA[<p>If this is on the master </p>
<p>character-set-server=utf8<br />
collation-server=utf8_unicode_ci</p>
<p>default-character-set=utf8<br />
default-collation=utf8_unicode_ci</p>
<p>Make sure it is on the slave too (my.cnf)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith Murphy</title>
		<link>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/#comment-13310</link>
		<author>Keith Murphy</author>
		<pubDate>Tue, 14 Aug 2007 20:47:30 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/#comment-13310</guid>
		<description>I find it useful to run a RESET SLAVE command before running the CHANGE MASTER command.  This helps keep weird things from happening.</description>
		<content:encoded><![CDATA[<p>I find it useful to run a RESET SLAVE command before running the CHANGE MASTER command.  This helps keep weird things from happening.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/#comment-12896</link>
		<author>Xaprb</author>
		<pubDate>Fri, 03 Aug 2007 01:19:22 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/#comment-12896</guid>
		<description>Andrew, thanks for the note.  I was missing a quote in a link.  Fixed now.</description>
		<content:encoded><![CDATA[<p>Andrew, thanks for the note.  I was missing a quote in a link.  Fixed now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/#comment-12895</link>
		<author>Xaprb</author>
		<pubDate>Fri, 03 Aug 2007 01:17:49 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/#comment-12895</guid>
		<description>Tsk, tsk, off topic :-)

I'd update the job and set a 'processor' column to CONNECTION_ID(), like this:

&lt;pre&gt;update job
set processor = CONNECTION_ID()
where processor is null
   and processed_at is null
limit 1;

select * from job where processor = CONNECTION_ID() ....&lt;/pre&gt;

You need to handle the case where your processing application claims a job but never finishes it, in which case nothing else would ever claim it.  I'd have a periodic job to just reset processor to NULL after the job has been claimed but not processed for a while.</description>
		<content:encoded><![CDATA[<p>Tsk, tsk, off topic :-)</p>
<p>I&#8217;d update the job and set a &#8216;processor&#8217; column to CONNECTION_ID(), like this:</p>
<pre>update job
set processor = CONNECTION_ID()
where processor is null
   and processed_at is null
limit 1;

select * from job where processor = CONNECTION_ID() ....</pre>
<p>You need to handle the case where your processing application claims a job but never finishes it, in which case nothing else would ever claim it.  I&#8217;d have a periodic job to just reset processor to NULL after the job has been claimed but not processed for a while.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: andrew</title>
		<link>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/#comment-12871</link>
		<author>andrew</author>
		<pubDate>Thu, 02 Aug 2007 16:55:18 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/#comment-12871</guid>
		<description>dead link to an article

this post
http://www.xaprb.com/blog/2007/01/11/how-to-implement-a-queue-in-sql/

reference this post
http://www.xaprb.com/blog/2006/02/21/flexible-insert-and-update-in-mysql/"

which seems to be missing ?</description>
		<content:encoded><![CDATA[<p>dead link to an article</p>
<p>this post<br />
<a href="http://www.xaprb.com/blog/2007/01/11/how-to-implement-a-queue-in-sql/" rel="nofollow">http://www.xaprb.com/blog/2007/01/11/how-to-implement-a-queue-in-sql/</a></p>
<p>reference this post<br />
<a href="http://www.xaprb.com/blog/2006/02/21/flexible-insert-and-update-in-mysql/" rel="nofollow">http://www.xaprb.com/blog/2006/02/21/flexible-insert-and-update-in-mysql/</a>&#8220;</p>
<p>which seems to be missing ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: andrew</title>
		<link>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/#comment-12870</link>
		<author>andrew</author>
		<pubDate>Thu, 02 Aug 2007 16:52:09 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/#comment-12870</guid>
		<description>Hi, found your blog, love it, may find my answer as I go thru it.  I posted this on the mysql forum and got not response :(  care to take a shot ?

-- THanks, Andrew



I have a table named JOB that looks like this:

 -------------- --------------- ------ ----- --------- ---------------- 
&#124; Field &#124; Type &#124; Null &#124; Key &#124; Default &#124; Extra &#124;
 -------------- --------------- ------ ----- --------- ---------------- 
&#124; id &#124; int(11) &#124; NO &#124; PRI &#124; NULL &#124; auto_increment &#124;
&#124; created_at &#124; datetime &#124; YES &#124; &#124; NULL &#124; &#124;
&#124; processed_at &#124; datetime &#124; YES &#124; &#124; NULL &#124; &#124;
 -------------- --------------- ------ ----- --------- ---------------- 

I have been processing this from a single thread by just finding the oldest non-completed job and processing it...

- SELECT id FROM job WHERE processed_at IS NULL ORDER BY created_at;
- UPDATE job SET processed_at = CURDATE() where id = 
- process the job

Now I need to speed things up a bit, and need to process these jobs from multiple threads. The code above does not work, as the same job could get processed twice.

What's the best practice way to do something like this ?</description>
		<content:encoded><![CDATA[<p>Hi, found your blog, love it, may find my answer as I go thru it.  I posted this on the mysql forum and got not response :(  care to take a shot ?</p>
<p>&#8211; THanks, Andrew</p>
<p>I have a table named JOB that looks like this:</p>
<p> &#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212; &#8212;&#8211; &#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;-<br />
| Field | Type | Null | Key | Default | Extra |<br />
 &#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212; &#8212;&#8211; &#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;-<br />
| id | int(11) | NO | PRI | NULL | auto_increment |<br />
| created_at | datetime | YES | | NULL | |<br />
| processed_at | datetime | YES | | NULL | |<br />
 &#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212; &#8212;&#8211; &#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;- </p>
<p>I have been processing this from a single thread by just finding the oldest non-completed job and processing it&#8230;</p>
<p>- SELECT id FROM job WHERE processed_at IS NULL ORDER BY created_at;<br />
- UPDATE job SET processed_at = CURDATE() where id =<br />
- process the job</p>
<p>Now I need to speed things up a bit, and need to process these jobs from multiple threads. The code above does not work, as the same job could get processed twice.</p>
<p>What&#8217;s the best practice way to do something like this ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Burton</title>
		<link>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/#comment-12862</link>
		<author>Kevin Burton</author>
		<pubDate>Thu, 02 Aug 2007 06:03:51 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2007/08/01/why-mysql-server-not-configured-as-slave/#comment-12862</guid>
		<description>Yeah .  The whole server-id thing is amazingly stupid.

Why can't a slave compute it's own server-id and why is it even needed in the first place?  Can't you hashcode the IP address or even turn the IP address into a 32bit int?

I realize that none of these situations are PERFECT but some more reasonable defaults would be nice!</description>
		<content:encoded><![CDATA[<p>Yeah .  The whole server-id thing is amazingly stupid.</p>
<p>Why can&#8217;t a slave compute it&#8217;s own server-id and why is it even needed in the first place?  Can&#8217;t you hashcode the IP address or even turn the IP address into a 32bit int?</p>
<p>I realize that none of these situations are PERFECT but some more reasonable defaults would be nice!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
