Linux High Availability Part 1

Posted by BadReligion Mon, 14 Dec 2009 13:09:00 GMT

 I have been itching to dive into high availability clusters for quite some time now. As a network administrator uptime is a crucial part of my field. My goal in this series of blogs is to share my experience with setting up a high availability cluster using Linux systems.

Debriefing:

I will set up two virtual machines using VirtualBox. The two machines will both run Debian 5.0.2 i386 and will be on their own private network 192.168.2.0/24. The two nodes will together provide a high availability web and database service via Apache2 and MySQL using HA. With clustering an important factor is keeping data synchronized, that will be handled by DRDB.

 

Getting Up To Speed:

At this point I have setup my two virtual machines, Bravo and Echo, yes very original. I am using iptables on the host machine to masquerade the packets that need to go out to the Internet for the virtual machines. I have installed HA and drbd8 via the Debian packaging system. I configured HA using the Installing Heartbeat (Newbie) screencast tutorial. Similarly I configured a very simple setup of DRBD following the documentation. Now then, lets get into the details of my progress so far.

Networking Woes:

Ok, so the networking part of this mission was a slight barrier. I recall in the past I struggled to get multiple virtual machines to communicate with each other with VirtualBox. This time I seem to have planted that issue right on its ass, and I'm going to explain just how I did it.

In order to get virtual machines to network we need to change the guest operating systems from "NAT" to "Host Interface" in the "Network" settings. If only it were this simple! Well we actually need a "TAP" interface for the guest operating system to use. Lets hop into the trenches shall we?

First we need to let the kernel know wish to act like a router, forwarding packets:

Note this can also be set in /etc/sysctl.conf then it will not have to be set at every boot.
echo 1 > /proc/sys/net/ipv4/ip_forward

Next we need to create our TAP interfaces:

The interface names are arbitrary but it is important that the same name is used when assigning them to each virtual machine.
tunctl -t tap0 -u username
tunctl -t tap1 -u username
ifconfig tap0 up
ifconfig tap1 up

Now lets create a bridge interface and add our TAP interfaces:

The IP assigned is arbitrary but do make note of it
brctl addbr br0
brctl addif br0 tap0
brctl addif br0 tap1
ifconfig br0 up
ifconfig br0 192.168.2.1

Now assign each one of the TAP interfaces to each virtual machine and start them up. Assign an IP address to each virtual machine that is in the same network as the bridge interface on the host system. The virtual machines should be able to ping each other as well as the host system. Notice that they can not get out to the Internet though. For this we will need some help from iptables:

Beware that using MASQUERADE target is not technically proper with static IP addresses, however its the only way I can get NAT to work properly in this situation. The rule below should not be considered a permanent solution, I don't plan on leaving it that way at least.
iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -j MASQUERADE

Now the virtual machines should be able to ping each other, and also make it out to the Internet, assuming that other barriers do not exist like firewalls etc.

I will end part 1 at this point. I will catch up on configuring HA and DRBD in part 2 and hopefully at that point also have some more information to share, for now its off to bed and preparing for Monday.

So long

 

Posted in , ,  | no comments

Dell Inspiron Zino HD Where Is Linux

Posted by BadReligion Wed, 02 Dec 2009 01:36:00 GMT

Although I was extraordinarily excited about Dell's Zino HD I was quickly let down to find out Linux is NOT offered as an operating system choice.

At the base model (even adding some some features) the price point is great in my opinion. The base model of the Inspiron Zino HD can be had for just a little more than $200. I had read rumors that Linux was offered on the Zino HD, after attempting to customize one of the models I found there was no Linux option available. After a few days I called Dell and spoke to sales representative who assured me the Zino HD was not available with Linux. The rep was quick to push me toward another Inspiron for around $500 that came with Linux. At this point I explained that my interest was more involved with purchasing a unit that does NOT come with Windows, than a unit that is offered with Linux, even if a discount is not granted.

Still the response was the same.

If Dell does offer the Inspiron Zino HD with Linux or at least without Windows I will most certainly purchase a unit. Of course this assumes they will not only offer Linux on a high priced model. My guess is that Dell has some contract with Microsoft on the Inspiron Zino HD in relation to the new release of Windows 7.

Until then I'm off to find other low priced mini/multimedia computing solutions that are more open to the idea that not EVERYONE wants a Microsoft product.

Posted in ,  | Tags , , , ,  | no comments

Damn Capacitors!

Posted by BadReligion Sun, 04 Oct 2009 06:03:00 GMT

I can not believe how unbelievably difficult it is to find a 470uF 10V capacitor that is less than 8mm in diameter. I need one that is about 1/4in (roughly 6mm). The fact that these are so difficult to find tells me that perhaps they are too small to begin with hence the reason they are failing.

Everything I find is 8mm or bigger! I need 4 of these to replace bulging capacitors in a Gateway machine that went south. Its still a very capable machine though and I would love to ressurect it from the dead.

Back to scraping the net to hopefully find a match.

Update: I did find the capacitors I needed at the following eBay stores:

PC Motherboard Capacitors Store
A website also exists at:www.capselling.com

sunpec

Posted in  | Tags , , ,  | no comments

Replacing Square Brackets With Sed

Posted by BadReligion Mon, 28 Sep 2009 21:21:00 GMT

