<?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>Xaprb &#187; Apache</title>
	<atom:link href="http://www.xaprb.com/blog/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xaprb.com/blog</link>
	<description>Stay curious!</description>
	<lastBuildDate>Thu, 09 Feb 2012 03:58:56 +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>Why MySQL might not benefit from having a mother ship</title>
		<link>http://www.xaprb.com/blog/2009/05/05/why-mysql-might-not-benefit-from-having-a-mother-ship/</link>
		<comments>http://www.xaprb.com/blog/2009/05/05/why-mysql-might-not-benefit-from-having-a-mother-ship/#comments</comments>
		<pubDate>Tue, 05 May 2009 04:15:18 +0000</pubDate>
		<dc:creator>Xaprb</dc:creator>
				<category><![CDATA[Commentary]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Drizzle]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=1059</guid>
		<description><![CDATA[As I was driving with a colleague in California a couple of weeks ago during the conference, the topic of conversation turned to the notion that Percona and the rest of the MySQL community really need the presence of a central entity that provides a recognized home for the MySQL server. The conversation went something [...]


<strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2008/12/23/does-mysql-really-have-an-open-source-business-model/' rel='bookmark' title='Permanent Link: Does MySQL really have an open-source business model?'>Does MySQL really have an open-source business model?</a></li>
<li><a href='http://www.xaprb.com/blog/2008/04/23/like-it-or-not-it-is-the-mysql-conference-and-expo/' rel='bookmark' title='Permanent Link: Like it or not, it is the MySQL Conference and Expo'>Like it or not, it is the MySQL Conference and Expo</a></li>
<li><a href='http://www.xaprb.com/blog/2008/05/18/why-is-mysql-more-popular-than-postgresql/' rel='bookmark' title='Permanent Link: Why is MySQL more popular than PostgreSQL?'>Why is MySQL more popular than PostgreSQL?</a></li>
<li><a href='http://www.xaprb.com/blog/2011/04/05/oracle-is-not-screwing-mysql/' rel='bookmark' title='Permanent Link: Oracle is not screwing MySQL'>Oracle is not screwing MySQL</a></li>
<li><a href='http://www.xaprb.com/blog/2008/05/14/mysql-free-software-but-not-open-source/' rel='bookmark' title='Permanent Link: MySQL: Free Software but not Open Source'>MySQL: Free Software but not Open Source</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>As I was driving with a colleague in California a couple of weeks ago during the conference, the topic of conversation turned to the notion that Percona and the rest of the MySQL community really need the presence of a central entity that provides a recognized home for the MySQL server.  The conversation went something like &#8220;I was talking to so-and-so, and he said, <em>you know, you guys really need Sun/MySQL, because without the mother ship, things will fall apart and your own business will fail</em>.&#8221;</p>

<p>I happen to believe this is FUD, and that the reverse might actually be true.  (This is one reason why we&#8217;re <a href="http://www.xaprb.com/blog/2009/04/20/a-review-of-how-life-imitates-chess/">competing</a> head-on with MySQL.)  Having a &#8220;mother ship&#8221; is in the long run, a very complex scenario to fully understand.  There are all sorts of causes and effects that play out in subtle ways.  I honestly doubt anyone can really know what the true effect is.</p>

<p>So what <em>can</em> we say about the presence or absence of a single controlling organization, then?  Simply this: we can look for examples of where power is decentralized, and see how it fares. Let&#8217;s see some names:</p>

<ul>
<li>The Linux kernel.</li>
<li>The GNU/Linux operating system in all its variations.</li>
<li>PostgreSQL.</li>
<li>Apache.</li>
</ul>

<p>There are more that I could mention.  But these are good enough examples to show that a thriving ecosystem is possible when power is not completely concentrated.  In many ways, these projects have been far more successful than MySQL.  I invite you to simply take a look at the Postgres hackers mailing list to see the PostgreSQL project&#8217;s success first-hand.</p>

<p>I can mention a few effects I&#8217;ve seen in the MySQL world that I don&#8217;t see elsewhere, and which I attribute to the presence of MySQL the corporation.  The single biggest one I see is how the community around MySQL differs from, say, the community around PostgreSQL.  As I said in my recent keynote address at the <a href="http://conferences.percona.com/">Percona Performance Conference</a>, I think the best way to describe it is &#8220;MySQL <em>has</em> a community.  PostgreSQL <em>is</em> a community.&#8221;  (That&#8217;s a quote from a PostgreSQL community member.)</p>

<p>PostgreSQL isn&#8217;t the only project I can point to &#8212; Drizzle, for example, is taking a very good approach in my opinion.  But any of these will do as an example.  The key point is that there is a fundamentally different outlook on the relationship, both inside and outside MySQL, than there might be.  On the outside, I have observed a lot of passivity and negativity.  On the inside, I sometimes detect something that might be called paternalism.</p>

<p>Unflattering &#8212; yes, I&#8217;m being rather unflattering.  But let&#8217;s be honest.  The status quo between MySQL and &#8220;the community&#8221; is not good, not good at all.  It resembles nothing so much as the relationship between users and producers of a proprietary product.  That&#8217;s not bad for a proprietary product &#8212; but really bad for an open-source one.  Just the fact that we talk about MySQL and &#8220;the community&#8221; as though they&#8217;re separate reveals a lot.</p>

<p>And I attribute this to the presence of a mother ship, however you might choose to label it.  It creates a power relationship that I believe is a roadblock to a lot of good things.  I know of examples in the last few weeks where the power relationship caused appalling problems with some of the foremost community members &#8212; situations that would never have happened in a relationship of equals.  (I&#8217;m being discreet for a reason; I don&#8217;t want to cause any more heartache for those involved.  Let&#8217;s just leave it at &#8220;the entire community suffered as a result.&#8221;)  This kind of thing has been happening for <em>years</em>.</p>

<p>I firmly believe those who would truly participate in open source must recognize that there is no true meeting of the minds, unless everyone is an equal.  Not just &#8220;treated as an equal&#8221; &#8212; if you hold the power, then <em>you can&#8217;t be an equal</em>, no matter how you try to treat others.  Anyone who tries to be &#8220;more equal&#8221; than others is poisoning the well.  The only solution I see is to <a href="http://www.xaprb.com/blog/2009/03/08/making-maatkit-more-open-source-one-step-at-a-time/">divest oneself of power</a>.</p>

<p>I think there are <a href="http://www.xaprb.com/blog/2007/08/12/what-would-make-me-buy-mysql-enterprise/">a lot of opportunities</a> here for everyone involved.  And those who are best placed to take those opportunities, but don&#8217;t, merely create a vacuum that draws others in to do it in their stead.  And that&#8217;s why I think that ultimately, the mother ship structure is not only unnecessary and sometimes detrimental, but may even become irrelevant.</p>

<p>I will be very curious to see how things change in the future.  MySQL has a lot going for it: an incredible team of talented, dedicated employees; visionary leaders; unprecedented technology landscape; economic conditions &#8212; it&#8217;s an enviable position.  What I&#8217;m most interested in is to see how they will nurture the <a href="http://www.xaprb.com/blog/2008/05/14/mysql-free-software-but-not-open-source/">open-source nature of the product</a>, which is its greatest strength &#8212; if it is teased out of the closed-source models that have bound it so tightly in recent years.  The good news is, I think it&#8217;s theirs to lose; they can win if they play it right, but the rest of us win no matter what.</p>

<p>The day we see an <a href="http://mysqlha.blogspot.com/2009/04/hack-on-drizzle-get-paid.html">announcement like this one</a> for MySQL will be a great day indeed.</p>

<p><strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2008/12/23/does-mysql-really-have-an-open-source-business-model/' rel='bookmark' title='Permanent Link: Does MySQL really have an open-source business model?'>Does MySQL really have an open-source business model?</a></li>
<li><a href='http://www.xaprb.com/blog/2008/04/23/like-it-or-not-it-is-the-mysql-conference-and-expo/' rel='bookmark' title='Permanent Link: Like it or not, it is the MySQL Conference and Expo'>Like it or not, it is the MySQL Conference and Expo</a></li>
<li><a href='http://www.xaprb.com/blog/2008/05/18/why-is-mysql-more-popular-than-postgresql/' rel='bookmark' title='Permanent Link: Why is MySQL more popular than PostgreSQL?'>Why is MySQL more popular than PostgreSQL?</a></li>
<li><a href='http://www.xaprb.com/blog/2011/04/05/oracle-is-not-screwing-mysql/' rel='bookmark' title='Permanent Link: Oracle is not screwing MySQL'>Oracle is not screwing MySQL</a></li>
<li><a href='http://www.xaprb.com/blog/2008/05/14/mysql-free-software-but-not-open-source/' rel='bookmark' title='Permanent Link: MySQL: Free Software but not Open Source'>MySQL: Free Software but not Open Source</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.xaprb.com/blog/2009/05/05/why-mysql-might-not-benefit-from-having-a-mother-ship/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secure, easy Cacti graphing without SNMP</title>
		<link>http://www.xaprb.com/blog/2009/04/25/secure-easy-cacti-graphing-without-snmp/</link>
		<comments>http://www.xaprb.com/blog/2009/04/25/secure-easy-cacti-graphing-without-snmp/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 19:01:02 +0000</pubDate>
		<dc:creator>Xaprb</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Cacti]]></category>
		<category><![CDATA[Cacti templates]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Nginx]]></category>

		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=1041</guid>
		<description><![CDATA[Cacti is a great tool for collecting information about systems and graphing it. However, it likes to use SNMP, and SNMP is often not desirable. Instead, I often see the need for a method that is: Secure. Use trusted, well-known, encrypted communication. Do not open up new ports. Zero install on the monitored system. As [...]


<strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2009/02/09/news-on-mysql-cacti-templates/' rel='bookmark' title='Permanent Link: News on MySQL Cacti Templates'>News on MySQL Cacti Templates</a></li>
<li><a href='http://www.xaprb.com/blog/2008/04/27/improved-cacti-monitoring-templates-for-mysql/' rel='bookmark' title='Permanent Link: Improved Cacti monitoring templates for MySQL'>Improved Cacti monitoring templates for MySQL</a></li>
<li><a href='http://www.xaprb.com/blog/2010/05/25/a-better-way-to-build-cacti-templates/' rel='bookmark' title='Permanent Link: A better way to build Cacti templates'>A better way to build Cacti templates</a></li>
<li><a href='http://www.xaprb.com/blog/2009/05/07/version-112-of-improved-cacti-templates-released/' rel='bookmark' title='Permanent Link: Version 1.1.2 of improved Cacti templates released'>Version 1.1.2 of improved Cacti templates released</a></li>
<li><a href='http://www.xaprb.com/blog/2010/04/20/version-1-1-7-of-better-cacti-templates-released/' rel='bookmark' title='Permanent Link: Version 1.1.7 of Better Cacti Templates released'>Version 1.1.7 of Better Cacti Templates released</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cacti.net/">Cacti</a> is a great tool for collecting information about systems and graphing it.  However, it likes to use SNMP, and SNMP is often not desirable.  Instead, I often see the need for a method that is:</p>

<ul>
<li>Secure.  Use trusted, well-known, encrypted communication.  Do not open up new ports.</li>
<li>Zero install on the monitored system.</li>
<li>As little installation or modification on the monitoring system as possible.</li>
</ul>

<p>Over the last several years, I&#8217;ve slowly created more and more software to create Cacti graphs via standard POSIX command-line utilities over SSH with key-pair authentication.  (I&#8217;ve also created similar software for Nagios, but that&#8217;s another matter.)  The major problem with the work I&#8217;ve done is that it&#8217;s totally un-publicized.</p>

<p>The system works by passing command-line arguments to a local PHP script like any other Cacti script.  This script then executes a remote SSH command, such as <code>ssh somehost uptime</code> and extracts statistics from the result.</p>

<p>The requirements are very simple.  On the system to be monitored, a public key must be installed.  On the monitoring system, the cacti user account must have a private SSH key that it can read and others can&#8217;t.  This is standard for any SSH key.  The cacti user account must also have the SSH key fingerprint of the monitored system in its known_hosts file.</p>

<p>The work I&#8217;ve done thus far is available from Subversion in the <a href="http://code.google.com/p/mysql-cacti-templates">mysql-cacti-templates</a> project.  This project has the scaffolding for creating Cacti templates easily, so I&#8217;m using it.</p>

<p>At this point, the following are available:</p>

<ul>
<li>Apache</li>
<li>Operating system (CPU, memory, load average, etc)</li>
<li>Memcached</li>
<li>Nginx</li>
</ul>

<p>Unfinished work includes network, disk, etc.  The techniques to monitor something of which there is a variable number (e.g. there can be many disks, each of which needs its own graph) are a little more complex than simple things like monitoring overall CPU usage.  So that&#8217;s a work in progress.  Once it&#8217;s done, it&#8217;ll make it really easy to discover and monitor multiples of <em>anything</em> &#8212; for example, multiple MySQL servers or memcached servers on a single host &#8212; without creating a new host for each resource to monitor.</p>

<p>As with the MySQL templates I created, these templates are comprehensive and have lots of nice properties most templates lack.  This is something you get free with my scaffolding.  If you&#8217;ve ever created templates by hand through the web interface, you should give my work a try.  You can turn a three-day project into a few minutes and avoid bugs and other hassles.  There are <a href="http://code.google.com/p/mysql-cacti-templates/wiki/CreatingGraphs">instructions for creating Cacti templates</a> on the project wiki.</p>

<p><strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2009/02/09/news-on-mysql-cacti-templates/' rel='bookmark' title='Permanent Link: News on MySQL Cacti Templates'>News on MySQL Cacti Templates</a></li>
<li><a href='http://www.xaprb.com/blog/2008/04/27/improved-cacti-monitoring-templates-for-mysql/' rel='bookmark' title='Permanent Link: Improved Cacti monitoring templates for MySQL'>Improved Cacti monitoring templates for MySQL</a></li>
<li><a href='http://www.xaprb.com/blog/2010/05/25/a-better-way-to-build-cacti-templates/' rel='bookmark' title='Permanent Link: A better way to build Cacti templates'>A better way to build Cacti templates</a></li>
<li><a href='http://www.xaprb.com/blog/2009/05/07/version-112-of-improved-cacti-templates-released/' rel='bookmark' title='Permanent Link: Version 1.1.2 of improved Cacti templates released'>Version 1.1.2 of improved Cacti templates released</a></li>
<li><a href='http://www.xaprb.com/blog/2010/04/20/version-1-1-7-of-better-cacti-templates-released/' rel='bookmark' title='Permanent Link: Version 1.1.7 of Better Cacti Templates released'>Version 1.1.7 of Better Cacti Templates released</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.xaprb.com/blog/2009/04/25/secure-easy-cacti-graphing-without-snmp/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Get Maatkit fast from the command line</title>
		<link>http://www.xaprb.com/blog/2008/05/21/get-maatkit-fast-command-line/</link>
		<comments>http://www.xaprb.com/blog/2008/05/21/get-maatkit-fast-command-line/#comments</comments>
		<pubDate>Wed, 21 May 2008 12:57:46 +0000</pubDate>
		<dc:creator>Xaprb</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://www.xaprb.com/blog/2007/07/19/feedburner-stuff-plugins-to-install/</guid>
		<description><![CDATA[I have been using Maatkit in a different way since I joined Percona as a consultant. When I&#8217;m working on a system now, it&#8217;s a new, unfamiliar system &#8212; not one where I have already installed my favorite programs. And that means I want to grab my favorite productivity tools fast. I intentionally wrote the [...]


<strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2009/03/25/mysql-command-line-tip-compare-result-sets/' rel='bookmark' title='Permanent Link: MySQL command-line tip: compare result sets'>MySQL command-line tip: compare result sets</a></li>
<li><a href='http://www.xaprb.com/blog/2011/06/11/vim-the-ultimate-command-line-password-manager/' rel='bookmark' title='Permanent Link: Vim, the ultimate command-line password manager'>Vim, the ultimate command-line password manager</a></li>
<li><a href='http://www.xaprb.com/blog/2008/03/09/a-very-fast-fnv-hash-function-for-mysql/' rel='bookmark' title='Permanent Link: A very fast FNV hash function for MySQL'>A very fast FNV hash function for MySQL</a></li>
<li><a href='http://www.xaprb.com/blog/2007/05/12/how-fast-is-mysql-table-checksum/' rel='bookmark' title='Permanent Link: How fast is MySQL Table Checksum?'>How fast is MySQL Table Checksum?</a></li>
<li><a href='http://www.xaprb.com/blog/2007/10/23/how-fast-is-mysql-replication/' rel='bookmark' title='Permanent Link: How fast is MySQL replication?'>How fast is MySQL replication?</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I have been using Maatkit in a different way since I joined <a href="http://www.percona.com/">Percona</a> as a consultant.  When I&#8217;m working on a system now, it&#8217;s a new, unfamiliar system &#8212; not one where I have already installed my favorite programs.  And that means I want to grab my favorite productivity tools fast.</p>

<p>I intentionally wrote the <a href="http://www.maatkit.org">Maatkit</a> tools so they don&#8217;t need to be &#8220;installed.&#8221;  You just run them, that&#8217;s all.  But I never made them easy to download.</p>

<p>I fixed that.  Now, at the command line, you can just run this:</p>

<pre>wget http://www.maatkit.org/get/mk-table-sync</pre>

<p>Now it&#8217;s ready to run.  Behind the scenes are some Apache mod_rewrite rules, a Perl script or two, and Subversion.  When you do this, you&#8217;re getting the latest code from Subversion&#8217;s trunk.[1][2]  (I like to run on the bleeding edge.  Releases are for people who want to install stuff.)</p>

<p>Because there&#8217;s some Perl magic behind it, I made it even easier &#8212; it does pattern-matching on partial names and Does The Right Thing:</p>

<pre>baron@kanga:~$ wget http://www.maatkit.org/get/sync
--21:38:50--  http://www.maatkit.org/get/sync
           =&gt; `sync'
Resolving www.maatkit.org... 64.130.10.15
Connecting to www.maatkit.org|64.130.10.15|:80... connected.
HTTP request sent, awaiting response... 302 Moved
Location: http://www.maatkit.org/get/mk-table-sync [following]
--21:38:50--  http://www.maatkit.org/get/mk-table-sync
           =&gt; `mk-table-sync'
Connecting to www.maatkit.org|64.130.10.15|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-perl]

    [      &lt;=&gt;                            ] 163,259      136.51K/s             

21:38:51 (136.13 KB/s) - `mk-table-sync' saved [163259]</pre>

<p>The redirection is there because otherwise wget will save the file under the name &#8216;sync&#8217; instead of &#8216;mk-table-sync&#8217;.</p>

<p>And if you&#8217;ve forgotten which tools exist, you can just click on over to <a href="http://www.maatkit.org/get/">http://www.maatkit.org/get/</a> and see.</p>

<p>A quick poll: instead of getting the latest trunk, should this give you the code from the last release?  I can do that, if you want.</p>

<p>[1] OK, it&#8217;s only refreshed every hour.  So you&#8217;re getting code that&#8217;s up to an hour old.</p>

<p>[2] <strong>update:</strong> now /get/foo gets the latest release, and /trunk/foo gets the latest trunk code.</p>

<p><strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2009/03/25/mysql-command-line-tip-compare-result-sets/' rel='bookmark' title='Permanent Link: MySQL command-line tip: compare result sets'>MySQL command-line tip: compare result sets</a></li>
<li><a href='http://www.xaprb.com/blog/2011/06/11/vim-the-ultimate-command-line-password-manager/' rel='bookmark' title='Permanent Link: Vim, the ultimate command-line password manager'>Vim, the ultimate command-line password manager</a></li>
<li><a href='http://www.xaprb.com/blog/2008/03/09/a-very-fast-fnv-hash-function-for-mysql/' rel='bookmark' title='Permanent Link: A very fast FNV hash function for MySQL'>A very fast FNV hash function for MySQL</a></li>
<li><a href='http://www.xaprb.com/blog/2007/05/12/how-fast-is-mysql-table-checksum/' rel='bookmark' title='Permanent Link: How fast is MySQL Table Checksum?'>How fast is MySQL Table Checksum?</a></li>
<li><a href='http://www.xaprb.com/blog/2007/10/23/how-fast-is-mysql-replication/' rel='bookmark' title='Permanent Link: How fast is MySQL replication?'>How fast is MySQL replication?</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.xaprb.com/blog/2008/05/21/get-maatkit-fast-command-line/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to install and maintain multiple WordPress blogs easily</title>
		<link>http://www.xaprb.com/blog/2008/03/11/how-to-install-and-maintain-multiple-wordpress-blogs-easily/</link>
		<comments>http://www.xaprb.com/blog/2008/03/11/how-to-install-and-maintain-multiple-wordpress-blogs-easily/#comments</comments>
		<pubDate>Wed, 12 Mar 2008 02:20:17 +0000</pubDate>
		<dc:creator>Xaprb</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.xaprb.com/blog/2008/03/11/how-to-install-and-maintain-multiple-wordpress-blogs-easily/</guid>
		<description><![CDATA[<p>My wife has a site that needs two WordPress blog installations.  The URLs differ by a subdirectory name.  Both blogs need to be (URL-wise) subdirectories of /blog/.  They need to be completely independent of each other, yet use the same custom theme.  And there used to be just a single blog, which was <em>not</em> in a subdirectory; its permalinks must not break.  (It has nice URLs with the date and title in them, not post ID-style URLs).  And because I'm the husband, I get to maintain it, so tack "easy to maintain" onto the requirements  (it must be easy to upgrade WP in both blogs, for example).  In this article I'll show you how I did it with a single .htaccess file, a single copy of WordPress, two MySQL databases, and a single configuration file.</p>


<strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2006/04/24/beautiful-x11-cursors/' rel='bookmark' title='Permanent Link: How to install beautiful X11 cursors'>How to install beautiful X11 cursors</a></li>
<li><a href='http://www.xaprb.com/blog/2010/10/22/blogs-that-are-good-resources-for-mysql-users/' rel='bookmark' title='Permanent Link: Blogs that are good resources for MySQL users'>Blogs that are good resources for MySQL users</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/19/3-ways-to-maintain-rollup-tables-in-sql/' rel='bookmark' title='Permanent Link: 3 ways to maintain rollup tables in SQL'>3 ways to maintain rollup tables in SQL</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/28/how-to-install-innotop/' rel='bookmark' title='Permanent Link: How to install innotop'>How to install innotop</a></li>
<li><a href='http://www.xaprb.com/blog/2009/08/09/how-to-round-to-the-nearest-whole-multiple-or-fraction-in-sql/' rel='bookmark' title='Permanent Link: How to round to the nearest whole multiple or fraction in SQL'>How to round to the nearest whole multiple or fraction in SQL</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>My wife has a site that needs two WordPress blog installations.  The URLs differ by a subdirectory name.  Both blogs need to be (URL-wise) subdirectories of /blog/.  They need to be completely independent of each other, yet use the same custom theme.  And there used to be just a single blog, which was <em>not</em> in a subdirectory; its permalinks must not break.  (It has nice URLs with the date and title in them, not post ID-style URLs).  And because I&#8217;m the husband, I get to maintain it, so tack &#8220;easy to maintain&#8221; onto the requirements  (it must be easy to upgrade WP in both blogs, for example).  In this article I&#8217;ll show you how I did it with a single .htaccess file, a single copy of WordPress, two MySQL databases, and a single configuration file.</p>

<h3>Fixing URLs</h3>

<p>As I mentioned, there used to be a blog at /blog/ which must not break.  Suppose this blog was about dogs and my wife has recently started blogging about cats.  She wants two completely independent blogs: /blog/dogs/ and /blog/cats/.  Now the old permalinks structure, e.g. /blog/2006/03/01/dogs-are-great/, must redirect to /blog/<strong>dogs/</strong>2006/03/01/dogs-are-great/.  How to do this?</p>

<p>I&#8217;m not a mod_rewrite wizard, but I figured there must be a way.  And indeed there is: if an incoming URL doesn&#8217;t contain dogs or cats, it can be rewritten and redirected to the new URL.  Here&#8217;s the code, which goes in /blog/.htaccess:</p>

<pre>
RewriteBase /blog/
RewriteCond %{REQUEST_URI} !dogs|cats
RewriteRule ^(.*)$ http://www.furryfriends.org/blog/dogs/$1 [R]
</pre>

<p>(By the way, the furryfriends thing is just an example, not the real site name).</p>

<p>So far, so good.  That works just fine: when I access a URL without dogs or cats in it, it redirects me.  But I need to do more: I need rewrite rules to match the date-and-title permalinks both blogs will use.  I accomplish that like so:</p>

<pre>
RewriteCond %{REQUEST_URI} dogs|cats
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (dogs|cats) /blog/$1/index.php [L]
</pre>

<p>This is basically the same thing WordPress usually does, but I&#8217;ve made it tolerate either dogs or cats and figure out which installation should get the request.  The .htaccess file lives in /blog/, not inside /dogs/ or /cats/ where it would be hard to maintain (it would get wiped out with upgrades).  I can see different ways of doing this, but this is the way I chose.  So here&#8217;s the whole file:</p>

<pre>
<IfModule mod_rewrite.c>
RewriteEngine On

# Anything to the old address (e.g. /blog/foo/bar) goes to the new address
# (e.g. /blog/dogs/foo/bar)
RewriteBase /blog/
RewriteCond %{REQUEST_URI} !dogs|cats
RewriteRule ^(.*)$ http://www.furryfriends.org/blog/dogs/$1 [R]

# If that fired, then we didn't reach this code.  If we did, then this rule
# should do what a normal WP rule does.
RewriteCond %{REQUEST_URI} dogs|cats
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (dogs|cats) /blog/$1/index.php [L]
</IfModule>
</pre>

<p>Are there any better ways of doing this?  I&#8217;m curious.  Leave a comment if you know of one.</p>

<h3>Fixing the maintenance headache</h3>

<p>Installing two copies of WordPress, then customizing both is a pain.  And it makes upgrades harder, too.  I&#8217;d have to upgrade them both, fiddle with plugins (some of them are customized, too) etc etc.  Even backups would be more complicated.  It would be all too easy to screw up and delete some data.  There are just so many ways this is a bad idea.</p>

<p>It occurred to me that I could use a single copy and turn the dogs/ and cats/ subdirectories in the filesystem into symbolic links.  (Windows users, you can stop reading now: this won&#8217;t work for you).</p>

<p>To make the blogs, the WordPress installation, and the custom blog theme all independent of each other, I created the following filesystem hierarchy:</p>

<pre>
blog/
   wordpress/
      2.3.2/
         [The usual WP files are here]
      wp_content/
         plugins/
         uploads/
         themes/
            my_custom_theme/
</pre>

<p>What I&#8217;ve done is separate the custom bits &#8212; the parts that don&#8217;t ship with WordPress &#8212; away from the files I want to upgrade when I upgrade WordPress.  How will this work, though?</p>

<p>I&#8217;ll make symbolic links from the dogs/ and cats/ directories to the currently installed version of WordPress.  So, from the root directory of the website, I type the following at the command line:</p>

<pre>
$ ln -s wordpress/2.3.2/ dogs
$ ln -s wordpress/2.3.2/ cats
$ cd wordpress/2.3.2/
$ rm -rf wp-content/
$ ln -s ../wp-content wp-content
</pre>

<p>The directory hierarchy now looks like this:

<pre>
blog/
   cats/ -&gt; wordpress/
   dogs/ -&gt; wordpress/
   wordpress/
      2.3.2/
         [The usual WP files are here]
         wp-content/ -&gt; ../wp-content
      wp_content/
         plugins/
         uploads/
         themes/
            my_custom_theme/
</pre>

<p>This is looking pretty good!  There&#8217;s only one minor detail missing: because both blogs are running literally the same code via the magic of symlinks, each blog is trying to access the same database tables.  I need to customize the WordPress configuration file, too.  I&#8217;ll just give each installation a different table name prefix in wp-config.php:

<pre>
$table_prefix  = strpos($_SERVER['REQUEST_URI'], 'blog/cats/') ? 'wp_cats_' : 'wp_dogs';
</pre>

<p>And voila, it works perfectly now.  I accessed the two URLs, ran through the installation procedure twice, and have two completely independent blogs running the same code in the same database.</p>

<h3>The upgrade procedure</h3>

<p>So, this is all a little complicated, right?  What if I&#8217;ve forgotten how I did it when I upgrade next time, or what if someone else does it instead of me?  I wrote myself a little README file to fix this.  Here&#8217;s what it says:</p>

<pre>
This is how to upgrade Lynn's blog.

The two blogs are actually using shared files, which are symlinked to make
it so there is only one copy of files.  You can't change the files in one
without changing them in the other.

The wp-content subdirectory is symlinked.

The wp-config file is customized so it will work in either blog:

$table_prefix  = strpos($_SERVER['REQUEST_URI'], 'blog/cats/') ? 'wp_cats_' : 'wp_dogs';

To upgrade, 

 1. Download the latest version and unpack it inside wordpress/ as 2.3.2/
    or whatever version it is.
 2. Then go into that directory.
 3. Remove the wp-content/ directory completely.
 4. Then symlink it like this: ln -s ../wp-content wp-content
 5. Now re-customize wp-config.php
 6. Go back to the blog/ directory.  rm dogs cats
 7. ln -s wordpress/2.3.2/ dogs
 8. ln -s wordpress/2.3.2/ cats
</pre>

<p>It&#8217;s still a manual process, but it should take me all of thirty seconds.  I&#8217;m okay with that.  As long as I remember there&#8217;s a README file, that is!</p>

<p><strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2006/04/24/beautiful-x11-cursors/' rel='bookmark' title='Permanent Link: How to install beautiful X11 cursors'>How to install beautiful X11 cursors</a></li>
<li><a href='http://www.xaprb.com/blog/2010/10/22/blogs-that-are-good-resources-for-mysql-users/' rel='bookmark' title='Permanent Link: Blogs that are good resources for MySQL users'>Blogs that are good resources for MySQL users</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/19/3-ways-to-maintain-rollup-tables-in-sql/' rel='bookmark' title='Permanent Link: 3 ways to maintain rollup tables in SQL'>3 ways to maintain rollup tables in SQL</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/28/how-to-install-innotop/' rel='bookmark' title='Permanent Link: How to install innotop'>How to install innotop</a></li>
<li><a href='http://www.xaprb.com/blog/2009/08/09/how-to-round-to-the-nearest-whole-multiple-or-fraction-in-sql/' rel='bookmark' title='Permanent Link: How to round to the nearest whole multiple or fraction in SQL'>How to round to the nearest whole multiple or fraction in SQL</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.xaprb.com/blog/2008/03/11/how-to-install-and-maintain-multiple-wordpress-blogs-easily/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
	</channel>
</rss>

