<?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>wekadesign</title>
	<atom:link href="http://www.wekadesign.co.nz/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wekadesign.co.nz</link>
	<description>web apps that solve problems</description>
	<lastBuildDate>Sun, 20 Jun 2010 04:08:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Installing VMware Server 2.0.2 in Ubuntu 10.04</title>
		<link>http://www.wekadesign.co.nz/2010/06/20/installing-vmware-server-2-0-2-in-ubuntu-10-04/</link>
		<comments>http://www.wekadesign.co.nz/2010/06/20/installing-vmware-server-2-0-2-in-ubuntu-10-04/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 04:08:13 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lucid lynx]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vmware server 2]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/?p=195</guid>
		<description><![CDATA[After updating my trusty old server to Ubuntu Lucid Lynx 10.04 the installation of VMware Server 2.0.1 started giving problems. Resinstalling VMware didn&#8217;t help as I was repeatedly getting compilation problems in vmmon and vmnet modules. Luckily I stumbled across the following process from one of the VMware forum pages which pointed to a great [...]]]></description>
			<content:encoded><![CDATA[<p>After updating my trusty old server to Ubuntu Lucid Lynx 10.04 the installation of VMware Server 2.0.1 started giving problems. Resinstalling VMware didn&#8217;t help as I was repeatedly getting compilation problems in vmmon and vmnet modules. Luckily I stumbled across the following process from one of the VMware<a title="VMware forum" href="http://communities.vmware.com/thread/266625" target="_blank"> forum pages</a> which pointed to a great work-around from the <a href="http://radu.cotescu.com/2009/10/30/how-to-install-vmware-server-2-0-x-on-ubuntu-9-10-karmic-koala/" target="_blank">radu cotescu</a> site.</p>
<p>So I take no credit for this but simply repeat it here so that the search gods may recognise it&#8217;s usefulness and +1 it&#8217;s importance.</p>
<p>Start by downloading VMware Server 2.0.2 from the official VMware site. If you haven&#8217;t already got a few licenses, get one now. (They&#8217;re free so you might as well get a few) I&#8217;m going to assume the downloaded file is in your <em>home</em> directory.</p>
<p>You also need to update the header files for your current kernel so that the configuration scripts from VMware can build the appropriate modules.</p>
<pre>sudo apt-get install linux-headers-`uname -r` build-essential</pre>
<p>Now just run the following commands.</p>
<pre><code>cd /usr/local/src
sudo wget [http://codebin.cotescu.com/vmware/vmware-server-2.0.x-kernel-2.6.3x-install.sh]
sudo tar xvzf raducotescu-vmware-server-linux-2.6.3x-kernel-592e882.tar.gz
cd raducotescu-vmware-server-linux-2.6.3x-kernel-592e882/
sudo cp /home/&lt;your_username&gt;/</code><code>VMware-server-2.0.2-203138.i386.tar.gz</code> .
<code>sudo tar xvzf VMware-server-2.0.2-203138.i386.tar.gz
sudo chmod +x vmware-server-2.0.x-kernel-2.6.3x-install.sh
./vmware-server-2.0.x-kernel-2.6.3x-install.sh
</code></pre>
<p>If you have a previous installation of VMware Server, you&#8217;ll be prompted that it&#8217;ll be removed as part of the install. Don&#8217;t worry, any guest VMs you had should still be there afterwards. The script will run through the usual prompts and you&#8217;ll see references to the patched files from Radu Cotescu. After a few minutes you should have a working install of VMware Server 2.0.2 on your Ubuntu 10.04 server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2010/06/20/installing-vmware-server-2-0-2-in-ubuntu-10-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LDAP in PHP on IIS6</title>
		<link>http://www.wekadesign.co.nz/2010/05/28/ldap-in-php-on-iis6/</link>
		<comments>http://www.wekadesign.co.nz/2010/05/28/ldap-in-php-on-iis6/#comments</comments>
		<pubDate>Fri, 28 May 2010 06:07:07 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[iis6]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/?p=188</guid>
		<description><![CDATA[If you&#8217;re struggling to get the LDAP extension to work in PHP and IIS6 then you may want to read on. In my situation both the web server and PHP were confirmed to be working fine and reading the correct php.ini. But even with the correct line enabled in the php.ini file, LDAP would refuse [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re struggling to get the LDAP extension to work in PHP and IIS6 then you may want to read on. In my situation both the web server and PHP were confirmed to be working fine and reading the correct php.ini. But even with the correct line enabled in the <em>php.ini</em> file, LDAP would refuse to show in <em>phpinfo()</em> output.</p>
<p>After some searching of my own, it turns out that IIS6 on Windows Server 2003 (possibly XP too) will not properly read the PATH variable. So if you add the path to your PHP directory to the end of PATH, the DLLs required are still not found. This looks to affect IIS6 specifically as filesystem calls to the same DLLs did find them.</p>
<p>The solution &#8211; add the path to your PHP install to the start or earlier in the PATH variable and restart IIS. In my experience you will now see the LDAP options appear in your <em>phpinfo()</em> output.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2010/05/28/ldap-in-php-on-iis6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running WordPress &amp; PHP Behind ISA Proxy</title>
		<link>http://www.wekadesign.co.nz/2010/05/14/running-wordpress-php-behind-isa-proxy/</link>
		<comments>http://www.wekadesign.co.nz/2010/05/14/running-wordpress-php-behind-isa-proxy/#comments</comments>
		<pubDate>Fri, 14 May 2010 06:23:45 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[cntlm]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/?p=178</guid>
		<description><![CDATA[Some things work well on their own but when mixed make your life hard. Things like Linux and PHP work very well. Microsoft ISA proxy also does a good job in a corporate MS environment. But making the two work together in a controlled environment can be an exercise in frustration. In this post I&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>Some things work well on their own but when mixed make your life hard. Things like Linux and PHP work very well. Microsoft ISA proxy also does a good job in a corporate MS environment. But making the two work together in a controlled environment can be an exercise in frustration.</p>
<p>In this post I&#8217;ll pass on the methods I found to get PHP and your Linux boxes talking out through a corporate ISA proxy server. You can then bring in RSS feeds, updates and other things in WordPress and use <em>apt-get</em> to update Ubuntu.<span id="more-178"></span></p>
<h3>cntlm</h3>
<p>To start with we need to install <a href="http://cntlm.sourceforge.net/" target="_blank"><em>cntlm</em></a> on a Linux box (I&#8217;ll mention Ubuntu here but any flavour should work with a couple of tweaks). <em>cntlm</em> is &#8220;<em>an NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy</em>&#8220;. Basically your non-Windows machines and apps can now talk to <em>cntlm</em> which will then talk to the ISA proxy in your organisation. So you stay within your corporate infrastructure and keep the security guys happy.</p>
<p>Download the deb installation package to your Ubuntu machine and install it with,</p>
<pre>sudo dpkg -i cntlm_0.35.1-1_i386.deb</pre>
<p>Open the config file for <em>cntlm</em> and edit it to add in your ISA proxy information and a valid user, domain and password that has web access with download rights. Further down the settings make sure gateway is enabled and you set suitable restrictions on the IP ranges that can use <em>cntlm</em>.</p>
<pre>sudo nano /etc/cntlm.conf</pre>
<p>Restart <em>cntlm</em> to make sure it gets the new settings,</p>
<pre>sudo /etc/init.d/cntlm restart</pre>
<p>Test your <em>cntlm</em> configuration by attempting to get to an external website,</p>
<pre>sudo cntlm -M <a href="http://www.google.com/" target="_blank">http://www.google.com</a> -u your_user@your_domain -p your_password your_isa_proxy:port</pre>
<h3>apt-get</h3>
<p>Configure <em>apt-get</em> to use the new proxy by editing the <em>apt-get</em> config,</p>
<pre>sudo nano /etc/apt/apt.conf.d/70debconf</pre>
<p>and add this line pointing to your <em>cntlm</em> proxy gateway. Change the IP and port if you&#8217;ve installed <em>cntlm</em> on another machine or different port.</p>
<pre>Acquire::http::proxy "http://127.0.0.1:3128";</pre>
<h3>WordPress</h3>
<p>Add these extra lines to the wp-config.php file in your WordPress directory. This works from version 2.8 onward and means you can keep your install and plugins up to date and secure. Again, make sure you change the IP and port to that of your <em>cntlm</em> proxy gateway. You may be able to comment out the username and password if things don&#8217;t work as expected. It&#8217;ll depend on your <em>cntlm</em> configuration.</p>
<pre>define('WP_PROXY_HOST', '127.0.0.1');
define('WP_PROXY_PORT', '3128');
define('WP_PROXY_USERNAME', 'my_user_name');
define('WP_PROXY_PASSWORD', 'my_password');
define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com');</pre>
<p>With any luck you now have a Linux machine and WordPress install that can easily be kept up to date inside your corporate environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2010/05/14/running-wordpress-php-behind-isa-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using 7zip in Cron Jobs Fails</title>
		<link>http://www.wekadesign.co.nz/2010/03/21/using-7zip-in-cron-jobs-fails/</link>
		<comments>http://www.wekadesign.co.nz/2010/03/21/using-7zip-in-cron-jobs-fails/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 06:25:24 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Interesting Stuff]]></category>
		<category><![CDATA[Sys Admin]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/?p=175</guid>
		<description><![CDATA[For those people tearing their hair out trying to use the 7z util in a cron job, have a look in the Ubuntu forums for the solution. Strangely as soon as you start sending the output to a log file, the 7z part of your script will work. I struck the problem in the Hardy [...]]]></description>
			<content:encoded><![CDATA[<p>For those people tearing their hair out trying to use the 7z util in a cron job, have a look in the <a href="http://ubuntuforums.org/showthread.php?t=830904">Ubuntu forums</a> for the solution. Strangely as soon as you start sending the output to a log file, the 7z part of your script will work.</p>
<p>I struck the problem in the Hardy version of Ubuntu Server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2010/03/21/using-7zip-in-cron-jobs-fails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Outlook Hates Line Breaks</title>
		<link>http://www.wekadesign.co.nz/2010/01/22/outlook-hates-line-breaks/</link>
		<comments>http://www.wekadesign.co.nz/2010/01/22/outlook-hates-line-breaks/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 18:56:11 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[line breaks]]></category>
		<category><![CDATA[outlook]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpmailer]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/?p=170</guid>
		<description><![CDATA[If you&#8217;ve ever wondered why your plain text email message is randomly ignoring line breaks like \n or \r\n then you&#8217;re not alone. I regularly use PHPMailer to send off automated emails and usually in plain text to keep it simple. What Outlook 2003 (and 2002 and 2007 versions apparently) likes to do is be [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever wondered why your plain text email message is randomly ignoring line breaks like \n or \r\n then you&#8217;re not alone. I regularly use PHPMailer to send off automated emails and usually in plain text to keep it simple.</p>
<p>What Outlook 2003 (and 2002 and 2007 versions apparently) likes to do is be super helpful and remove what it regards as extra line breaks. It won&#8217;t be consistent either within a single mail or across many but it will make the content difficult to read. What you thought would be new lines will now be joined up in places and it seems to happen more often the further through the content you go.</p>
<p>There don&#8217;t seem to be many fixes for this issue but there are a few work arounds to help out.</p>
<ol>
<li>Turn off this &#8220;feature&#8221; in Outlook in the Tools»Options menu. Honestly I&#8217;m not sure what use it is anyway. Unfortunately you&#8217;d have to do this on all the recipient&#8217;s computers.</li>
<li>Use HTML in your email rather than plain text. Depending on your content and need for complete accuracy, perhaps more time than it&#8217;s worth.</li>
<li>Add twice the number of line breaks where you currently have them. This seems to help but now your email is rather full of white space and may be more difficult to read.</li>
</ol>
<p>Other than changing email clients, which is pretty unlikely, that&#8217;s about it. If you know of other options to try and get Outlook to not remove line breaks, please leave a comment below. This Microsoft KB article explains which versions of Outlook are affected <a href="http://support.microsoft.com/kb/287816" target="_blank">http://support.microsoft.com/kb/287816</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2010/01/22/outlook-hates-line-breaks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Replication on Ubuntu with DRBD</title>
		<link>http://www.wekadesign.co.nz/2010/01/15/mysql-replication-on-ubuntu-with-drbd/</link>
		<comments>http://www.wekadesign.co.nz/2010/01/15/mysql-replication-on-ubuntu-with-drbd/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 21:45:31 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[drbd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[replication]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/blog/?p=81</guid>
		<description><![CDATA[I&#8217;ve been looking around for some easy and open-source ways to handle database replication for a handful of small but important MySQL databases. A few options were viable but usually included too many config changes for things like creating a new database. DRDB on a Linux server seems to be one of the fastest and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking around for some easy and open-source ways to handle database replication for a handful of small but important MySQL databases. A few options were viable but usually included too many config changes for things like creating a new database. <a href="http://www.drbd.org" target="_blank">DRDB</a> on a Linux server seems to be one of the fastest and easiest methods to handle database synchronisation for DR purposes, so this is the subject of this post. The content is a combination of two main sources from <a href="http://marksitblog.blogspot.com/2007/07/mysql-5-high-availability-with-drbd-8.html" target="_blank">Mark Schoonover</a> and the <a href="https://help.ubuntu.com/9.04/serverguide/C/drbd.html" target="_blank">Ubuntu server guide</a> and the gotchas I found along the way.</p>
<p>This post will show you how to create two MySQL servers that automatically replicate all their databases using DRBD. With Heartbeat installed on a third machine you&#8217;ll have basic fail over protection as well (we&#8217;ll do this in another post). Only one of the database servers will be active at any one time.<span id="more-81"></span></p>
<p>To follow along exactly, you&#8217;ll need the following items set up or readily at hand:</p>
<ul>
<li>VMware Server or ESXi, etc to host the virtual machines we use. You could just as easily use physical machines if you have the hardware lying around.</li>
<li>Ubuntu 9.04 server &#8211; other versions or distros should work just as well but you may have to make some changes to the steps as you go through.</li>
<li>Some basic skills in cmd-line usage of Ubuntu and MySQL.</li>
<li>Being Ubuntu we&#8217;re using a whole heap of <em>sudo</em> prefixed commands here. If you want to drop them out, you can switch to a root session with <em>sudo -s</em>.</li>
</ul>
<p>Start things off by creating a virtual machine<em> </em> with 512MB RAM and two 2GB disks attached. One disk will be for the OS and one will be used as the data location for MySQL. You can change the RAM or disk sizes as you like but we will be duplicating this machine so don&#8217;t use up all your RAM and disk space with the first one.</p>
<p>Install Ubuntu 9.04 server onto this machine and name it <em>node0</em> (that&#8217;s n-o-d-e-zero if the font isn&#8217;t clear). Just use one of the disks for the OS and don&#8217;t format or prepare the second one yet. You can also leave out the LAMP and other installation packages for now as we&#8217;ll grab what we need later.</p>
<p>Once the install is complete, reboot the node0 server, login, run a package update and install MySQL and DRBD with,</p>
<pre>sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mysql-server mysql-client drbd8-utils heartbeat</pre>
<p>You&#8217;ll have to download roughly 45MB of packages for those four items and the extras that come with them.</p>
<p>You now have one server configured with the software we need to do the rest. Depending on your luck, you now have two options for creating the node1 virtual machine.</p>
<h3><strong>1. Duplicate the Virtual machine in VMware</strong></h3>
<p>To make things easy, we&#8217;ll simply copy the<em> node0</em> machine in VMware to create our <em>node1</em>. Make sure you shutdown the <em>node0</em> machine in VMware and (assuming your VMware server host is Ubuntu too) open up a cmd prompt and run,</p>
<pre>cd /var/lib/vmware/Virtual\ Machines
sudo cp -r node0 node1</pre>
<p>Once that&#8217;s completed, you should be able to open the <em>node0.vmx</em> file that&#8217;s in the new node1 folder using VMware console. VMware will add the &#8216;new&#8217; virtual machine to it&#8217;s inventory and you&#8217;ll probably have to rename it as VMware will have kept the same <em>node0</em> name.</p>
<p>Start up your new node1 machine and watch for VMware to prompt you about the machine ID. You&#8217;ll need to say you copied the VM to create a new virtual machine ID in VMware.</p>
<p>Log in to node1 and change the server name in /etc/hostname and /etc/hosts files, so the two servers don&#8217;t get confused over their identities. Shutdown node1 for the changes to take effect. While the server is offline, edit it&#8217;s VMware configuration to remove the NIC and then re-add it. You need to do this to keep the virtual networking in VMware happy.</p>
<p>Depending on how you network is configured, it may be a good idea to set both servers to have static IP addresses. If you don&#8217;t want to do this, make sure you know their IPs and add them to the &#8220;other&#8221; server&#8217;s /etc/hosts file. This will mean that <em>node0</em> can reach<em> node1</em> by it&#8217;s DNS name and vice versa. Test it&#8217;s all working with a ping from each machine to the other.</p>
<h3><strong>2. Repeat the Ubuntu Installation</strong></h3>
<p>OK, so maybe your virtual machine just didn&#8217;t want to be duplicated like mine. If so, just create a new VMware guest config with the same settings as the first and install Ubuntu server the same way.</p>
<h3><strong>3. Disk Configuration</strong></h3>
<p>Now that we have our two node servers configured and the required apps installed, let&#8217;s practice safe-virtualisation by taking a VMware snapshot of both servers. Then if it all blows up in the next few steps, at least we&#8217;ll have something to go back to.</p>
<p>Let&#8217;s create a new disk partition on that extra virtual hard disk we added to both our machines. On both<em> node0</em> and <em>node1</em> use fdisk to add a Linux type 83 partition.</p>
<pre>sudo fdisk /dev/sdb</pre>
<p>Press p to make sure you have the right disk and there are no current partitions. Press n and create a primary partition with the ID of 1, accept the other default options. Press w to save the changes and exit fdisk.</p>
<h3><strong>4. Configure DRBD</strong></h3>
<p>We can now configure DRBD to use this empty partition space we&#8217;ve created. Like many other Linux apps we need to set up DRBD by editing a config file &#8211; <em>/etc/drbd.conf</em></p>
<p>On <em>node0</em>, make your <em>drbd.conf</em> file look something like the file linked below. There are plenty a massive number of other settings and comments but these are the key ones &#8211; assuming you&#8217;ve used the same disk names as above and apply your own network addresses. My server IPs were node0:192.168.0.17 and node1:192.168.0.18 so replace those with your information. Take your time to read through at least some of this file as other things like disconnects on failures may come in handy.</p>
<p><a href="http://www.wekadesign.co.nz/blog/wp-content/uploads/2010/01/drbd.txt">drbd.conf</a></p>
<p>From <em>node0</em>, copy that <em>drbd.conf</em> file to your home directory (~) on <em>node1</em> using the scp command,</p>
<pre>sudo scp /etc/drbd.conf node1:~</pre>
<p>You&#8217;ll have to accept the RSA key for<em> node1</em> if you haven&#8217;t SSH&#8217;d between those servers yet.</p>
<p>And on <em>node1</em> we need to move that file to the correct place,</p>
<pre>sudo mv ~/drbd.conf /etc/</pre>
<p>DRBD will now start, but we need to prepare the partition we created earlier so that DRBD can use it. Turn off <em>node1</em> and on <em>node0</em> do this,</p>
<pre>sudo drbdadm create-md mysql</pre>
<p>Restart <em>node0</em> and log back in again. Typing &#8216;yes&#8217; to DRBD&#8217;s timeout will speed things up. You&#8217;ll see some warnings about using the &#8216;drbd-peer-outdater&#8217; in a mode where something else needs root privileges. Just ignore that for now and we&#8217;ll make those changes later.</p>
<p>Run <em>cat /proc/drbd</em> on <em>node0</em> to have a look at the messages logged when drbd started up. We can see that <em>node0</em> is in an unknown state as it can&#8217;t see what&#8217;s happening on <em>node1</em> properly. So lets sort out <em>node1</em>.</p>
<p>On <em>node1</em> create the drbd file system just like a couple of minutes ago,</p>
<pre>sudo drbdadm create-md mysql</pre>
<p>And restart DRBD on node1 to make sure it&#8217;s using that new data,</p>
<pre>sudo /etc/init.d/drbd restart</pre>
<p>Run <em>cat /proc/drbd</em> again to check the status on both <em>node0</em> and <em>node1</em> and you should see that they are both connected and set as secondary with an inconsistent status. If you don&#8217;t see that then give both nodes a reboot and try again. If you still don&#8217;t see that output, start back tracking and check the previous steps.</p>
<p>At this stage both nodes are essentially looking at each other but don&#8217;t know who is the primary so they&#8217;re not going to do anything. By running the following command on <em>node0</em> you make that machine the primary and data will start to be replicated straight away.</p>
<pre>sudo drbdadm -- --overwrite-data-of-peer primary mysql</pre>
<p>You can either use <em>cat /proc/drbd</em> or <em>watch -n1 cat /proc/drbd</em> to view the status of the replication as it happens. This may take some time, even for the relatively small 2GB of empty space we are using, as DRBD will replicate every block in the device /dev/mysql. Between the VMs on an old P4 with a PATA disk I was seeing about 2.8 MB/s.</p>
<p>When you ran that command to set the primary, you probably got some messages about the heartbeat program requiring root privileges to run drbdsetup and drbdmeta. Do that now to get rid of those warnings.</p>
<pre>sudo chgrp haclient /sbin/drbdsetup
sudo chmod o-x /sbin/drbdsetup
sudo chmod u+s /sbin/drbdsetup
sudo chgrp haclient /sbin/drbdmeta
sudo chmod o-x /sbin/drbdmeta
sudo chmod u+s /sbin/drbdmeta</pre>
<h3>Prepare, Mount &amp; Test the DRBD Device</h3>
<p>Now although we have our two nodes talking and set as primary and secondary, the disk space is not formatted or mounted for any apps (i.e. MySQL) to use. So we first format our <em>/dev/drbd0</em> device with ext3 and a nice filesystem label.</p>
<pre>sudo mkfs.ext3 -L mysql /dev/drbd0</pre>
<p>Then we create the mount point on <em>node0</em> and mount the new filesystem. Whatever gets dropped into <em>/mnt/mysql</em> will magically be synchronised from the primary node to the secondary.</p>
<pre>sudo mkdir /mnt/mysql
sudo mount /dev/drbd0 /mnt/mysql</pre>
<p>To test our new setup copy some files and folders into <em>/mnt/mysql</em> and unmount the DRBD device. We then switch the primary <em>node0</em> to be the secondary and jump onto the <em>node1</em> server.</p>
<pre>sudo cp -r ~ /mnt/mysql
sudo umount /mnt/mysql
sudo drbdadm secondary mysql</pre>
<p>Now move to the <em>node1</em> server and create the same mount point, mount our DRBD device and we&#8217;ll see what&#8217;s inside.</p>
<pre>sudo mkdir /mnt/mysql
sudo mount /dev/drbd0 /mnt/mysql</pre>
<p>Like magic you should now see that same data you copied on <em>node0</em>, has appeared in the same device on <em>node1</em>.</p>
<p>Now switch the roles back again so <em>node0</em> is the primary and <em>node1</em> is the secondary, and delete the test data in <em>/mnt/mysql</em>.</p>
<h3>Configure MySQL</h3>
<p>The core settings for MySQL is in a file called /etc/mysql/<em>my.cnf</em> and it&#8217;s this file that we are going to edit to tell MySQL to use our DRBD device to store it&#8217;s databases, indexes and logs.</p>
<p>At this point it&#8217;s <strong>very important</strong> that you do not have any MySQL databases already running on <em>node0</em> or <em>node1</em> &#8211; none that you want to keep anyway. Let&#8217;s stop the MySQL server and backup our original MySQL settings so we can then make changes on <em>node0</em>.</p>
<pre>sudo /etc/init.d/mysql stop
cd /etc/mysql
sudo cp my.cnf myold.cnf</pre>
<p>Open up the <em>my.cnf</em> file in your favorite text editor like vi or nano, and change the datadir option as below. If you have logging enabled, or will at some point, you may want to synchronise the log files as well. For more information on other options in this file see the <a href="http://dev.mysql.com/doc/refman/5.1/en/option-files.html" target="_blank">MySQL documentation</a>.</p>
<pre>datadir = /mnt/mysql/data</pre>
<p>Save <em>my.cnf</em> and make the same changes on <em>node1</em>. We have to repeat this as these files aren&#8217;t in out replicating DRBD device.</p>
<p>Run the following commands to set the correct permissions on the new location and also update the AppArmor settings to allow access. This is important else the <em>mysql</em> user and group will not be able to access the new directory properly and you will get errors. Trying to restart the MySQL daemon at the moment will fail.</p>
<pre>sudo chown -R mysql:mysql /mnt/mysql
sudo nano /etc/apparmor.d/usr.sbin.mysqld</pre>
<p>On the bottom of the list of locations, add the following (within the curly closing bracket } ),</p>
<pre>/mnt/mysql/data/ r,
/mnt/mysql/data/** rwk,</pre>
<p>Restart AppArmor to pick up the new locations for MySQL,</p>
<pre>sudo /etc/init.d/apparmor restart</pre>
<p>Make the same changes to AppArmor on <em>node1</em> &#8211; again these changes are server based and not automatically replicated.</p>
<p>We should try and move the previous databases into the new location with the following commands. Repeat the first copy command for any other databases you might have. (That <em>mysql</em> directory we&#8217;re copying first is the MySQL system database.)</p>
<pre>sudo cp -r /var/lib/mysql/mysql /mnt/mysql/data/
...
sudo chown -R mysql:mysql /mnt/mysql/data/*</pre>
<p>The last thing to do is restart MySQL and check it&#8217;s working.</p>
<pre>sudo /etc/init.d/mysql start</pre>
<p>If this gives permission errors about the <em>debian-sys-maint</em> user, check your permissions and/or restart the server. Restarting MySQL might not be enough.</p>
<p>Connect to mysql as the <em>root</em> user and let&#8217;s just create a new database and table to test things before we do another manual fail-over to <em>node1</em>.</p>
<pre>mysql -u root -p
create database drbdtest;
use drbdtest;
create table users (id INTEGER(9), name VARCHAR(255));
exit;</pre>
<p>You can now see your new database files in <em>/mnt/mysql/data/drbdtest</em>. So we fail-over from <em>node0</em> to <em>node1</em> again, just for practice. <strong>We must stop the mysql server before we unmount the DRBD device</strong> else very bad things may happen.</p>
<pre>sudo /etc/init.d/mysql stop
sudo umount /mnt/mysql
sudo drbdadm secondary mysql</pre>
<p>and over on <em>node1</em> . . .</p>
<pre>sudo drbdadm primary mysql</pre>
<p>And check those database files are there with the mysql client or looking in <em>/mnt/mysql/data/drbdtest.</em></p>
<h3>Conclusion</h3>
<p>So we can see that this will save us (with some manual intervention), when our MySQL storage falls over. But wouldn&#8217;t it be nice if there was an automated way to make this happen? See the next article on using Heartbeat to make this happen.</p>
<h3>Potential Issues</h3>
<p>If you try and mount <em>/dev/drbd0</em> and get an error about the device being read-only, check that the DRBD node you&#8217;re on is in the correct mode i.e. primary or secondary.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2010/01/15/mysql-replication-on-ubuntu-with-drbd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a WordPress Page for your Main Site Content</title>
		<link>http://www.wekadesign.co.nz/2010/01/04/using-a-wordpress-page-for-your-main-site-content/</link>
		<comments>http://www.wekadesign.co.nz/2010/01/04/using-a-wordpress-page-for-your-main-site-content/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 08:11:00 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[pages]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/?p=135</guid>
		<description><![CDATA[I thought I&#8217;d make more use of WordPress on wekadesign.co.nz since it&#8217;s very powerful and apparently was recently voted top PHP based CMS ahead of Joomla and many other top-notch products. It&#8217;s ease-of-use and interface are all excellent and the massive user base and huge number of plugins make it very attractive for almost any [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-138 alignright" title="wordpress_logo" src="http://www.wekadesign.co.nz/blog/wp-content/uploads/2010/01/wordpress_logo.png" alt="Official WordPress logo" width="100" height="100" />I thought I&#8217;d make more use of WordPress on wekadesign.co.nz since it&#8217;s very powerful and apparently was <a href="http://www.packtpub.com/award" target="_blank">recently voted top PHP based CMS</a> ahead of <a href="http://www.joomla.org/" target="_blank">Joomla</a> and many other top-notch products. It&#8217;s ease-of-use and interface are all excellent and the massive user base and huge number of plugins make it very attractive for almost any web publishing.</p>
<p>After moving the small amount of static WekaDesign content into Pages, I copied a couple of files (index.php and .htaccess) from my WordPress folder (<em>./blog</em>) into the site root, changed the settings in WordPress (Settings»General»Blog Address) and viola, anyone going to www.wekadesign.co.nz, now hits WordPress. Good. Step one done.</p>
<p>Now to change the default landing page to be a static Page rather than the blog. Just as easy, visit Settings»Reading in WordPress and change the Front Page Displays option to be your Page. Excellent, now everyone lands at the the WordPress version of my static content. But how do you now send people to your old default blog page? You can use <em>http://www.yoursite.co.nz/2009/</em> to target certain groups of content by date or category if you have Permalinks setup, but I couldn&#8217;t find the way that WP builds the default blog page.</p>
<p>It&#8217;s not obvious, but that 2nd option in Settings»Reading holds the key. The Posts Page option is asking you to select an existing WP Page that will act as a placeholder and be that default blog page. So, if you haven&#8217;t already, create a new Page with a suitable name. The name is important as that&#8217;s the URL everyone will use and see for your blog. So if you call the Page &#8220;peanut butter&#8221;, your blog page will now be <em>http://www.yoursite.co.nz/peanut-butter/</em>. It doesn&#8217;t matter what the content of the Page holds as no one will ever see it.</p>
<p>There is a slight &#8220;gotcha&#8221; with the Page names, in that any name being reused will work, but WP will append it with an incrementing number e.g. &#8220;peanut-butter-2&#8243;.</p>
<p>To finish off, just create a nice link on your site somewhere like the Sidebar to your default blog page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2010/01/04/using-a-wordpress-page-for-your-main-site-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MS Exchange Local vs Hosted vs Google for 10,000 Users</title>
		<link>http://www.wekadesign.co.nz/2009/12/06/ms-exchange-local-vs-hosted-vs-google-for-10000-users/</link>
		<comments>http://www.wekadesign.co.nz/2009/12/06/ms-exchange-local-vs-hosted-vs-google-for-10000-users/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 03:39:17 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Interesting Stuff]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[hosted]]></category>
		<category><![CDATA[microsoft]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/blog/?p=98</guid>
		<description><![CDATA[After looking at some comments around Exchange Hosted Services, I thought I might do a quick (and very dirty) comparison between that and Google for 10,000 users. (This is no way reflects on the three options and may not resemble your reality). MS Exchange Hosted Services would cost US$90k/month for company with 10k email users [...]]]></description>
			<content:encoded><![CDATA[<p>After looking at some comments around Exchange Hosted Services, I thought I might do a quick (and very dirty) comparison between that and Google for 10,000 users. (This is no way reflects on the three options and may not resemble your reality).</p>
<p><a href="http://www.microsoft.com/online/exchange-hosted-services.mspx">MS Exchange Hosted Services</a> would cost US$90k/month for company with 10k email users and selecting roughly half the options available (Communicator and Hosted Archive being two). That sounds really pricey vs local in-house servers and admins? I have no specific Exchange knowledge but say 20 servers across 5 virtual hosts, plus storage and backups is roughly NZ$350-400k as a one-off cost. Plus a team of seven admins to run it @ NZ$80k pa each is a five year cost of around $2.8 million, but lets say $3.2M to round it up to include a few software licenses and some power,cooling and floor space.</p>
<p>Google&#8217;s offering that I compared MS against is their <a href="http://www.google.com/apps/intl/en/business/features.html">Premier Edition</a> of Apps. It&#8217;s US$50 per user per year and offers the usual email, calendar, resource booking, etc much like Exchange. I was expecting a few missing features but was surprised to see BlackBerry Enterprise Server (BES) synching and user and group provisioning APIs. It integrates with LDAP and offers Single Sign-On (SSO) so most of your users won&#8217;t see too much of a change &#8211; especially if they keep on using the Outlook client. The main issue for some businesses may be the 99.9% uptime guarantee &#8211; that&#8217;s 8h 45m down time per year. I&#8217;m sure there are a few features that Exchange holds over Apps but in many situations the cost may outweigh the benefit or it&#8217;s just not needed. Using Google Apps also unties you from MS Outlook and possibly MS Office, so this option may open the door to other savings.</p>
<p>So over <strong>5 years</strong> for the 10k user company we have the following options:</p>
<p>In-house MS Exchange with 20 VMs, storage and 7 admins = <strong>NZ$3.2M</strong></p>
<p>MS Exchange Hosted Services with a mid-tier option seclection @ US$90k/month =<strong> NZ$7.4M</strong> (at today&#8217;s exch rate of 0.72)</p>
<p>Google Apps Premier Edition @ US$50 per user per year = <strong>NZ$3.5M</strong></p>
<p>Now one stands out there and not for a particularly good reason. The MS EHS option does include Communicator and Hosted Archiving as an option but I don&#8217;t see the extra value over staying with what you have or sending it all to Google. Add to both the off-site options, the project costs of actually implementing this and your own Exchange would have to be in a bad way or have some serious pain to go either way.</p>
<p>What are your thoughts on this one? Are my locally run Exchange costs way off for 10k users and are there any NZ based companies of a similar size (<a href="http://www.nbr.co.nz/article/nz-post-signs-major-cloud-deal-with-google-it-first-domino-105999">NZ Post&#8217;s 2100 users are on the way to Google Apps</a>) that have taken either remote option? Is Google half the service or twice the value of the MS offering?</p>
<p>My last thought would be &#8211; just how reliable is that internet connection of yours?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2009/12/06/ms-exchange-local-vs-hosted-vs-google-for-10000-users/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Google Wave Invites</title>
		<link>http://www.wekadesign.co.nz/2009/11/14/google-wave-invites/</link>
		<comments>http://www.wekadesign.co.nz/2009/11/14/google-wave-invites/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 21:47:54 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Interesting Stuff]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[invites]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[wave]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/blog/2009/11/14/google-wave-invites/</guid>
		<description><![CDATA[I have 10 Google Wave invites to give away. If anybody would like one, please leave a comment below or DM @mikemcmurray on Twitter. First in first served.]]></description>
			<content:encoded><![CDATA[<p>I have 10 Google Wave invites to give away. If anybody would like one, please leave a comment below or DM @mikemcmurray on Twitter. First in first served.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2009/11/14/google-wave-invites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Version of Kisimi Wiki is Available</title>
		<link>http://www.wekadesign.co.nz/2009/10/27/new-version-of-kisimi-wiki-is-available/</link>
		<comments>http://www.wekadesign.co.nz/2009/10/27/new-version-of-kisimi-wiki-is-available/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 06:36:53 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[kisimi]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[wiki]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/blog/?p=78</guid>
		<description><![CDATA[I&#8217;m happy to announce that a new version of Weka Design&#8217;s free wiki software called Kisimi is available. There are a huge number of improvements in the 20091025 release. Here are some of the more important ones. Page security allows you to dictate exactly who can view and edit your pages. Some people can edit [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m happy to announce that a new version of Weka Design&#8217;s free wiki software called <a href="http://www.wekadesign.co.nz/projects/kisimi/">Kisimi</a> is available. There are a huge number of improvements in the <code>20091025</code> release. Here are some of the more important ones.</p>
<ul>
<li>
<div><a href="http://www.wekadesign.co.nz/projects/kisimi/index.php?id=kisimi:page_permissions" target="_blank">Page security</a> allows you to dictate exactly who can view and edit your pages. Some people can edit your pages, some can view and everyone else can’t see a thing. Security is as finely grained as you want it to be.</div>
</li>
<li>
<div>Kisimi now comes with an upgrade option at installation time and things are a little smarter. Installation can take less than 2 minutes!</div>
</li>
<li>
<div>Longer pages with headings can automatically generate a table of contents section.</div>
</li>
<li>
<div>Users can specify a <a href="http://www.wekadesign.co.nz/projects/kisimi/index.php?id=kisimi:date_timezone" target="_blank">timezone</a> so that the dates and times are relevant to their location.</div>
</li>
<li>
<div>Administrators can prevent new user sign ups. Handy for those sites publishing their documentation and support pages to the world.</div>
</li>
<li>
<div>Any user with an email address listed at <a title="http://www.gravatar.com" rel="nofollow" href="http://www.gravatar.com/">www.gravatar.com</a> has their avatar image appear in their preferences.</div>
</li>
<li>
<div>Tidier user interface with plenty of little shiny bits.</div>
</li>
<li>
<div>Plenty of <a title="http://www.wekadesign.co.nz/projects/mende/search.php?search=p%3Dkisimi&amp;submit=Search" rel="nofollow" href="../../projects/mende/search.php?search=p%3Dkisimi&amp;submit=Search">bug fixes</a> including those messages for PHP configs that show all warnings. It&#8217;s still recommnended that PHP is configured without warnings for production servers.</div>
</li>
</ul>
<p>Just head to <a href="http://kisimi.wekadesign.co.nz">http://kisimi.wekadesign.co.nz</a> to download the latest version and start managing your online wiki content better.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2009/10/27/new-version-of-kisimi-wiki-is-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
