I’ve recently had to set up a new machine, but didn’t have an install
cdrom available, so I decided to use the easiest method for installing
Ubuntu; PXE booting. Here’s how I did it. PXE involves setting up two
simple technologies, DHCP and TFTP. We start by setting up TFTP.

TFTP is Trivial
File Transfer Protocol
, a cut down version of FTP. There are a
number of TFTP servers in Debian and Ubuntu, but not all of them support
the extensions that the pxelinux bootloader used by debian-installer
need. Experience has shown that tftpd-hpa works correctly, so we’ll want
to install that.

ace root% apt-get install tftpd-hpa

Note: If this installs an inetd at the same time, you may need to
restart the inetd so it enables the tftpd service.

The tftpd will serve files out of /var/lib/tftpboot, so we
need to add some files for it to serve. You can use this script to fetch
various netboot installers from Ubuntu’s servers.

#!/bin/bash

set -u
set -e

cd /var/lib/tftpboot

for dist in dapper feisty gutsy hardy intrepid; do
    mkdir -p $dist
    for arch in amd64 i386; do
        mkdir -p $dist/$arch/
        (cd $dist/$arch/ && ncftpget -RT 
           ftp://archive.ubuntu.com/ubuntu/dists/$dist/main/installer-$arch/current/images/netboot/)
    done
done

Download ubuntu-tftp-update.sh

Now we need to alter our dhcpd configuration. (You are using DHCP
aren’t you?) All we need to add is a group declaration to your subnet
declaration, adding a next-server and a filename
parameter. You can then add a host declaration for any machine you want
to netboot into the installer.

group { # intrepid amd64
     next-server 10.0.0.1;
     filename "intrepid/amd64/pxelinux.0";
     host foobar { hardware ethernet 00:22:15:45:cc:fa; fixed-address foobar.example.com; }
}

You’ll need to restart the dhcp server so it picks up the new
setting. The next-server parameter is the name or IP address of your
tftp server. filename is the path to the bootloader. Obviously,
you can use this to pick which version of the installer you want to
run. If you do a lot of installations, it might be worth configuring
every installer you’re likely to use and then move hosts in and out of
the suitable group as and when you need to install them.

All that’s left to do now is to boot the computer and set it to boot
from the network and enjoy medialess installation.

Dear Lazyweb,

We have a web application that has quite a large database and
reasonable usage. Back in the dim and distant past, we scaled the
application by the age-old method of using several read-only slave
databases to prevent reads on the master swamping writes. This worked
well for several years, and then we introduced memcached into the mix to
improve performance by reducing the number of reads from the database.
This improved our database capacity even further.

Now the question has
arisen about reducing or even removing the code to read from the slaves.
I’m trying to come up with some compelling reasons to keep the
application reading from the slaves. The pros and cons I currently have
for removing the code are:

Pros
  • Reduces code complexity
  • Removes consistency problems due to latency in the replication. This is less of a
    problem than it used to be after we solved a problem with our
    replication
Cons
  • Reduces our existing capacity
  • Cache flushes would cause huge spikes on our master server until the
    cache filled up again
  • Caches wouldn’t help queries with unique critera

I would appreciate any additional reasons, pro or cons.
We already have an existing non-live slave for backups and slow
queries by developers. We would retain a slave for redundancy in the
case of master failure. I’m only looking for issues that would affect
the application.