Statistics
| Branch: | Tag: | Revision:

root / doc / install.sgml @ 36e23a40

History | View | Annotate | Download (31.4 kB)

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