Xen Cluster Management With Ganeti On Debian Etch - Page 3
3 Preparing The Physical Nodes
node1/node2:
First we update the packages database:
apt-get update
Then we install OpenSSH and a full-featured vim text editor (unless you prefer another text editor such as nano):
apt-get install ssh openssh-server vim-full
node1:
Because the Debian Etch installer has configured our system to get its network settings via DHCP, we have to change that now because a server should have a static IP address. Edit /etc/network/interfaces and adjust it to your needs (please note that I replace allow-hotplug eth0 with auto eth0; otherwise restarting the network doesn't work, and we'd have to reboot the whole system):
vi /etc/network/interfaces
# The loopback network interface auto lo iface lo inet loopback # The primary network interface #allow-hotplug eth0 #iface eth0 inet dhcp auto eth0 iface eth0 inet static address 192.168.0.100 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1 |
Then restart your network:
/etc/init.d/networking restart
Then edit /etc/hosts. Make it look like this:
vi /etc/hosts
127.0.0.1 localhost.localdomain localhost 192.168.0.100 node1.example.com node1 cluster1.example.com cluster1 192.168.0.101 node2.example.com node2 192.168.0.105 inst1.example.com inst1 # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts |
Next we must make sure that the commands
hostname
and
hostname -f
print out the full hostname (node1.example.com). If you get something different (e.g. just node1), do this:
echo node1.example.com > /etc/hostname
/etc/init.d/hostname.sh start
Afterwards, the hostname commands should show the full hostname.
node2:
Now we do the same again on node2.example.com:
vi /etc/network/interfaces
# The loopback network interface auto lo iface lo inet loopback # The primary network interface #allow-hotplug eth0 #iface eth0 inet dhcp auto eth0 iface eth0 inet static address 192.168.0.101 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1 |
/etc/init.d/networking restart
vi /etc/hosts
127.0.0.1 localhost.localdomain localhost 192.168.0.100 node1.example.com node1 cluster1.example.com cluster1 192.168.0.101 node2.example.com node2 192.168.0.105 inst1.example.com inst1 # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts |
echo node2.example.com > /etc/hostname
/etc/init.d/hostname.sh start
node1/node2:
Edit /etc/apt/sources.list. Comment out the CD. It should look like this:
vi /etc/apt/sources.list
# # deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official i386 NETINST Binary-1 20070407-11:29]/ etch contrib main #deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official i386 NETINST Binary-1 20070407-11:29]/ etch contrib main deb http://ftp2.de.debian.org/debian/ etch main deb-src http://ftp2.de.debian.org/debian/ etch main deb http://security.debian.org/ etch/updates main contrib deb-src http://security.debian.org/ etch/updates main contrib |
Then run
apt-get update
to update the apt packages database and
apt-get upgrade
to install the latest updates (if there are any). Afterwards, install the build-essential package:
apt-get install build-essential
4 Installing Xen
node1/node2:
Next we install Xen on both physical nodes:
apt-get install xen-linux-system-2.6.18-5-xen-686 libc6-xen
Then we edit /etc/xen/xend-config.sxp and modify the dom0-min-mem line so that it looks like this:
vi /etc/xen/xend-config.sxp
[...] # Dom0 will balloon out when needed to free memory for domU. # dom0-min-mem is the lowest memory level (in MB) dom0 will get down to. # If dom0-min-mem=0, dom0 will never balloon out. (dom0-min-mem 0) [...] |
Next open /boot/grub/menu.lst and find the # xenhopt= and # xenkopt= lines and modify them as follows (don't remove the # at the beginning!):
vi /boot/grub/menu.lst
[...] ## Xen hypervisor options to use with the default Xen boot option # xenhopt=dom0_mem=64M ## Xen Linux kernel options to use with the default Xen boot option # xenkopt=console=tty0 nosmp [...] |
(Remember what I said about memory in chapter 1. If you have enough RAM, you should probably use 256M or 512M here, at least on production systems.)
Afterwards, update the GRUB boot loader:
update-grub
and reboot both physical nodes:
shutdown -r now
At the boot prompt, select the new Xen kernel and boot from it.
After the nodes have come up, do this:
cd /boot
ln -s vmlinuz-`uname -r` vmlinuz-2.6-xenU
ln -s initrd.img-`uname -r` initrd-2.6-xenU
5 Installing DRBD
node1/node2:
Next we install DRBD:
apt-get install drbd0.7-module-source drbd0.7-utils
Now we must compile and enable the DRBD kernel module:
m-a update
m-a a-i drbd0.7
echo drbd minor_count=64 >> /etc/modules
modprobe drbd minor_count=64