1 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [
3 <article class="specification">
5 <title>Ganeti node/cluster installation tutorial</title>
7 <para>Documents Ganeti version 1.2</para>
10 <title>Introduction</title>
13 Ganeti is a cluster virtualization management system. This
14 document explains how to bootstrap a Ganeti node and create a
15 running cluster. You need to repeat most of the steps in this
16 document for every node you want to install, but of course we
17 recommend creating some semi-automatic procedure if you plan to
18 deploy Ganeti on a medium/large scale.
21 <para>This document is divided into two main sections:
25 <simpara>Installation of the core system and base
29 <simpara>Configuration of the environment for
34 Each of these is divided into sub-sections. While a full Ganeti
35 system will need all of the steps specified, some are not strictly
36 required for every environment. Which ones they are, and why, is
37 specified in the corresponding sections.
41 While Ganeti itself is distribution-agnostic most of the
42 examples in this document will be targeted at Debian or
43 Debian-derived distributions. You are expected to be familiar
44 with your distribution, its package management system, and Xen
45 before trying to use Ganeti.
49 A basic Ganeti terminology glossary is provided in the
50 introductory section of the "admin guide". Please refer to that
51 if you are uncertain about the terms we are using.
57 <title>Installing the system and base components</title>
60 <title>Installing the base system</title>
62 <para><emphasis role="strong">Mandatory.</emphasis></para>
65 Please install your operating system as you would normally
66 do. The only requirement you need to be aware of at this stage
67 is to partition leaving enough space for a big LVM volume
68 group which will then host your instance file systems. You can
69 even create the volume group at installation time, of course:
70 the default volume group name Ganeti 1.2 uses is "xenvg" but
71 you may name it differently should you wish to, as long as the
72 name is the same for all the nodes in the cluster.
78 <title>Installing Xen</title>
81 <emphasis role="strong">Mandatory:</emphasis> While Ganeti is
82 developed with the ability to modularly run on different
83 virtualization environments in mind the only one currently
84 useable on a live system is <ulink
85 url="http://xen.xensource.com/">Xen</ulink>.
89 Please follow your distribution's recommended way to install
90 and set up Xen, or install Xen from the upstream source, if
91 you wish, following their manual.
95 For example under Debian 4.0 or 3.1+backports you can install
96 the relevant xen-linux-system package, which will pull in both
97 the hypervisor and the relevant kernel. On Ubuntu (from Gutsy
98 on) the package is called ubuntu-xen-server.
102 After installing Xen you need to reboot into your xenified
103 dom0 system. Again on some distributions this might involve
104 configuring GRUB appropriately.
110 <title>Installing DRBD</title>
113 Recommended: <ulink url="http://www.drbd.org/">DRBD</ulink>
114 is required if you want to use the high availability (HA)
115 features of Ganeti, but optional if you don't require HA or
116 only run Ganeti on single-node clusters. You can upgrade a
117 non-HA cluster to an HA one later, but you might need to
118 export and reimport all your instances to take advantage of
123 Now the bad news: unless your distribution already provides it
124 installing DRBD might involve recompiling your kernel or
125 anyway fiddling with it. Hopefully at least the xenified
126 kernel source to start from will be provided.
130 Under Debian you can just install the drbd0.7-module-source
131 and drbd0.7-utils packages, and your kernel source, and then
132 run module-assistant to compile the drbd0.7 module. The
133 following commands should do it:
142 The good news is that you don't need to configure DRBD at all.
143 Ganeti will do it for you for every instance you set up. If
144 you have the DRBD utils installed and the module in your
145 kernel you're fine. Please check that your system is
146 configured to load the module at every boot.
152 <title>Other required software</title>
154 <para>Besides Xen and DRBD, you will need to install the
159 <simpara><ulink url="http://sourceware.org/lvm2/">LVM
160 version 2</ulink></simpara>
164 url="http://www.openssl.org/">OpenSSL</ulink></simpara>
168 url="http://www.openssh.com/portable.html">OpenSSH</ulink></simpara>
171 <simpara><ulink url="http://bridge.sourceforge.net/">Bridge
172 utilities</ulink></simpara>
176 url="http://fping.sourceforge.net/">fping</ulink></simpara>
180 url="http://developer.osdl.org/dev/iproute2">iproute2</ulink></simpara>
184 url="ftp://ftp.inr.ac.ru/ip-routing/iputils-current.tar.gz">arping</ulink>
185 (part of iputils package)</simpara>
189 url="http://www.kernel.org/pub/linux/utils/raid/mdadm/">mdadm</ulink>
190 (Linux Software Raid tools)</simpara>
193 <simpara><ulink url="http://www.python.org">Python 2.4</ulink></simpara>
196 <simpara><ulink url="http://twistedmatrix.com/">Python
197 Twisted library</ulink> - the core library is
202 url="http://pyopenssl.sourceforge.net/">Python OpenSSL
203 bindings</ulink></simpara>
207 <para>These programs are supplied as part of most Linux
208 distributions, so usually they can be installed via apt or
209 similar methods. Also many of them will already be installed on
210 a standard machine. On Debian Etch you can use this command line
211 to install all of them:</para>
214 # apt-get install lvm2 ssh bridge-utils iproute iputils-arping \
215 fping python2.4 python-twisted-core python-pyopenssl openssl
219 When installing from source, you will also need the following:
223 <simpara>make</simpara>
226 <simpara>tar</simpara>
229 <simpara>gzip or bzip2</simpara>
234 Again, these are available in most if not all linux distributions. For Debian, do:
236 # apt-get install make tar gzip bzip2
245 <title>Setting up the environment for Ganeti</title>
248 <title>Configuring the network</title>
250 <para>Ganeti relies on Xen running in "bridge mode", which means the
251 instances network interfaces will be attached to a software bridge
252 running in dom0. Xen by default creates such a bridge at startup, but
253 your distribution might have a different way to do things.
257 In Debian, in order to enable the default Xen behaviour, you
258 have to edit <filename>/etc/xen/xend-config.sxp</filename> and
259 replace <computeroutput>(network-script
260 network-dummy)</computeroutput> with
261 <computeroutput>(network-script
262 network-bridge)</computeroutput>. The recommended Debian way to
263 configure things, though, is to edit your
264 <filename>/etc/network/interfaces</filename> file and substitute
265 your normal ethernet stanza with something like:</para>
269 iface br0 inet static
270 address <replaceable>YOUR_IP_ADDRESS</replaceable>
271 netmask <replaceable>YOUR_NETMASK</replaceable>
272 network <replaceable>YOUR_NETWORK</replaceable>
273 broadcast <replaceable>YOUR_BROADCAST_ADDRESS</replaceable>
274 gateway <replaceable>YOUR_GATEWAY</replaceable>
275 bridge_ports <replaceable>eth0</replaceable>
281 Beware that the default name Ganeti uses is
282 <hardware>xen-br0</hardware> (which was used in Xen 2.0)
283 while Xen 3.0 uses <hardware>xenbr0</hardware> by
284 default. The default bridge your cluster will use for new
285 instances can be specified at cluster initialization time.
291 <title>Configuring LVM</title>
294 If you haven't configured your LVM volume group at install
295 time you need to do it before trying to initialize the Ganeti
296 cluster. This is done by formatting the devices/partitions you
297 want to use for it and then adding them to the relevant volume
305 vgcreate xenvg /dev/sda4 /dev/sdb /dev/sdc1
309 If you want to add a device later you can do so with the
310 <citerefentry><refentrytitle>vgextend</refentrytitle>
311 <manvolnum>8</manvolnum></citerefentry> command:
316 vgextend xenvg /dev/sdd
320 As said before you may choose a different name for the volume group,
321 as long as you stick to the same name on all the nodes of a cluster.
326 <title>Installing Ganeti</title>
329 It's now time to install the Ganeti software itself. You can
330 do it from source, with the usual steps (note that the
331 <option>localstatedir</option> options must be set to
332 <filename class="directory">/var</filename>):
336 ./configure --localstatedir=/var
339 mkdir /srv/ganeti/ /srv/ganeti/os /srv/ganeti/export
343 You also need to copy from the source archive the file
344 <filename>docs/examples/ganeti.initd</filename> to
345 <filename>/etc/init.d/ganeti</filename> and register it into
346 your distribution's startup scripts, for example in Debian:
348 <screen>update-rc.d ganeti defaults 20 80</screen>
353 <title>Installing the Operating System support packages</title>
356 Another important component for Ganeti are the OS support
357 packages, which let different operating systems be used as
358 instances. You can grab a simple package that allows
359 installing Debian Etch instances on the project web site
360 (after download, untar it and follow the instructions in the
361 <filename>README</filename> file).
365 Alternatively, you can create your own OS definitions, see
367 <refentrytitle>ganeti-os-interface</refentrytitle>
368 <manvolnum>8</manvolnum>
375 <title>Initializing the cluster</title>
377 <para><emphasis role="strong">Mandatory:</emphasis> only on one
378 node per cluster.</para>
381 <para>The last step is to initialize the cluster. After you've repeated
382 the above process or some semi-automatic form of it on all of your
383 nodes choose one as the master, and execute:
387 gnt-cluster init <replaceable>CLUSTERNAME</replaceable>
391 If the node's network interface which will be used for access
392 from outside the cluster is not named
393 <hardware>xen-br0</hardware>, you need to use the
394 <option>--master-netdev=<replaceable>IFNAME</replaceable></option>
395 option, replacing <replaceable>IFNAME</replaceable> with the
396 correct one for your case (e.g. <hardware>xenbr0</hardware>,
397 <hardware>eth0</hardware>, etc.). Usually this will be the
398 same as the default bridge name (see below).
402 Other options you can pass to <command>gnt-cluster
403 init</command> include the default bridge name
404 (<option>-b</option>), the cluster-wide name for the volume
405 group (<option>-g</option>) and the secondary ip address for
406 the initial node should you wish to keep the data replication
407 network separate. Invoke it with <option>--help</option> to
408 see all the possibilities.
412 Note that the cluster name must exist in DNS. You must choose
413 a name different from any of the nodes names for a multi-node
414 cluster. In general the best choice is to have a unique name
415 for a cluster, even if it consists of only one machine, as you
416 will be able to expand it later without any problem.
421 <title>Joining the nodes to the cluster.</title>
424 <emphasis role="strong">Mandatory:</emphasis> for all the
429 If you have already initialized your cluster you need to join the other
430 nodes to it. You can do so by executing the following command on the
433 gnt-node add <replaceable>NODENAME</replaceable>
436 The only option is <option>-s</option>, which sets the node's
437 secondary ip address for replication purposes, if you are
438 using a separate replication network.
445 <title>This is it!</title>
448 Now you can follow the admin guide to use your new Ganeti