Statistics
| Branch: | Tag: | Revision:

root / doc / install.sgml @ bb987157

History | View | Annotate | Download (30.8 kB)

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

    
253
      </sect3>
254

    
255
      <sect3>
256
        <title>Selecting the instance kernel</title>
257

    
258
        <para>
259
          After you have installed Xen, you need to tell Ganeti
260
          exactly what kernel to use for the instances it will
261
          create. This is done by creating a
262
          <emphasis>symlink</emphasis> from your actual kernel to
263
          <filename>/boot/vmlinuz-2.6-xenU</filename>, and one from
264
          your initrd to
265
          <filename>/boot/initrd-2.6-xenU</filename>. Note that if you
266
          don't use an initrd for the <literal>domU</literal> kernel,
267
          you don't need to create the initrd symlink.
268
        </para>
269

    
270
        <formalpara>
271
          <title>Debian</title>
272
          <para>
273
            After installation of the
274
            <literal>xen-linux-system</literal> package, you need to
275
            run (replace the exact version number with the one you
276
            have):
277
            <screen>
278
cd /boot
279
ln -s vmlinuz-2.6.18-5-xen-686 vmlinuz-2.6-xenU
280
ln -s initrd.img-2.6.18-5-xen-686 initrd-2.6-xenU
281
            </screen>
282
          </para>
283
        </formalpara>
284
      </sect3>
285

    
286
    </sect2>
287

    
288
    <sect2>
289
      <title>Installing DRBD</title>
290

    
291
      <para>
292
        Recommended on all nodes: <ulink
293
        url="http://www.drbd.org/">DRBD</ulink> is required if you
294
        want to use the high availability (HA) features of Ganeti, but
295
        optional if you don't require HA or only run Ganeti on
296
        single-node clusters. You can upgrade a non-HA cluster to an
297
        HA one later, but you might need to export and re-import all
298
        your instances to take advantage of the new features.
299
      </para>
300

    
301
      <para>
302
        Supported DRBD versions: the <literal>0.7</literal> series
303
        <emphasis role="strong">or</emphasis>
304
        <literal>8.0.7</literal>. It's recommended to have at least
305
        version <literal>0.7.24</literal> if you use
306
        <command>udev</command> since older versions have a bug
307
        related to device discovery which can be triggered in cases of
308
        hard drive failure.
309
      </para>
310

    
311
      <para>
312
        Now the bad news: unless your distribution already provides it
313
        installing DRBD might involve recompiling your kernel or
314
        anyway fiddling with it. Hopefully at least the Xen-ified
315
        kernel source to start from will be provided.
316
      </para>
317

    
318
      <para>
319
        The good news is that you don't need to configure DRBD at all.
320
        Ganeti will do it for you for every instance you set up.  If
321
        you have the DRBD utils installed and the module in your
322
        kernel you're fine. Please check that your system is
323
        configured to load the module at every boot, and that it
