Forward-port: patch 4/4 extended HVM features for 1.2
[ganeti-local] / doc / install.sgml
1 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [
2 ]>
3   <article class="specification">
4   <articleinfo>
5     <title>Ganeti installation tutorial</title>
6   </articleinfo>
7   <para>Documents Ganeti version 1.2</para>
8
9   <sect1>
10     <title>Introduction</title>
11
12     <para>
13       Ganeti is a cluster virtualization management system based on
14       Xen. This document explains how to bootstrap a Ganeti node (Xen
15       <literal>dom0</literal>), create a running cluster and install
16       virtual instance (Xen <literal>domU</literal>).  You need to
17       repeat most of the steps in this document for every node you
18       want to install, but of course we recommend creating some
19       semi-automatic procedure if you plan to deploy Ganeti on a
20       medium/large scale.
21     </para>
22
23     <para>
24       A basic Ganeti terminology glossary is provided in the
25       introductory section of the <emphasis>Ganeti administrator's
26       guide</emphasis>. Please refer to that document if you are
27       uncertain about the terms we are using.
28     </para>
29
30     <para>
31       Ganeti has been developed for Linux and is
32       distribution-agnostic.  This documentation will use Debian Etch
33       as an example system but the examples can easily be translated
34       to any other distribution.  You are expected to be familiar with
35       your distribution, its package management system, and Xen before
36       trying to use Ganeti.
37     </para>
38
39     <para>This document is divided into two main sections:
40
41       <itemizedlist>
42         <listitem>
43           <simpara>Installation of the base system and base
44             components</simpara>
45         </listitem>
46         <listitem>
47           <simpara>Configuration of the environment for
48             Ganeti</simpara>
49         </listitem>
50       </itemizedlist>
51
52       Each of these is divided into sub-sections. While a full Ganeti system
53       will need all of the steps specified, some are not strictly required for
54       every environment. Which ones they are, and why, is specified in the
55       corresponding sections.
56     </para>
57
58   </sect1>
59
60   <sect1>
61     <title>Installing the base system and base components</title>
62
63     <sect2>
64       <title>Hardware requirements</title>
65
66       <para>
67         Any system supported by your Linux distribution is fine.  64-bit
68         systems are better as they can support more memory.
69       </para>
70
71       <para>
72         Any disk drive recognized by Linux
73         (<literal>IDE</literal>/<literal>SCSI</literal>/<literal>SATA</literal>/etc.)
74         is supported in Ganeti. Note that no shared storage (e.g.
75         <literal>SAN</literal>) is needed to get high-availability features. It
76         is highly recommended to use more than one disk drive to improve speed.
77         But Ganeti also works with one disk per machine.
78       </para>
79
80     <sect2>
81       <title>Installing the base system</title>
82
83       <para>
84         <emphasis role="strong">Mandatory</emphasis> on all nodes.
85       </para>
86
87       <para>
88         It is advised to start with a clean, minimal install of the
89         operating system. The only requirement you need to be aware of
90         at this stage is to partition leaving enough space for a big
91         (<emphasis role="strong">minimum
92         <constant>20GiB</constant></emphasis>) LVM volume group which
93         will then host your instance filesystems. The volume group
94         name Ganeti 1.2 uses (by default) is
95         <emphasis>xenvg</emphasis>.
96       </para>
97
98       <para>
99         While you can use an existing system, please note that the
100         Ganeti installation is intrusive in terms of changes to the
101         system configuration, and it's best to use a newly-installed
102         system without important data on it.
103       </para>
104
105       <para>
106         Also, for best results, it's advised that the nodes have as
107         much as possible the same hardware and software
108         configuration. This will make administration much easier.
109       </para>
110
111       <sect3>
112         <title>Hostname issues</title>
113         <para>
114           Note that Ganeti requires the hostnames of the systems
115           (i.e. what the <computeroutput>hostname</computeroutput>
116           command outputs to be a fully-qualified name, not a short
117           name. In other words, you should use
118           <literal>node1.example.com</literal> as a hostname and not
119           just <literal>node1</literal>.
120         </para>
121
122         <formalpara>
123           <title>Debian</title>
124           <para>
125             Note that Debian Etch configures the hostname differently
126             than you need it for Ganeti. For example, this is what
127             Etch puts in <filename>/etc/hosts</filename> in certain
128             situations:
129 <screen>
130 127.0.0.1       localhost
131 127.0.1.1       node1.example.com node1
132 </screen>
133
134           but for Ganeti you need to have:
135 <screen>
136 127.0.0.1       localhost
137 192.168.1.1     node1.example.com node1
138 </screen>
139             replacing <literal>192.168.1.1</literal> with your node's
140             address. Also, the file <filename>/etc/hostname</filename>
141             which configures the hostname of the system should contain
142             <literal>node1.example.com</literal> and not just
143             <literal>node1</literal> (you need to run the command
144             <computeroutput>/etc/init.d/hostname.sh
145             start</computeroutput> after changing the file).
146           </para>
147         </formalpara>
148       </sect3>
149
150     </sect2>
151
152     <sect2>
153       <title>Installing Xen</title>
154
155       <para>
156         <emphasis role="strong">Mandatory</emphasis> on all nodes.
157       </para>
158
159       <para>
160         While Ganeti is developed with the ability to modularly run on
161         different virtualization environments in mind the only one
162         currently useable on a live system is <ulink
163         url="http://xen.xensource.com/">Xen</ulink>. Supported
164         versions are: <simplelist type="inline">
165         <member><literal>3.0.3</literal></member>
166         <member><literal>3.0.4</literal></member>
167         <member><literal>3.1</literal></member> </simplelist>.
168       </para>
169
170       <para>
171         Please follow your distribution's recommended way to install
172         and set up Xen, or install Xen from the upstream source, if
173         you wish, following their manual.
174       </para>
175
176       <para>
177         After installing Xen you need to reboot into your Xen-ified
178         dom0 system. On some distributions this might involve
179         configuring GRUB appropriately, whereas others will configure
180         it automatically when you install Xen from a package.
181       </para>
182
183       <formalpara><title>Debian</title>
184       <para>
185         Under Debian Etch or Sarge+backports you can install the
186         relevant <literal>xen-linux-system</literal> package, which
187         will pull in both the hypervisor and the relevant
188         kernel. Also, if you are installing a 32-bit Etch, you should
189         install the <computeroutput>libc6-xen</computeroutput> package
190         (run <computeroutput>apt-get install
191         libc6-xen</computeroutput>).
192       </para>
193       </formalpara>
194
195       <sect3>
196         <title>Xen settings</title>
197
198         <para>
199           It's recommended that dom0 is restricted to a low amount of
200           memory (<constant>512MiB</constant> is reasonable) and that
201           memory ballooning is disabled in the file
202           <filename>/etc/xen/xend-config.sxp</filename> by setting the
203           value <literal>dom0-min-mem</literal> to
204           <constant>0</constant>, like this:
205           <computeroutput>(dom0-min-mem 0)</computeroutput>
206         </para>
207
208         <para>
209           For optimum performance when running both CPU and I/O
210           intensive instances, it's also recommended that the dom0 is
211           restricted to one CPU only, for example by booting with the
212           kernel parameter <literal>nosmp</literal>.
213         </para>
214
215         <para>
216           It is recommended that you disable xen's automatic save of virtual
217           machines at system shutdown and subsequent restore of them at reboot.
218           To obtain this make sure the variable
219           <literal>XENDOMAINS_SAVE</literal> in the file
220           <literal>/etc/default/xendomains</literal> is set to an empty value.
221         </para>
222
223         <formalpara>
224           <title>Debian</title>
225           <para>
226             Besides the ballooning change which you need to set in
227             <filename>/etc/xen/xend-config.sxp</filename>, you need to
228             set the memory and nosmp parameters in the file
229             <filename>/boot/grub/menu.lst</filename>. You need to
230             modify the variable <literal>xenhopt</literal> to add
231             <userinput>dom0_mem=512M</userinput> like this:
232 <screen>
233 ## Xen hypervisor options to use with the default Xen boot option
234 # xenhopt=dom0_mem=512M
235 </screen>
236             and the <literal>xenkopt</literal> needs to include the
237             <userinput>nosmp</userinput> option like this:
238 <screen>
239 ## Xen Linux kernel options to use with the default Xen boot option
240 # xenkopt=nosmp
241 </screen>
242
243           Any existing parameters can be left in place: it's ok to
244           have <computeroutput>xenkopt=console=tty0
245           nosmp</computeroutput>, for example. After modifying the
246           files, you need to run:
247 <screen>
248 /sbin/update-grub
249 </screen>
250           </para>
251         </formalpara>
252         <para>
253           If you want to test the HVM support
254           with Ganeti and want VNC access to the console of your
255           instances, set the following two entries in
256           <filename>/etc/xen/xend-config.sxp</filename>:
257 <screen>
258 (vnc-listen '0.0.0.0')
259 (vncpasswd '')
260 </screen>
261           You need to restart the Xen daemon for these settings to
262           take effect:
263 <screen>
264 /etc/init.d/xend restart
265 </screen>
266         </para>
267
268       </sect3>
269
270       <sect3>
271         <title>Selecting the instance kernel</title>
272
273         <para>
274           After you have installed Xen, you need to tell Ganeti
275           exactly what kernel to use for the instances it will
276           create. This is done by creating a
277           <emphasis>symlink</emphasis> from your actual kernel to
278           <filename>/boot/vmlinuz-2.6-xenU</filename>, and one from
279           your initrd to
280           <filename>/boot/initrd-2.6-xenU</filename>. Note that if you
281           don't use an initrd for the <literal>domU</literal> kernel,
282           you don't need to create the initrd symlink.
283         </para>
284
285         <formalpara>
286           <title>Debian</title>
287           <para>
288             After installation of the
289             <literal>xen-linux-system</literal> package, you need to
290             run (replace the exact version number with the one you
291             have):
292             <screen>
293 cd /boot
294 ln -s vmlinuz-2.6.18-5-xen-686 vmlinuz-2.6-xenU
295 ln -s initrd.img-2.6.18-5-xen-686 initrd-2.6-xenU
296             </screen>
297           </para>
298         </formalpara>
299       </sect3>
300
301     </sect2>
302
303     <sect2>
304       <title>Installing DRBD</title>
305
306       <para>
307         Recommended on all nodes: <ulink
308         url="http://www.drbd.org/">DRBD</ulink> is required if you
309         want to use the high availability (HA) features of Ganeti, but
310         optional if you don't require HA or only run Ganeti on
311         single-node clusters. You can upgrade a non-HA cluster to an
312         HA one later, but you might need to export and re-import all
313         your instances to take advantage of the new features.
314       </para>
315
316       <para>
317         Supported DRBD versions: <literal>8.0.x</literal>.
318         It's recommended to have at least version <literal>8.0.7</literal>.
319       </para>
320
321       <para>
322         Now the bad news: unless your distribution already provides it
323         installing DRBD might involve recompiling your kernel or
324         anyway fiddling with it. Hopefully at least the Xen-ified
325         kernel source to start from will be provided.
326       </para>
327
328       <para>
329         The good news is that you don't need to configure DRBD at all.
330         Ganeti will do it for you for every instance you set up.  If
331         you have the DRBD utils installed and the module in your
332         kernel you're fine. Please check that your system is
333         configured to load the module at every boot, and that it
334         passes the following option to the module
335         <computeroutput>minor_count=255</computeroutput>. This will
336         allow you to use up to 128 instances per node (for most clusters
337         <constant>128 </constant> should be enough, though).
338       </para>
339
340       <formalpara><title>Debian</title>
341         <para>
342          You can just install (build) the DRBD 8.0.x module with the
343          following commands (make sure you are running the Xen
344          kernel):
345         </para>
346       </formalpara>
347
348       <screen>
349 apt-get install -t etch-backports drbd8-module-source drbd8-utils
350 m-a update
351 m-a a-i drbd8
352 echo drbd minor_count=128 >> /etc/modules
353 modprobe drbd minor_count=128
354       </screen>
355
356       <para>
357         It is also recommended that you comment out the default
358         resources in the <filename>/etc/drbd.conf</filename> file, so
359         that the init script doesn't try to configure any drbd
360         devices. You can do this by prefixing all
361         <literal>resource</literal> lines in the file with the keyword
362         <literal>skip</literal>, like this:
363       </para>
364
365       <screen>
366 skip resource r0 {
367 ...
368 }
369
370 skip resource "r1" {
371 ...
372 }
373       </screen>
374
375     </sect2>
376
377     <sect2>
378       <title>Other required software</title>
379
380       <para>Besides Xen and DRBD, you will need to install the
381       following (on all nodes):</para>
382
383       <itemizedlist>
384         <listitem>
385           <simpara><ulink url="http://sourceware.org/lvm2/">LVM
386           version 2</ulink></simpara>
387         </listitem>
388         <listitem>
389           <simpara><ulink
390           url="http://www.openssl.org/">OpenSSL</ulink></simpara>
391         </listitem>
392         <listitem>
393           <simpara><ulink
394           url="http://www.openssh.com/portable.html">OpenSSH</ulink></simpara>
395         </listitem>
396         <listitem>
397           <simpara><ulink url="http://bridge.sourceforge.net/">Bridge
398           utilities</ulink></simpara>
399         </listitem>
400         <listitem>
401           <simpara><ulink
402           url="http://developer.osdl.org/dev/iproute2">iproute2</ulink></simpara>
403         </listitem>
404         <listitem>
405           <simpara><ulink
406           url="ftp://ftp.inr.ac.ru/ip-routing/iputils-current.tar.gz">arping</ulink>
407           (part of iputils package)</simpara>
408         </listitem>
409         <listitem>
410           <simpara><ulink url="http://www.python.org">Python 2.4</ulink></simpara>
411         </listitem>
412         <listitem>
413           <simpara><ulink
414           url="http://pyopenssl.sourceforge.net/">Python OpenSSL
415           bindings</ulink></simpara>
416         </listitem>
417         <listitem>
418           <simpara><ulink
419           url="http://www.undefined.org/python/#simplejson">simplejson Python
420           module</ulink></simpara>
421         </listitem>
422         <listitem>
423           <simpara><ulink
424           url="http://pyparsing.wikispaces.com/">pyparsing Python
425           module</ulink></simpara>
426         </listitem>
427       </itemizedlist>
428
429       <para>
430         These programs are supplied as part of most Linux
431         distributions, so usually they can be installed via apt or
432         similar methods. Also many of them will already be installed
433         on a standard machine.
434       </para>
435
436
437       <formalpara><title>Debian</title>
438
439       <para>You can use this command line to install all of them:</para>
440
441       </formalpara>
442       <screen>
443 # apt-get install lvm2 ssh bridge-utils iproute iputils-arping \
444   python2.4 python-pyopenssl openssl python-pyparsing python-simplejson
445       </screen>
446
447     </sect2>
448
449   </sect1>
450
451
452   <sect1>
453     <title>Setting up the environment for Ganeti</title>
454
455     <sect2>
456       <title>Configuring the network</title>
457
458       <para><emphasis role="strong">Mandatory</emphasis> on all nodes.</para>
459
460       <para>
461         Ganeti relies on Xen running in "bridge mode", which means the
462         instances network interfaces will be attached to a software bridge
463         running in dom0. Xen by default creates such a bridge at startup, but
464         your distribution might have a different way to do things.
465       </para>
466
467       <para>
468         Beware that the default name Ganeti uses is
469         <hardware>xen-br0</hardware> (which was used in Xen 2.0)
470         while Xen 3.0 uses <hardware>xenbr0</hardware> by
471         default. The default bridge your Ganeti cluster will use for new
472         instances can be specified at cluster initialization time.
473       </para>
474
475       <formalpara><title>Debian</title>
476         <para>
477           The recommended Debian way to configure the Xen bridge is to
478           edit your <filename>/etc/network/interfaces</filename> file
479           and substitute your normal Ethernet stanza with the
480           following snippet:
481
482         <screen>
483 auto xen-br0
484 iface xen-br0 inet static
485         address <replaceable>YOUR_IP_ADDRESS</replaceable>
486         netmask <replaceable>YOUR_NETMASK</replaceable>
487         network <replaceable>YOUR_NETWORK</replaceable>
488         broadcast <replaceable>YOUR_BROADCAST_ADDRESS</replaceable>
489         gateway <replaceable>YOUR_GATEWAY</replaceable>
490         bridge_ports eth0
491         bridge_stp off
492         bridge_fd 0
493         </screen>
494         </para>
495       </formalpara>
496
497      <para>
498 The following commands need to be executed on the local console
499      </para>
500       <screen>
501 ifdown eth0
502 ifup xen-br0
503       </screen>
504
505       <para>
506         To check if the bridge is setup, use <command>ip</command>
507         and <command>brctl show</command>:
508       <para>
509
510       <screen>
511 # ip a show xen-br0
512 9: xen-br0: &lt;BROADCAST,MULTICAST,UP,10000&gt; mtu 1500 qdisc noqueue
513     link/ether 00:20:fc:1e:d5:5d brd ff:ff:ff:ff:ff:ff
514     inet 10.1.1.200/24 brd 10.1.1.255 scope global xen-br0
515     inet6 fe80::220:fcff:fe1e:d55d/64 scope link
516        valid_lft forever preferred_lft forever
517
518 # brctl show xen-br0
519 bridge name     bridge id               STP enabled     interfaces
520 xen-br0         8000.0020fc1ed55d       no              eth0
521       </screen>
522
523
524     </sect2>
525
526     <sect2>
527       <title>Configuring LVM</title>
528
529
530       <para><emphasis role="strong">Mandatory</emphasis> on all nodes.</para>
531
532       <note>
533         <simpara>The volume group is required to be at least
534         <constant>20GiB</constant>.</simpara>
535       </note>
536       <para>
537         If you haven't configured your LVM volume group at install
538         time you need to do it before trying to initialize the Ganeti
539         cluster. This is done by formatting the devices/partitions you
540         want to use for it and then adding them to the relevant volume
541         group:
542
543        <screen>
544 pvcreate /dev/sda3
545 vgcreate xenvg /dev/sda3
546        </screen>
547 or
548        <screen>
549 pvcreate /dev/sdb1
550 pvcreate /dev/sdc1
551 vgcreate xenvg /dev/sdb1 /dev/sdc1
552        </screen>
553       </para>
554
555       <para>
556         If you want to add a device later you can do so with the
557         <citerefentry><refentrytitle>vgextend</refentrytitle>
558         <manvolnum>8</manvolnum></citerefentry> command:
559       </para>
560
561       <screen>
562 pvcreate /dev/sdd1
563 vgextend xenvg /dev/sdd1
564       </screen>
565
566       <formalpara>
567         <title>Optional</title>
568         <para>
569           It is recommended to configure LVM not to scan the DRBD
570           devices for physical volumes. This can be accomplished by
571           editing <filename>/etc/lvm/lvm.conf</filename> and adding
572           the <literal>/dev/drbd[0-9]+</literal> regular expression to
573           the <literal>filter</literal> variable, like this:
574 <screen>
575     filter = [ "r|/dev/cdrom|", "r|/dev/drbd[0-9]+|" ]
576 </screen>
577         </para>
578       </formalpara>
579
580     </sect2>
581
582     <sect2>
583       <title>Installing Ganeti</title>
584
585       <para><emphasis role="strong">Mandatory</emphasis> on all nodes.</para>
586
587       <para>
588         It's now time to install the Ganeti software itself.  Download
589         the source from <ulink
590         url="http://code.google.com/p/ganeti/"></ulink>.
591       </para>
592
593         <screen>
594 tar xvzf ganeti-@GANETI_VERSION@.tar.gz
595 cd ganeti-@GANETI_VERSION@
596 ./configure --localstatedir=/var --sysconfdir=/etc
597 make
598 make install
599 mkdir /srv/ganeti/ /srv/ganeti/os /srv/ganeti/export
600         </screen>
601
602       <para>
603         You also need to copy the file
604         <filename>doc/examples/ganeti.initd</filename>
605         from the source archive to
606         <filename>/etc/init.d/ganeti</filename> and register it with
607         your distribution's startup scripts, for example in Debian:
608       </para>
609       <screen>update-rc.d ganeti defaults 20 80</screen>
610
611       <para>
612         In order to automatically restart failed instances, you need
613         to setup a cron job run the
614         <computeroutput>ganeti-watcher</computeroutput> program. A
615         sample cron file is provided in the source at
616         <filename>doc/examples/ganeti.cron</filename> and you can
617         copy that (eventually altering the path) to
618         <filename>/etc/cron.d/ganeti</filename>
619       </para>
620
621     </sect2>
622
623     <sect2>
624       <title>Installing the Operating System support packages</title>
625
626       <para><emphasis role="strong">Mandatory</emphasis> on all nodes.</para>
627
628       <para>
629         To be able to install instances you need to have an Operating
630         System installation script. An example for Debian Etch is
631         provided on the project web site.  Download it from <ulink
632         url="http://code.google.com/p/ganeti/"></ulink> and follow the
633         instructions in the <filename>README</filename> file.  Here is
634         the installation procedure (replace <constant>0.2</constant>
635         with the latest version that is compatible with your ganeti
636         version):
637       </para>
638
639       <screen>
640 cd /srv/ganeti/os
641 tar xvf ganeti-instance-debian-etch-0.4.tar
642 mv ganeti-instance-debian-etch-0.4 debian-etch
643       </screen>
644
645       <para>
646         In order to use this OS definition, you need to have internet
647         access from your nodes and have the <citerefentry>
648         <refentrytitle>debootstrap</refentrytitle>
649         <manvolnum>8</manvolnum></citerefentry>, <citerefentry>
650         <refentrytitle>dump</refentrytitle><manvolnum>8</manvolnum>
651         </citerefentry> and <citerefentry>
652         <refentrytitle>restore</refentrytitle>
653         <manvolnum>8</manvolnum> </citerefentry> commands installed on
654         all nodes.
655       </para>
656       <formalpara>
657         <title>Debian</title>
658         <para>
659           Use this command on all nodes to install the required
660           packages:
661
662           <screen>apt-get install debootstrap dump</screen>
663         </para>
664       </formalpara>
665
666       <para>
667         Alternatively, you can create your own OS definitions. See the
668         manpage
669         <citerefentry>
670         <refentrytitle>ganeti-os-interface</refentrytitle>
671         <manvolnum>8</manvolnum>
672         </citerefentry>.
673       </para>
674
675     </sect2>
676
677     <sect2>
678       <title>Initializing the cluster</title>
679
680       <para><emphasis role="strong">Mandatory:</emphasis> only on one
681       node per cluster.</para>
682
683
684       <para>The last step is to initialize the cluster. After you've repeated
685         the above process on all of your nodes, choose one as the master, and execute:
686       </para>
687
688       <screen>
689 gnt-cluster init <replaceable>CLUSTERNAME</replaceable>
690       </screen>
691
692       <para>
693         The <replaceable>CLUSTERNAME</replaceable> is a hostname,
694         which must be resolvable (e.g. it must exist in DNS or in
695         <filename>/etc/hosts</filename>) by all the nodes in the
696         cluster. You must choose a name different from any of the
697         nodes names for a multi-node cluster. In general the best
698         choice is to have a unique name for a cluster, even if it
699         consists of only one machine, as you will be able to expand it
700         later without any problems.
701       </para>
702
703       <para>
704         If the bridge name you are using is not
705         <literal>xen-br0</literal>, use the <option>-b
706         <replaceable>BRIDGENAME</replaceable></option> option to
707         specify the bridge name. In this case, you should also use the
708         <option>--master-netdev
709         <replaceable>BRIDGENAME</replaceable></option> option with the
710         same <replaceable>BRIDGENAME</replaceable> argument.
711       </para>
712
713       <para>
714         You can use a different name than <literal>xenvg</literal> for
715         the volume group (but note that the name must be identical on
716         all nodes). In this case you need to specify it by passing the
717         <option>-g <replaceable>VGNAME</replaceable></option> option
718         to <computeroutput>gnt-cluster init</computeroutput>.
719       </para>
720
721       <para>
722         To set up the cluster as an HVM cluster, use the
723         <option>--hypervisor=xen-hvm3.1</option> option to use
724         the Xen 3.1 HVM hypervisor. Note that with the
725         HVM support, you will only be able to create
726         HVM instances in a cluster set to this hypervisor type. Mixed
727         PVM/HVM clusters are not supported by the Ganeti 1.2
728         HVM support. You will also need to create the VNC
729         cluster password  file
730         <filename>/etc/ganeti/vnc-cluster-password</filename>
731         which contains one line with the default VNC password for the
732         cluster.
733       </para>
734
735       <para>
736         You can also invoke the command with the
737         <option>--help</option> option in order to see all the
738         possibilities.
739       </para>
740
741     </sect2>
742
743     <sect2>
744       <title>Joining the nodes to the cluster</title>
745
746       <para>
747         <emphasis role="strong">Mandatory:</emphasis> for all the
748         other nodes.
749       </para>
750
751       <para>
752         After you have initialized your cluster you need to join the
753         other nodes to it. You can do so by executing the following
754         command on the master node:
755       </para>
756         <screen>
757 gnt-node add <replaceable>NODENAME</replaceable>
758         </screen>
759     </sect2>
760
761     <sect2>
762       <title>Separate replication network</title>
763
764       <para><emphasis role="strong">Optional</emphasis></para>
765       <para>
766         Ganeti uses DRBD to mirror the disk of the virtual instances
767         between nodes. To use a dedicated network interface for this
768         (in order to improve performance or to enhance security) you
769         need to configure an additional interface for each node.  Use
770         the <option>-s</option> option with
771         <computeroutput>gnt-cluster init</computeroutput> and
772         <computeroutput>gnt-node add</computeroutput> to specify the
773         IP address of this secondary interface to use for each
774         node. Note that if you specified this option at cluster setup
775         time, you must afterwards use it for every node add operation.
776       </para>
777     </sect2>
778
779     <sect2>
780       <title>Testing the setup</title>
781
782       <para>
783         Execute the <computeroutput>gnt-node list</computeroutput>
784         command to see all nodes in the cluster:
785       <screen>
786 # gnt-node list
787 Node              DTotal  DFree MTotal MNode MFree Pinst Sinst
788 node1.example.com 197404 197404   2047  1896   125     0     0
789       </screen>
790     </para>
791   </sect2>
792
793   <sect1>
794     <title>Setting up and managing virtual instances</title>
795     <sect2>
796       <title>Setting up virtual instances</title>
797       <para>
798         This step shows how to setup a virtual instance with either
799         non-mirrored disks (<computeroutput>plain</computeroutput>) or
800         with network mirrored disks
801         (<computeroutput>drbd</computeroutput>).  All
802         commands need to be executed on the Ganeti master node (the
803         one on which <computeroutput>gnt-cluster init</computeroutput>
804         was run).  Verify that the OS scripts are present on all
805         cluster nodes with <computeroutput>gnt-os
806         list</computeroutput>.
807       </para>
808       <para>
809         To create a virtual instance, you need a hostname which is
810         resolvable (DNS or <filename>/etc/hosts</filename> on all
811         nodes). The following command will create a non-mirrored
812         instance for you:
813       </para>
814       <screen>
815 gnt-instance add --node=node1 -o debian-etch -t plain inst1.example.com
816 * creating instance disks...
817 adding instance inst1.example.com to cluster config
818 Waiting for instance inst1.example.com to sync disks.
819 Instance inst1.example.com's disks are in sync.
820 creating os for instance inst1.example.com on node node1.example.com
821 * running the instance OS create scripts...
822       </screen>
823
824       <para>
825         The above instance will have no network interface enabled.
826         You can access it over the virtual console with
827         <computeroutput>gnt-instance console
828         <literal>inst1</literal></computeroutput>. There is no
829         password for root.  As this is a Debian instance, you can
830         modify the <filename>/etc/network/interfaces</filename> file
831         to setup the network interface (<literal>eth0</literal> is the
832         name of the interface provided to the instance).
833       </para>
834
835       <para>
836         To create a network mirrored instance, change the argument to
837         the <option>-t</option> option from <literal>plain</literal>
838         to <literal>drbd</literal> and specify the node on
839         which the mirror should reside with the second value of the
840         <option>--node</option> option, like this:
841       </para>
842
843       <screen>
844 # gnt-instance add -t drbd -n node1:node2 -o debian-etch instance2
845 * creating instance disks...
846 adding instance instance2 to cluster config
847 Waiting for instance instance1 to sync disks.
848 - device sdb:  3.50% done, 304 estimated seconds remaining
849 - device sdb: 21.70% done, 270 estimated seconds remaining
850 - device sdb: 39.80% done, 247 estimated seconds remaining
851 - device sdb: 58.10% done, 121 estimated seconds remaining
852 - device sdb: 76.30% done, 72 estimated seconds remaining
853 - device sdb: 94.80% done, 18 estimated seconds remaining
854 Instance instance2's disks are in sync.
855 creating os for instance instance2 on node node1.example.com
856 * running the instance OS create scripts...
857 * starting instance...
858       </screen>
859
860     </sect2>
861
862     <sect2>
863       <title>Managing virtual instances</title>
864       <para>
865         All commands need to be executed on the Ganeti master node
866       </para>
867
868       <para>
869         To access the console of an instance, use
870         <computeroutput>gnt-instance console
871         <replaceable>INSTANCENAME</replaceable></computeroutput>.
872       </para>
873
874       <para>
875         To shutdown an instance, use <computeroutput>gnt-instance
876         shutdown
877         <replaceable>INSTANCENAME</replaceable></computeroutput>. To
878         startup an instance, use <computeroutput>gnt-instance startup
879         <replaceable>INSTANCENAME</replaceable></computeroutput>.
880       </para>
881
882       <para>
883         To failover an instance to its secondary node (only possible
884         with <literal>drbd</literal> disk templates), use
885         <computeroutput>gnt-instance failover
886         <replaceable>INSTANCENAME</replaceable></computeroutput>.
887       </para>
888
889       <para>
890         For more instance and cluster administration details, see the
891         <emphasis>Ganeti administrator's guide</emphasis>.
892       </para>
893
894     </sect2>
895
896   </sect1>
897
898   </article>