For me the following do not work:

sed 's/(\[|\])//g'
sed 's/[[]]//g'
The following do work:
sed 's/[][]//g'
sed -e 's/\[//g' -e 's/\]//g'

Example:

echo '[foobar]' | sed 's/[][]//g'
>foobar

echo '[foo]bar' | sed 's/[][]//g'
>foobar

The environment is Debian 4.0, GNU sed version 4.1.5.

Posted in ,  | Tags  | no comments

Setup Amavisd-new

Posted by BadReligion Tue, 15 Sep 2009 09:39:00 GMT

I finally configured amavisd-new with my Postfix configuration. It is a simple setup using only ClamAV and Spamassassin. However I do want to implement DKIM through amavisd-new of course that requires a newer version of amavisd-new than is in the packaging system of the release of Ubuntu I am running.

Further I would like to switch my Linode to Debian over Ubuntu.

It is safe to expect some downtime soon likely tonight as a result of upgrading through two releases.

I will post a part 2 once the upgrade is complete and I implement DKIM with the details of what I did.

Posted in , , ,  | Tags , , , , , , , ,  | no comments

Rocky Migration

Posted by BadReligion Sun, 06 Sep 2009 23:02:00 GMT

So the move to Typo has not gone as smooth as I'd hoped. Not to any fault of the Typo software, I feel that the issues are mostly related to typical migration from a custom built application to a prebuilt solution. Furthermore I am not turning back by any means. I know that once I get some of the details ironed out the site will get more attention and I will be much happier with it.

I need to tweak my Capistrano deployment scripts to be Typo friendly. Some confusion seems to exist when Capistrano tries to restart Typo, I have concluded that when Typo tries to stop the current running daemon it cannot find the pid.txt because it exists in the previous release which has already been unlinked. Some simple Capistrano magic will fix that.

I am also having some issues with themes. They worked fine at first but now it seems that only the default Typo theme actually installs its images and stylesheets into public. Each theme when active installs its custom images and stylesheets into public/images/theme and public/stylesheets/theme. The proper URL's are not generated either.

Lastly I have only migrated in the old blogs, I have migrated categories but none are linked up yet. I will probably migrate the comments, but since so few exist I have prioritized getting the site functioning the way I want it.

Posted in , , ,  | Tags , , , , ,  | no comments

Considering Moving To Typo

Posted by BadReligion Thu, 03 Sep 2009 10:00:00 GMT

I am considering moving the site to Typo to replace the blog and using Flickr to manage the photo album. I am not sure what I will do about the Utilities. I need to see if I can easily extend Typo or not.

The main reason for this is simply that I end up spending more time managing code and adding new features than I do managing the content of the site. I have yet to dive into Typo and see what capabilities are there. Hopefully if I decide to make this migration, the change will cause me to upload more photos, write more blogs about stuff nobody cares about, and just improve the content of the site in general.

Sean

Posted in , , ,  | no comments

Microsoft Mail User Agents

Posted by BadReligion Fri, 10 Jul 2009 20:41:00 GMT

An excerpt from Mailing List Etiquette on FreeBSD.


Please use a standards-compliant Mail User Agent (MUA). A lot of badly formatted messages come from bad mailers or badly configured mailers. The following mailers are known to send out badly formatted messages without you finding out about them:

  • * cc:Mail
  • * Eudora� (older versions)
  • * exmh
  • * Microsoft� Exchange
  • * Microsoft Internet Mail
  • * Microsoft Outlook�
  • * Netscape� (older versions)

As you can see, the mailers in the Microsoft world are frequent offenders. If at all possible, use a UNIX� mailer. If you must use a mailer under Microsoft environments, make sure it is set up correctly. Try not to use MIME: a lot of people use mailers which do not get on very well with MIME.


I just find this hilarious. I mean what exactly defines user friendly? Software that has shiny buttons or that formats its data in a way that complies with standards and is compatible with other users *standard compliant* software?!

Sean

Posted in , ,  | no comments

Writing Cron Jobs With Rails Part 1

Posted by BadReligion Fri, 26 Jun 2009 08:42:00 GMT

I am working on a personal use Rails application that I use to create reminders using Cron...

There are a couple gems that are useful for dealing with Cron using Ruby. The first is rbcrontab which allows you to create crontab entries using Ruby. The other is trak3r-crontabr which actually maintains a crontab using Ruby. The latter of the two might be easier to use for those who do not understand Cron syntax but know Ruby well. I am leaning toward rbcrontab right now simply because I feel it may fit my needs better than trak3r-crontabr.

I'm not sure that I really need a full blown web interface or not. It would be nice but I think what I really need is just a mailer with templates. I don't know, once I figure out the details I will make a part 2.

Sean

Posted in , ,  | no comments

Configure Unknown Monitors Xorg

Posted by BadReligion Tue, 16 Jun 2009 06:10:00 GMT

I recently had to configure Xorg to run a 40" LCD monitor. The monitor did not seem to support EDID queries. To my understanding this is essentially a protocol that most monitors support to explain what modes they support and give general information about the monitor.

After a little Google searching and not finding anything on the model number of the unit which is 40LC45S. I eventually found this this modeline generator in this link. All you need to know are the resolution and refresh rate combination(s).

Sean

Posted in ,  | no comments