324
        passes the following option to the module (for
325
        <literal>0.7.x</literal>:
326
        <computeroutput>minor_count=64</computeroutput> (this will
327
        allow you to use up to 32 instances per node) or for
328
        <literal>8.0.x</literal> you can use up to
329
        <constant>255</constant>
330
        (i.e. <computeroutput>minor_count=255</computeroutput>, but
331
        for most clusters <constant>128</constant> should be enough).
332
      </para>
333

    
334
      <formalpara><title>Debian</title>
335
        <para>
336
         You can just install (build) the DRBD 0.7 module with the
337
         following commands (make sure you are running the Xen
338
         kernel):
339
        </para>
340
      </formalpara>
341

    
342
      <screen>
343
apt-get install drbd0.7-module-source drbd0.7-utils
344
m-a update
345
m-a a-i drbd0.7
346
echo drbd minor_count=64 >> /etc/modules
347
modprobe drbd minor_count=64
348
      </screen>
349
      <para>
350
        or for using DRBD <literal>8.x</literal> from the etch
351
        backports (note: you need at least 8.0.7, older version have
352
        a bug that breaks ganeti's usage of drbd):
353
      </para>
354
      <screen>
355
apt-get install -t etch-backports drbd8-module-source drbd8-utils
356
m-a update
357
m-a a-i drbd8
358
echo drbd minor_count=128 >> /etc/modules
359
modprobe drbd minor_count=128
360
      </screen>
361

    
362
      <para>
363
        It is also recommended that you comment out the default
364
        resources in the <filename>/etc/dbrd.conf</filename> file, so
365
        that the init script doesn't try to configure any drbd
366
        devices. You can do this by prefixing all
367
        <literal>resource</literal> lines in the file with the keyword
368
        <literal>skip</literal>, like this:
369
      </para>
370

    
371
      <screen>
372
skip resource r0 {
373
...
374
}
375

    
376
skip resource "r1" {
377
...
378
}
379
      </screen>
380

    
381
    </sect2>
382

    
383
    <sect2>
384
      <title>Other required software</title>
385

    
386
      <para>Besides Xen and DRBD, you will need to install the
387
      following (on all nodes):</para>
388

    
389
      <itemizedlist>
390
        <listitem>
391
          <simpara><ulink url="http://sourceware.org/lvm2/">LVM
392
          version 2</ulink></simpara>
393
        </listitem>
394
        <listitem>
395
          <simpara><ulink
396
          url="http://www.openssl.org/">OpenSSL</ulink></simpara>
397
        </listitem>
398
        <listitem>
399
          <simpara><ulink
400
          url="http://www.openssh.com/portable.html">OpenSSH</ulink></simpara>
401
        </listitem>
402
        <listitem>
403
          <simpara><ulink url="http://bridge.sourceforge.net/">Bridge
404
          utilities</ulink></simpara>
405
        </listitem>
406
        <listitem>
407
          <simpara><ulink
408
          url="http://developer.osdl.org/dev/iproute2">iproute2</ulink></simpara>
409
        </listitem>
410
        <listitem>
411
          <simpara><ulink
412
          url="ftp://ftp.inr.ac.ru/ip-routing/iputils-current.tar.gz">arping</ulink>
413
          (part of iputils package)</simpara>
414
        </listitem>
415
        <listitem>
416
          <simpara><ulink
417
          url="http://www.kernel.org/pub/linux/utils/raid/mdadm/">mdadm</ulink>
418
          (Linux Software Raid tools)</simpara>
419
        </listitem>
420
        <listitem>
421
          <simpara><ulink url="http://www.python.org">Python 2.4</ulink></simpara>
422
        </listitem>
423
        <listitem>
424
          <simpara><ulink url="http://twistedmatrix.com/">Python
425
          Twisted library</ulink> - the core library is
426
          enough</simpara>
427
        </listitem>
428
        <listitem>
429
          <simpara><ulink
430
          url="http://pyopenssl.sourceforge.net/">Python OpenSSL
431
          bindings</ulink></simpara>
432
        </listitem>
433
        <listitem>
434
          <simpara><ulink
435
          url="http://www.undefined.org/python/#simplejson">simplejson Python
436
          module</ulink></simpara>
437
        </listitem>
438
        <listitem>
439
          <simpara><ulink
440
          url="http://pyparsing.wikispaces.com/">pyparsing Python
441
          module</ulink></simpara>
442
        </listitem>
443
      </itemizedlist>
444

    
445
      <para>
446
        These programs are supplied as part of most Linux
447
        distributions, so usually they can be installed via apt or
448
        similar methods. Also many of them will already be installed
449
        on a standard machine.
450
      </para>
451

    
452

    
453
      <formalpara><title>Debian</title>
454

    
455
      <para>You can use this command line to install all of them:</para>
456

    
457
      </formalpara>
458
      <screen>
459
# apt-get install lvm2 ssh bridge-utils iproute iputils-arping \
460
  python2.4 python-twisted-core python-pyopenssl openssl \
461
  mdadm python-pyparsing python-simplejson
462
      </screen>
463

    
464
    </sect2>
465

    
466
  </sect1>
467

    
468

    
469
  <sect1>
470
    <title>Setting up the environment for Ganeti</title>
471

    
472
    <sect2>
473
      <title>Configuring the network</title>
474

    
475
      <para><emphasis role="strong">Mandatory</emphasis> on all nodes.</para>
476

    
477
      <para>
478
        Ganeti relies on Xen running in "bridge mode", which means the
479
        instances network interfaces will be attached to a software bridge
480
        running in dom0. Xen by default creates such a bridge at startup, but
481
        your distribution might have a different way to do things.
482
      </para>
483

    
484
      <para>
485
        Beware that the default name Ganeti uses is
486
        <hardware>xen-br0</hardware> (which was used in Xen 2.0)
487
        while Xen 3.0 uses <hardware>xenbr0</hardware> by
488
        default. The default bridge your Ganeti cluster will use for new
489
        instances can be specified at cluster initialization time.
490
      </para>
491

    
492
      <formalpara><title>Debian</title>
493
        <para>
494
          The recommended Debian way to configure the Xen bridge is to
495
          edit your <filename>/etc/network/interfaces</filename> file
496
          and substitute your normal Ethernet stanza with the
497
          following snippet:
498

    
499
        <screen>
500
auto xen-br0
501
iface xen-br0 inet static
502
        address <replaceable>YOUR_IP_ADDRESS</replaceable>
503
        netmask <replaceable>YOUR_NETMASK</replaceable>
504
        network <replaceable>YOUR_NETWORK</replaceable>
505
        broadcast <replaceable>YOUR_BROADCAST_ADDRESS</replaceable>
506
        gateway <replaceable>YOUR_GATEWAY</replaceable>
507
        bridge_ports eth0
508
        bridge_stp off
509
        bridge_fd 0
510
        </screen>
511
        </para>
512
      </formalpara>
513

    
514
     <para>
515
The following commands need to be executed on the local console
516
     </para>
517
      <screen>
518
ifdown eth0
519
ifup xen-br0
520
      </screen>
521

    
522
      <para>
523
        To check if the bridge is setup, use <command>ip</command>
524
        and <command>brctl show</command>:
525
      <para>
526

    
527
      <screen>
528
# ip a show xen-br0
529
9: xen-br0: &lt;BROADCAST,MULTICAST,UP,10000&gt; mtu 1500 qdisc noqueue
530
    link/ether 00:20:fc:1e:d5:5d brd ff:ff:ff:ff:ff:ff
531
    inet 10.1.1.200/24 brd 10.1.1.255 scope global xen-br0
532
    inet6 fe80::220:fcff:fe1e:d55d/64 scope link
533
       valid_lft forever preferred_lft forever
534

    
535
# brctl show xen-br0
536
bridge name     bridge id               STP enabled     interfaces
537
xen-br0         8000.0020fc1ed55d       no              eth0
538
      </screen>
539

    
540

    
541
    </sect2>
542

    
543
    <sect2>
544
      <title>Configuring LVM</title>
545

    
546

    
547
      <para><emphasis role="strong">Mandatory</emphasis> on all nodes.</para>
548

    
549
      <note>
550
        <simpara>The volume group is required to be at least
551
        <constant>20GiB</constant>.</simpara>
552
      </note>
553
      <para>
554
        If you haven't configured your LVM volume group at install
555
        time you need to do it before trying to initialize the Ganeti
556
        cluster. This is done by formatting the devices/partitions you
557
        want to use for it and then adding them to the relevant volume
558
        group:
559

    
560
       <screen>
561
pvcreate /dev/sda3
562
vgcreate xenvg /dev/sda3
563
       </screen>
564
or
565
       <screen>
566
pvcreate /dev/sdb1
567
pvcreate /dev/sdc1
568
vgcreate xenvg /dev/sdb1 /dev/sdc1
569
       </screen>
570
      </para>
571

    
572
      <para>
573
	If you want to add a device later you can do so with the
574
	<citerefentry><refentrytitle>vgextend</refentrytitle>
575
	<manvolnum>8</manvolnum></citerefentry> command:
576
      </para>
577

    
578
      <screen>
579
pvcreate /dev/sdd1
580
vgextend xenvg /dev/sdd1
581
      </screen>
582

    
583
      <formalpara>
584
        <title>Optional</title>
585
        <para>
586
          It is recommended to configure LVM not to scan the DRBD
587
          devices for physical volumes. This can be accomplished by
588
          editing <filename>/etc/lvm/lvm.conf</filename> and adding
589
          the <literal>/dev/drbd[0-9]+</literal> regular expression to
590
          the <literal>filter</literal> variable, like this:
591
<screen>
592
    filter = [ "r|/dev/cdrom|", "r|/dev/drbd[0-9]+|" ]
593
</screen>
594
        </para>
595
      </formalpara>
596

    
597
    </sect2>
598

    
599
    <sect2>
600
      <title>Installing Ganeti</title>
601

    
602
      <para><emphasis role="strong">Mandatory</emphasis> on all nodes.</para>
603

    
604
      <para>
605
        It's now time to install the Ganeti software itself.  Download
606
        the source from <ulink
607
        url="http://code.google.com/p/ganeti/"></ulink>.
608
      </para>
609

    
610
        <screen>
611
tar xvzf ganeti-1.2.0.tar.gz
612
cd ganeti-1.2.0
613
./configure --localstatedir=/var --sysconfdir=/etc
614
make
615
make install
616
mkdir /srv/ganeti/ /srv/ganeti/os /srv/ganeti/export
617
        </screen>
618

    
619
      <para>
620
        You also need to copy the file
621
        <filename>doc/examples/ganeti.initd</filename>
622
        from the source archive to
623
        <filename>/etc/init.d/ganeti</filename> and register it with
624
        your distribution's startup scripts, for example in Debian:
625
      </para>
626
      <screen>update-rc.d ganeti defaults 20 80</screen>
627

    
628
      <para>
629
        In order to automatically restart failed instances, you need
630
        to setup a cron job run the
631
        <computeroutput>ganeti-watcher</computeroutput> program. A
632
        sample cron file is provided in the source at
633
        <filename>doc/examples/ganeti.cron</filename> and you can
634
        copy that (eventually altering the path) to
635
        <filename>/etc/cron.d/ganeti</filename>
636
      </para>
637

    
638
    </sect2>
639

    
640
    <sect2>
641
      <title>Installing the Operating System support packages</title>
642

    
643
      <para><emphasis role="strong">Mandatory</emphasis> on all nodes.</para>
644

    
645
      <para>
646
        To be able to install instances you need to have an Operating
647
        System installation script. An example for Debian Etch is
648
        provided on the project web site.  Download it from <ulink
649
        url="http://code.google.com/p/ganeti/"></ulink> and follow the
650
        instructions in the <filename>README</filename> file.  Here is
651
        the installation procedure (replace <constant>0.2</constant>
652
        with the latest version that is compatible with your ganeti
653
        version):
654
      </para>
655

    
656
      <screen>
657
cd /srv/ganeti/os
658
tar xvf ganeti-instance-debian-etch-0.3.tar
659
mv ganeti-instance-debian-etch-0.3 debian-etch
660
      </screen>
661

    
662
      <para>
663
        In order to use this OS definition, you need to have internet
664
        access from your nodes and have the <citerefentry>
665
        <refentrytitle>debootstrap</refentrytitle>
666
        <manvolnum>8</manvolnum></citerefentry>, <citerefentry>
667
        <refentrytitle>dump</refentrytitle><manvolnum>8</manvolnum>
668
        </citerefentry> and <citerefentry>
669
        <refentrytitle>restore</refentrytitle>
670
        <manvolnum>8</manvolnum> </citerefentry> commands installed on
671
        all nodes.
672
      </para>
673
      <formalpara>
674
        <title>Debian</title>
675
        <para>
676
          Use this command on all nodes to install the required
677
          packages:
678

    
679
          <screen>apt-get install debootstrap dump</screen>
680
        </para>
681
      </formalpara>
682

    
683
      <para>
684
        Alternatively, you can create your own OS definitions. See the
685
        manpage
686
        <citerefentry>
687
        <refentrytitle>ganeti-os-interface</refentrytitle>
688
        <manvolnum>8</manvolnum>
689
        </citerefentry>.
690
      </para>
691

    
692
    </sect2>
693

    
694
    <sect2>
695
      <title>Initializing the cluster</title>
696

    
697
      <para><emphasis role="strong">Mandatory:</emphasis> only on one
698
      node per cluster.</para>
699

    
700

    
701
      <para>The last step is to initialize the cluster. After you've repeated
702
        the above process on all of your nodes, choose one as the master, and execute:
703
      </para>
704

    
705
      <screen>
706
gnt-cluster init <replaceable>CLUSTERNAME</replaceable>
707
      </screen>
708

    
709
      <para>
710
        The <replaceable>CLUSTERNAME</replaceable> is a hostname,
711
        which must be resolvable (e.g. it must exist in DNS or in
712
        <filename>/etc/hosts</filename>) by all the nodes in the
713
        cluster. You must choose a name different from any of the
714
        nodes names for a multi-node cluster. In general the best
715
        choice is to have a unique name for a cluster, even if it
716
        consists of only one machine, as you will be able to expand it
717
        later without any problems.
718
      </para>
719

    
720
      <para>
721
        If the bridge name you are using is not
722
        <literal>xen-br0</literal>, use the <option>-b
723
        <replaceable>BRIDGENAME</replaceable></option> option to
724
        specify the bridge name. In this case, you should also use the
725
        <option>--master-netdev
726
        <replaceable>BRIDGENAME</replaceable></option> option with the
727
        same <replaceable>BRIDGENAME</replaceable> argument.
728
      </para>
729

    
730
      <para>
731
        You can use a different name than <literal>xenvg</literal> for
732
        the volume group (but note that the name must be identical on
733
        all nodes). In this case you need to specify it by passing the
734
        <option>-g <replaceable>VGNAME</replaceable></option> option
735
        to <computeroutput>gnt-cluster init</computeroutput>.
736
      </para>
737

    
738
      <para>
739
        You can also invoke the command with the
740
        <option>--help</option> option in order to see all the
741
        possibilities.
742
      </para>
743

    
744
    </sect2>
745

    
746
    <sect2>
747
      <title>Joining the nodes to the cluster</title>
748

    
749
      <para>
750
        <emphasis role="strong">Mandatory:</emphasis> for all the
751
        other nodes.
752
      </para>
753

    
754
      <para>
755
        After you have initialized your cluster you need to join the
756
        other nodes to it. You can do so by executing the following
757
        command on the master node:
758
      </para>
759
        <screen>
760
gnt-node add <replaceable>NODENAME</replaceable>
761
        </screen>
762
    </sect2>
763

    
764
    <sect2>
765
      <title>Separate replication network</title>
766

    
767
      <para><emphasis role="strong">Optional</emphasis></para>
768
      <para>
769
        Ganeti uses DRBD to mirror the disk of the virtual instances
770
        between nodes. To use a dedicated network interface for this
771
        (in order to improve performance or to enhance security) you
772
        need to configure an additional interface for each node.  Use
773
        the <option>-s</option> option with
774
        <computeroutput>gnt-cluster init</computeroutput> and
775
        <computeroutput>gnt-node add</computeroutput> to specify the
776
        IP address of this secondary interface to use for each
777
        node. Note that if you specified this option at cluster setup
778
        time, you must afterwards use it for every node add operation.
779
      </para>
780
    </sect2>
781

    
782
    <sect2>
783
      <title>Testing the setup</title>
784

    
785
      <para>
786
        Execute the <computeroutput>gnt-node list</computeroutput>
787
        command to see all nodes in the cluster:
788
      <screen>
789
# gnt-node list
790
Node              DTotal  DFree MTotal MNode MFree Pinst Sinst
791
node1.example.com 197404 197404   2047  1896   125     0     0
792
      </screen>
793
    </para>
794
  </sect2>
795

    
796
  <sect1>
797
    <title>Setting up and managing virtual instances</title>
798
    <sect2>
799
      <title>Setting up virtual instances</title>
800
      <para>
801
        This step shows how to setup a virtual instance with either
802
        non-mirrored disks (<computeroutput>plain</computeroutput>) or
803
        with network mirrored disks
804
        (<computeroutput>remote_raid1</computeroutput> for drbd 0.7
805
        and <computeroutput>drbd</computeroutput> for drbd 8.x).  All
806
        commands need to be executed on the Ganeti master node (the
807
        one on which <computeroutput>gnt-cluster init</computeroutput>
808
        was run).  Verify that the OS scripts are present on all
809
        cluster nodes with <computeroutput>gnt-os
810
        list</computeroutput>.
811
      </para>
812
      <para>
813
        To create a virtual instance, you need a hostname which is
814
        resolvable (DNS or <filename>/etc/hosts</filename> on all
815
        nodes). The following command will create a non-mirrored
816
        instance for you:
817
      </para>
818
      <screen>
819
gnt-instance add --node=node1 -o debian-etch -t plain inst1.example.com
820
* creating instance disks...
821
adding instance inst1.example.com to cluster config
822
Waiting for instance inst1.example.com to sync disks.
823
Instance inst1.example.com's disks are in sync.
824
creating os for instance inst1.example.com on node node1.example.com
825
* running the instance OS create scripts...
826
      </screen>
827

    
828
      <para>
829
        The above instance will have no network interface enabled.
830
        You can access it over the virtual console with
831
        <computeroutput>gnt-instance console
832
        <literal>inst1</literal></computeroutput>. There is no
833
        password for root.  As this is a Debian instance, you can
834
        modify the <filename>/etc/network/interfaces</filename> file
835
        to setup the network interface (<literal>eth0</literal> is the
836
        name of the interface provided to the instance).
837
      </para>
838

    
839
      <para>
840
        To create a network mirrored instance, change the argument to
841
        the <option>-t</option> option from <literal>plain</literal>
842
        to <literal>remote_raid1</literal> (drbd 0.7) or
843
        <literal>drbd</literal> (drbd 8.0) and specify the node on
844
        which the mirror should reside with the second value of the
845
        <option>--node</option> option, like this:
846
      </para>
847

    
848
      <screen>
849
# gnt-instance add -t remote_raid1 -n node1:node2 -o debian-etch instance2
850
* creating instance disks...
851
adding instance instance2 to cluster config
852
Waiting for instance instance1 to sync disks.
853
- device sdb:  3.50% done, 304 estimated seconds remaining
854
- device sdb: 21.70% done, 270 estimated seconds remaining
855
- device sdb: 39.80% done, 247 estimated seconds remaining
856
- device sdb: 58.10% done, 121 estimated seconds remaining
857
- device sdb: 76.30% done, 72 estimated seconds remaining
858
- device sdb: 94.80% done, 18 estimated seconds remaining
859
Instance instance2's disks are in sync.
860
creating os for instance instance2 on node node1.example.com
861
* running the instance OS create scripts...
862
* starting instance...
863
      </screen>
864

    
865
    </sect2>
866

    
867
    <sect2>
868
      <title>Managing virtual instances</title>
869
      <para>
870
        All commands need to be executed on the Ganeti master node
871
      </para>
872

    
873
      <para>
874
        To access the console of an instance, use
875
        <computeroutput>gnt-instance console
876
        <replaceable>INSTANCENAME</replaceable></computeroutput>.
877
      </para>
878

    
879
      <para>
880
        To shutdown an instance, use <computeroutput>gnt-instance
881
        shutdown
882
        <replaceable>INSTANCENAME</replaceable></computeroutput>. To
883
        startup an instance, use <computeroutput>gnt-instance startup
884
        <replaceable>INSTANCENAME</replaceable></computeroutput>.
885
      </para>
886

    
887
      <para>
888
        To failover an instance to its secondary node (only possible
889
        in <literal>remote_raid1</literal> or <literal>drbd</literal>
890
        disk templates), use <computeroutput>gnt-instance failover
891
        <replaceable>INSTANCENAME</replaceable></computeroutput>.
892
      </para>
893

    
894
      <para>
895
        For more instance and cluster administration details, see the
896
        <emphasis>Ganeti administrator's guide</emphasis>.
897
      </para>
898

    
899
    </sect2>
900

    
901
  </sect1>
902

    
903
  </article>