Statistics
| Branch: | Tag: | Revision:

root / docs / install.sgml @ 16450d30

History | View | Annotate | Download (23.9 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 f1a808df Guido Trotter
  <para>Documents Ganeti version 1.2</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 32ad0582 Iustin Pop
      Xen. This document explains how to bootstrap a Ganeti node (Xen
15 32ad0582 Iustin Pop
      <literal>dom0</literal>), create a running cluster and install
16 32ad0582 Iustin Pop
      virtual instance (Xen <literal>domU</literal>).  You need to
17 32ad0582 Iustin Pop
      repeat most of the steps in this document for every node you
18 32ad0582 Iustin Pop
      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 32ad0582 Iustin Pop
      distribution-agnostic.  This documentation will use Debian Etch
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 32ad0582 Iustin Pop
      your distribution, its package management system, and Xen before
36 32ad0582 Iustin Pop
      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 5d6dd340 Iustin Pop
          components</simpara>
45 f1a808df Guido Trotter
        </listitem>
46 f1a808df Guido Trotter
        <listitem>
47 5d6dd340 Iustin Pop
          <simpara>Configuration of the environment for
48 5d6dd340 Iustin Pop
          Ganeti</simpara>
49 f1a808df Guido Trotter
        </listitem>
50 f1a808df Guido Trotter
      </itemizedlist>
51 f1a808df Guido Trotter
52 5d6dd340 Iustin Pop
    Each of these is divided into sub-sections. While a full Ganeti
53 5d6dd340 Iustin Pop
    system will need all of the steps specified, some are not strictly
54 5d6dd340 Iustin Pop
    required for every environment. Which ones they are, and why, is
55 5d6dd340 Iustin Pop
    specified in the 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 32ad0582 Iustin Pop
         Any system supported by your Linux distribution is fine.
68 32ad0582 Iustin Pop
         64-bit systems are better as they can support more memory.
69 32ad0582 Iustin Pop
      </para>
70 32ad0582 Iustin Pop
71 32ad0582 Iustin Pop
      <para>
72 32ad0582 Iustin Pop
         Any disk drive recognized by Linux
73 32ad0582 Iustin Pop
         (<literal>IDE</literal>/<literal>SCSI</literal>/<literal>SATA</literal>/etc.)
74 32ad0582 Iustin Pop
         is supported in Ganeti. Note that no shared storage
75 32ad0582 Iustin Pop
         (e.g. <literal>SAN</literal>) is needed to get high-availability features. It is
76 32ad0582 Iustin Pop
         highly recommended to use more than one disk drive to improve
77 32ad0582 Iustin Pop
         speed. 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 16450d30 Iustin Pop
        will then host your instance filesystems. The volume group
94 16450d30 Iustin Pop
        name Ganeti 1.2 uses (by default) is
95 32ad0582 Iustin Pop
        <emphasis>xenvg</emphasis>.
96 0bac47cf Iustin Pop
      </para>
97 f1a808df Guido Trotter
98 32ad0582 Iustin Pop
      <note>
99 32ad0582 Iustin Pop
        <simpara>
100 32ad0582 Iustin Pop
          You need to use a fully-qualified name for the hostname of
101 32ad0582 Iustin Pop
          the nodes.
102 32ad0582 Iustin Pop
        </simpara>
103 32ad0582 Iustin Pop
      </note>
104 32ad0582 Iustin Pop
105 5d6dd340 Iustin Pop
      <para>
106 16450d30 Iustin Pop
        While you can use an existing system, please note that the
107 0bac47cf Iustin Pop
        Ganeti installation is intrusive in terms of changes to the
108 0bac47cf Iustin Pop
        system configuration, and it's best to use a newly-installed
109 0bac47cf Iustin Pop
        system without important data on it.
110 0bac47cf Iustin Pop
      </para>
111 0bac47cf Iustin Pop
112 0bac47cf Iustin Pop
      <para>
113 0bac47cf Iustin Pop
        Also, for best results, it's advised that the nodes have as
114 0bac47cf Iustin Pop
        much as possible the same hardware and software
115 0bac47cf Iustin Pop
        configuration. This will make administration much easier.
116 f1a808df Guido Trotter
      </para>
117 f1a808df Guido Trotter
118 f1a808df Guido Trotter
    </sect2>
119 f1a808df Guido Trotter
120 f1a808df Guido Trotter
    <sect2>
121 f1a808df Guido Trotter
      <title>Installing Xen</title>
122 f1a808df Guido Trotter
123 5d6dd340 Iustin Pop
      <para>
124 0bac47cf Iustin Pop
        <emphasis role="strong">Mandatory</emphasis> on all nodes.
125 32ad0582 Iustin Pop
      </para>
126 32ad0582 Iustin Pop
127 32ad0582 Iustin Pop
      <para>
128 0bac47cf Iustin Pop
        While Ganeti is developed with the ability to modularly run on
129 0bac47cf Iustin Pop
        different virtualization environments in mind the only one
130 0bac47cf Iustin Pop
        currently useable on a live system is <ulink
131 0bac47cf Iustin Pop
        url="http://xen.xensource.com/">Xen</ulink>. Supported
132 0bac47cf Iustin Pop
        versions are: <simplelist type="inline">
133 0bac47cf Iustin Pop
        <member><literal>3.0.3</literal></member>
134 0bac47cf Iustin Pop
        <member><literal>3.0.4</literal></member>
135 0bac47cf Iustin Pop
        <member><literal>3.1</literal></member> </simplelist>.
136 f1a808df Guido Trotter
      </para>
137 f1a808df Guido Trotter
138 5d6dd340 Iustin Pop
      <para>
139 5d6dd340 Iustin Pop
        Please follow your distribution's recommended way to install
140 5d6dd340 Iustin Pop
        and set up Xen, or install Xen from the upstream source, if
141 5d6dd340 Iustin Pop
        you wish, following their manual.
142 f1a808df Guido Trotter
      </para>
143 f1a808df Guido Trotter
144 5d6dd340 Iustin Pop
      <para>
145 5d6dd340 Iustin Pop
        After installing Xen you need to reboot into your xenified
146 0bac47cf Iustin Pop
        dom0 system. On some distributions this might involve
147 0bac47cf Iustin Pop
        configuring GRUB appropriately, whereas others will configure
148 0bac47cf Iustin Pop
        it automatically when you install Xen from a package.
149 f1a808df Guido Trotter
      </para>
150 f1a808df Guido Trotter
151 32ad0582 Iustin Pop
      <formalpara><title>Debian</title>
152 32ad0582 Iustin Pop
      <para>
153 32ad0582 Iustin Pop
        Under Debian Etch or Sarge+backports you can install the
154 16450d30 Iustin Pop
        relevant <literal>xen-linux-system</literal> package, which
155 16450d30 Iustin Pop
        will pull in both the hypervisor and the relevant kernel.
156 32ad0582 Iustin Pop
      </para>
157 32ad0582 Iustin Pop
      </formalpara>
158 32ad0582 Iustin Pop
159 16450d30 Iustin Pop
      <sect3>
160 16450d30 Iustin Pop
        <title>Selecting the instance kernel</title>
161 16450d30 Iustin Pop
162 16450d30 Iustin Pop
        <para>
163 16450d30 Iustin Pop
          After you have installed xen, you need to tell Ganeti
164 16450d30 Iustin Pop
          exactly what kernel to use for the instances it will
165 16450d30 Iustin Pop
          create. This is done by creating a
166 16450d30 Iustin Pop
          <emphasis>symlink</emphasis> from your actual kernel to
167 16450d30 Iustin Pop
          <filename>/boot/vmlinuz-2.6-xenU</filename>, and one from
168 16450d30 Iustin Pop
          your initrd to
169 16450d30 Iustin Pop
          <filename>/boot/initrd-2.6-xenU</filename>. Note that if you
170 16450d30 Iustin Pop
          don't use an initrd for the <literal>domU</literal> kernel,
171 16450d30 Iustin Pop
          you don't need to create the initrd symlink.
172 16450d30 Iustin Pop
        </para>
173 16450d30 Iustin Pop
174 16450d30 Iustin Pop
        <formalpara>
175 16450d30 Iustin Pop
          <title>Debian</title>
176 16450d30 Iustin Pop
          <para>
177 16450d30 Iustin Pop
            After installation of the
178 16450d30 Iustin Pop
            <literal>xen-linux-system</literal> package, you need to
179 16450d30 Iustin Pop
            run (replace the exact version number with the one you
180 16450d30 Iustin Pop
            have):
181 16450d30 Iustin Pop
            <screen>
182 16450d30 Iustin Pop
cd /boot
183 16450d30 Iustin Pop
ln -s vmlinuz-2.6.18-5-xen-686 vmlinuz-2.6-xenU
184 16450d30 Iustin Pop
ln -s initrd.img-2.6.18-5-xen-686 initrd-2.6-xenU
185 16450d30 Iustin Pop
            </screen>
186 16450d30 Iustin Pop
          </para>
187 16450d30 Iustin Pop
        </formalpara>
188 16450d30 Iustin Pop
      </sect3>
189 16450d30 Iustin Pop
190 f1a808df Guido Trotter
    </sect2>
191 f1a808df Guido Trotter
192 f1a808df Guido Trotter
    <sect2>
193 f1a808df Guido Trotter
      <title>Installing DRBD</title>
194 f1a808df Guido Trotter
195 5d6dd340 Iustin Pop
      <para>
196 0bac47cf Iustin Pop
        Recommended on all nodes: <ulink
197 0bac47cf Iustin Pop
        url="http://www.drbd.org/">DRBD</ulink> is required if you
198 0bac47cf Iustin Pop
        want to use the high availability (HA) features of Ganeti, but
199 0bac47cf Iustin Pop
        optional if you don't require HA or only run Ganeti on
200 0bac47cf Iustin Pop
        single-node clusters. You can upgrade a non-HA cluster to an
201 32ad0582 Iustin Pop
        HA one later, but you might need to export and re-import all
202 0bac47cf Iustin Pop
        your instances to take advantage of the new features.
203 0bac47cf Iustin Pop
      </para>
204 0bac47cf Iustin Pop
205 0bac47cf Iustin Pop
      <para>
206 0bac47cf Iustin Pop
        Supported DRBD version: the <literal>0.7</literal>
207 0bac47cf Iustin Pop
        series. It's recommended to have at least version
208 0bac47cf Iustin Pop
        <literal>0.7.24</literal> if you use <command>udev</command>
209 0bac47cf Iustin Pop
        since older versions have a bug related to device discovery
210 32ad0582 Iustin Pop
        which can be triggered in cases of hard drive failure.
211 f1a808df Guido Trotter
      </para>
212 f1a808df Guido Trotter
213 5d6dd340 Iustin Pop
      <para>
214 5d6dd340 Iustin Pop
        Now the bad news: unless your distribution already provides it
215 5d6dd340 Iustin Pop
        installing DRBD might involve recompiling your kernel or
216 5d6dd340 Iustin Pop
        anyway fiddling with it. Hopefully at least the xenified
217 5d6dd340 Iustin Pop
        kernel source to start from will be provided.
218 f1a808df Guido Trotter
      </para>
219 f1a808df Guido Trotter
220 5d6dd340 Iustin Pop
      <para>
221 5d6dd340 Iustin Pop
        The good news is that you don't need to configure DRBD at all.
222 5d6dd340 Iustin Pop
        Ganeti will do it for you for every instance you set up.  If
223 5d6dd340 Iustin Pop
        you have the DRBD utils installed and the module in your
224 5d6dd340 Iustin Pop
        kernel you're fine. Please check that your system is
225 5d6dd340 Iustin Pop
        configured to load the module at every boot.
226 f1a808df Guido Trotter
      </para>
227 f1a808df Guido Trotter
228 32ad0582 Iustin Pop
      <formalpara><title>Debian</title>
229 32ad0582 Iustin Pop
        <para>
230 32ad0582 Iustin Pop
         You can just install (build) the DRBD 0.7 module with the
231 32ad0582 Iustin Pop
         following command:
232 32ad0582 Iustin Pop
        </para>
233 32ad0582 Iustin Pop
      </formalpara>
234 32ad0582 Iustin Pop
235 32ad0582 Iustin Pop
      <screen>
236 32ad0582 Iustin Pop
apt-get install drbd0.7-module-source drbd0.7-utils
237 32ad0582 Iustin Pop
m-a update
238 32ad0582 Iustin Pop
m-a a-i drbd0.7
239 32ad0582 Iustin Pop
      </screen>
240 32ad0582 Iustin Pop
241 f1a808df Guido Trotter
    </sect2>
242 f1a808df Guido Trotter
243 a7a19281 Iustin Pop
    <sect2>
244 a7a19281 Iustin Pop
      <title>Other required software</title>
245 a7a19281 Iustin Pop
246 a7a19281 Iustin Pop
      <para>Besides Xen and DRBD, you will need to install the
247 0bac47cf Iustin Pop
      following (on all nodes):</para>
248 a7a19281 Iustin Pop
249 a7a19281 Iustin Pop
      <itemizedlist>
250 a7a19281 Iustin Pop
        <listitem>
251 a7a19281 Iustin Pop
          <simpara><ulink url="http://sourceware.org/lvm2/">LVM
252 a7a19281 Iustin Pop
          version 2</ulink></simpara>
253 a7a19281 Iustin Pop
        </listitem>
254 a7a19281 Iustin Pop
        <listitem>
255 a7a19281 Iustin Pop
          <simpara><ulink
256 a7a19281 Iustin Pop
          url="http://www.openssl.org/">OpenSSL</ulink></simpara>
257 a7a19281 Iustin Pop
        </listitem>
258 a7a19281 Iustin Pop
        <listitem>
259 a7a19281 Iustin Pop
          <simpara><ulink
260 a7a19281 Iustin Pop
          url="http://www.openssh.com/portable.html">OpenSSH</ulink></simpara>
261 a7a19281 Iustin Pop
        </listitem>
262 a7a19281 Iustin Pop
        <listitem>
263 a7a19281 Iustin Pop
          <simpara><ulink url="http://bridge.sourceforge.net/">Bridge
264 a7a19281 Iustin Pop
          utilities</ulink></simpara>
265 a7a19281 Iustin Pop
        </listitem>
266 a7a19281 Iustin Pop
        <listitem>
267 a7a19281 Iustin Pop
          <simpara><ulink
268 a7a19281 Iustin Pop
          url="http://fping.sourceforge.net/">fping</ulink></simpara>
269 a7a19281 Iustin Pop
        </listitem>
270 a7a19281 Iustin Pop
        <listitem>
271 a7a19281 Iustin Pop
          <simpara><ulink
272 a7a19281 Iustin Pop
          url="http://developer.osdl.org/dev/iproute2">iproute2</ulink></simpara>
273 a7a19281 Iustin Pop
        </listitem>
274 a7a19281 Iustin Pop
        <listitem>
275 a7a19281 Iustin Pop
          <simpara><ulink
276 a7a19281 Iustin Pop
          url="ftp://ftp.inr.ac.ru/ip-routing/iputils-current.tar.gz">arping</ulink>
277 a7a19281 Iustin Pop
          (part of iputils package)</simpara>
278 a7a19281 Iustin Pop
        </listitem>
279 a7a19281 Iustin Pop
        <listitem>
280 a7a19281 Iustin Pop
          <simpara><ulink
281 a7a19281 Iustin Pop
          url="http://www.kernel.org/pub/linux/utils/raid/mdadm/">mdadm</ulink>
282 a7a19281 Iustin Pop
          (Linux Software Raid tools)</simpara>
283 a7a19281 Iustin Pop
        </listitem>
284 a7a19281 Iustin Pop
        <listitem>
285 a7a19281 Iustin Pop
          <simpara><ulink url="http://www.python.org">Python 2.4</ulink></simpara>
286 a7a19281 Iustin Pop
        </listitem>
287 a7a19281 Iustin Pop
        <listitem>
288 a7a19281 Iustin Pop
          <simpara><ulink url="http://twistedmatrix.com/">Python
289 a7a19281 Iustin Pop
          Twisted library</ulink> - the core library is
290 a7a19281 Iustin Pop
          enough</simpara>
291 a7a19281 Iustin Pop
        </listitem>
292 a7a19281 Iustin Pop
        <listitem>
293 a7a19281 Iustin Pop
          <simpara><ulink
294 a7a19281 Iustin Pop
          url="http://pyopenssl.sourceforge.net/">Python OpenSSL
295 a7a19281 Iustin Pop
          bindings</ulink></simpara>
296 a7a19281 Iustin Pop
        </listitem>
297 a7a19281 Iustin Pop
      </itemizedlist>
298 a7a19281 Iustin Pop
299 32ad0582 Iustin Pop
      <para>
300 32ad0582 Iustin Pop
        These programs are supplied as part of most Linux
301 32ad0582 Iustin Pop
        distributions, so usually they can be installed via apt or
302 32ad0582 Iustin Pop
        similar methods. Also many of them will already be installed
303 32ad0582 Iustin Pop
        on a standard machine.
304 32ad0582 Iustin Pop
      </para>
305 32ad0582 Iustin Pop
306 32ad0582 Iustin Pop
307 32ad0582 Iustin Pop
      <formalpara><title>Debian</title>
308 32ad0582 Iustin Pop
309 32ad0582 Iustin Pop
      <para>You can use this command line to install all of them:</para>
310 a7a19281 Iustin Pop
311 32ad0582 Iustin Pop
      </formalpara>
312 a7a19281 Iustin Pop
      <screen>
313 a7a19281 Iustin Pop
# apt-get install lvm2 ssh bridge-utils iproute iputils-arping \
314 5cd0d9c0 Iustin Pop
  fping python2.4 python-twisted-core python-pyopenssl openssl
315 a7a19281 Iustin Pop
      </screen>
316 5cd0d9c0 Iustin Pop
317 a7a19281 Iustin Pop
    </sect2>
318 a7a19281 Iustin Pop
319 f1a808df Guido Trotter
  </sect1>
320 f1a808df Guido Trotter
321 f1a808df Guido Trotter
322 f1a808df Guido Trotter
  <sect1>
323 f1a808df Guido Trotter
    <title>Setting up the environment for Ganeti</title>
324 f1a808df Guido Trotter
325 f1a808df Guido Trotter
    <sect2>
326 f1a808df Guido Trotter
      <title>Configuring the network</title>
327 f1a808df Guido Trotter
328 0bac47cf Iustin Pop
      <para><emphasis role="strong">Mandatory</emphasis> on all nodes.</para>
329 0bac47cf Iustin Pop
330 32ad0582 Iustin Pop
      <para>
331 32ad0582 Iustin Pop
        Ganeti relies on Xen running in "bridge mode", which means the
332 32ad0582 Iustin Pop
        instances network interfaces will be attached to a software bridge
333 32ad0582 Iustin Pop
        running in dom0. Xen by default creates such a bridge at startup, but
334 32ad0582 Iustin Pop
        your distribution might have a different way to do things.
335 f1a808df Guido Trotter
      </para>
336 f1a808df Guido Trotter
337 f1a808df Guido Trotter
      <para>
338 32ad0582 Iustin Pop
        Beware that the default name Ganeti uses is
339 32ad0582 Iustin Pop
        <hardware>xen-br0</hardware> (which was used in Xen 2.0)
340 32ad0582 Iustin Pop
        while Xen 3.0 uses <hardware>xenbr0</hardware> by
341 32ad0582 Iustin Pop
        default. The default bridge your Ganeti cluster will use for new
342 32ad0582 Iustin Pop
        instances can be specified at cluster initialization time.
343 32ad0582 Iustin Pop
      </para>
344 5d6dd340 Iustin Pop
345 32ad0582 Iustin Pop
      <formalpara><title>Debian</title>
346 32ad0582 Iustin Pop
        <para>
347 32ad0582 Iustin Pop
          The recommended Debian way to configure the xen bridge is to
348 32ad0582 Iustin Pop
          edit your <filename>/etc/network/interfaces</filename> file
349 32ad0582 Iustin Pop
          and substitute your normal Ethernet stanza with the
350 32ad0582 Iustin Pop
          following snippet:
351 32ad0582 Iustin Pop
352 32ad0582 Iustin Pop
        <screen>
353 32ad0582 Iustin Pop
auto xen-br0
354 32ad0582 Iustin Pop
iface xen-br0 inet static
355 5d6dd340 Iustin Pop
        address <replaceable>YOUR_IP_ADDRESS</replaceable>
356 5d6dd340 Iustin Pop
        netmask <replaceable>YOUR_NETMASK</replaceable>
357 5d6dd340 Iustin Pop
        network <replaceable>YOUR_NETWORK</replaceable>
358 5d6dd340 Iustin Pop
        broadcast <replaceable>YOUR_BROADCAST_ADDRESS</replaceable>
359 5d6dd340 Iustin Pop
        gateway <replaceable>YOUR_GATEWAY</replaceable>
360 32ad0582 Iustin Pop
        bridge_ports eth0
361 f1a808df Guido Trotter
        bridge_stp off
362 f1a808df Guido Trotter
        bridge_fd 0
363 32ad0582 Iustin Pop
        </screen>
364 32ad0582 Iustin Pop
        </para>
365 32ad0582 Iustin Pop
      </formalpara>
366 32ad0582 Iustin Pop
367 32ad0582 Iustin Pop
     <para>
368 32ad0582 Iustin Pop
The following commands need to be executed on the local console
369 32ad0582 Iustin Pop
     </para>
370 32ad0582 Iustin Pop
      <screen>
371 32ad0582 Iustin Pop
ifdown eth0
372 32ad0582 Iustin Pop
ifup xen-br0
373 32ad0582 Iustin Pop
      </screen>
374 32ad0582 Iustin Pop
375 32ad0582 Iustin Pop
      <para>
376 32ad0582 Iustin Pop
        To check if the bridge is setup, use <command>ip</command>
377 32ad0582 Iustin Pop
        and <command>brctl show</command>:
378 32ad0582 Iustin Pop
      <para>
379 32ad0582 Iustin Pop
380 32ad0582 Iustin Pop
      <screen>
381 32ad0582 Iustin Pop
# ip a show xen-br0
382 32ad0582 Iustin Pop
9: xen-br0: &lt;BROADCAST,MULTICAST,UP,10000&gt; mtu 1500 qdisc noqueue
383 32ad0582 Iustin Pop
    link/ether 00:20:fc:1e:d5:5d brd ff:ff:ff:ff:ff:ff
384 32ad0582 Iustin Pop
    inet 10.1.1.200/24 brd 10.1.1.255 scope global xen-br0
385 32ad0582 Iustin Pop
    inet6 fe80::220:fcff:fe1e:d55d/64 scope link
386 32ad0582 Iustin Pop
       valid_lft forever preferred_lft forever
387 32ad0582 Iustin Pop
388 32ad0582 Iustin Pop
# brctl show xen-br0
389 32ad0582 Iustin Pop
bridge name     bridge id               STP enabled     interfaces
390 32ad0582 Iustin Pop
xen-br0         8000.0020fc1ed55d       no              eth0
391 5d6dd340 Iustin Pop
      </screen>
392 f1a808df Guido Trotter
393 f1a808df Guido Trotter
394 f1a808df Guido Trotter
    </sect2>
395 f1a808df Guido Trotter
396 f1a808df Guido Trotter
    <sect2>
397 f1a808df Guido Trotter
      <title>Configuring LVM</title>
398 f1a808df Guido Trotter
399 32ad0582 Iustin Pop
400 0bac47cf Iustin Pop
      <para><emphasis role="strong">Mandatory</emphasis> on all nodes.</para>
401 0bac47cf Iustin Pop
402 16450d30 Iustin Pop
      <note>
403 16450d30 Iustin Pop
        <simpara>The volume group is required to be at least
404 16450d30 Iustin Pop
        <constant>20GiB</constant>.</simpara>
405 16450d30 Iustin Pop
      </note>
406 f1a808df Guido Trotter
      <para>
407 5d6dd340 Iustin Pop
        If you haven't configured your LVM volume group at install
408 5d6dd340 Iustin Pop
        time you need to do it before trying to initialize the Ganeti
409 5d6dd340 Iustin Pop
        cluster. This is done by formatting the devices/partitions you
410 5d6dd340 Iustin Pop
        want to use for it and then adding them to the relevant volume
411 5d6dd340 Iustin Pop
        group:
412 5d6dd340 Iustin Pop
413 5d6dd340 Iustin Pop
       <screen>
414 32ad0582 Iustin Pop
pvcreate /dev/sda3
415 32ad0582 Iustin Pop
vgcreate xenvg /dev/sda3
416 32ad0582 Iustin Pop
       </screen>
417 32ad0582 Iustin Pop
or
418 32ad0582 Iustin Pop
       <screen>
419 32ad0582 Iustin Pop
pvcreate /dev/sdb1
420 f1a808df Guido Trotter
pvcreate /dev/sdc1
421 32ad0582 Iustin Pop
vgcreate xenvg /dev/sdb1 /dev/sdc1
422 5d6dd340 Iustin Pop
       </screen>
423 32ad0582 Iustin Pop
      </para>
424 f1a808df Guido Trotter
425 f1a808df Guido Trotter
      <para>
426 5d6dd340 Iustin Pop
	If you want to add a device later you can do so with the
427 53b78ba4 Guido Trotter
	<citerefentry><refentrytitle>vgextend</refentrytitle>
428 5d6dd340 Iustin Pop
	<manvolnum>8</manvolnum></citerefentry> command:
429 5d6dd340 Iustin Pop
      </para>
430 5d6dd340 Iustin Pop
431 5d6dd340 Iustin Pop
      <screen>
432 32ad0582 Iustin Pop
pvcreate /dev/sdd1
433 32ad0582 Iustin Pop
vgextend xenvg /dev/sdd1
434 5d6dd340 Iustin Pop
      </screen>
435 f1a808df Guido Trotter
    </sect2>
436 f1a808df Guido Trotter
437 f1a808df Guido Trotter
    <sect2>
438 f1a808df Guido Trotter
      <title>Installing Ganeti</title>
439 f1a808df Guido Trotter
440 0bac47cf Iustin Pop
      <para><emphasis role="strong">Mandatory</emphasis> on all nodes.</para>
441 0bac47cf Iustin Pop
442 1005b0c1 Iustin Pop
      <para>
443 32ad0582 Iustin Pop
        It's now time to install the Ganeti software itself.  Download
444 32ad0582 Iustin Pop
        the source from <ulink
445 32ad0582 Iustin Pop
        url="http://code.google.com/p/ganeti/"></ulink>.
446 1005b0c1 Iustin Pop
      </para>
447 f1a808df Guido Trotter
448 5d6dd340 Iustin Pop
        <screen>
449 32ad0582 Iustin Pop
tar xvzf ganeti-1.2b1.tar.gz
450 32ad0582 Iustin Pop
cd ganeti-1.2b1
451 5d6dd340 Iustin Pop
./configure --localstatedir=/var
452 f1a808df Guido Trotter
make
453 f1a808df Guido Trotter
make install
454 1005b0c1 Iustin Pop
mkdir /srv/ganeti/ /srv/ganeti/os /srv/ganeti/export
455 5d6dd340 Iustin Pop
        </screen>
456 f1a808df Guido Trotter
457 1005b0c1 Iustin Pop
      <para>
458 32ad0582 Iustin Pop
        You also need to copy the file
459 32ad0582 Iustin Pop
        <filename>docs/examples/ganeti.initd</filename>
460 32ad0582 Iustin Pop
        from the source archive to
461 32ad0582 Iustin Pop
        <filename>/etc/init.d/ganeti</filename> and register it with
462 1005b0c1 Iustin Pop
        your distribution's startup scripts, for example in Debian:
463 f1a808df Guido Trotter
      </para>
464 1005b0c1 Iustin Pop
      <screen>update-rc.d ganeti defaults 20 80</screen>
465 f1a808df Guido Trotter
466 f1a808df Guido Trotter
    </sect2>
467 f1a808df Guido Trotter
468 f1a808df Guido Trotter
    <sect2>
469 f1a808df Guido Trotter
      <title>Installing the Operating System support packages</title>
470 f1a808df Guido Trotter
471 0bac47cf Iustin Pop
      <para><emphasis role="strong">Mandatory</emphasis> on all nodes.</para>
472 0bac47cf Iustin Pop
473 a7a19281 Iustin Pop
      <para>
474 32ad0582 Iustin Pop
        To be able to install instances you need to have an Operating
475 32ad0582 Iustin Pop
        System installation script. An example for Debian Etch is
476 32ad0582 Iustin Pop
        provided on the project web site.  Download it from <ulink
477 32ad0582 Iustin Pop
        url="http://code.google.com/p/ganeti/"></ulink> and follow the
478 32ad0582 Iustin Pop
        instructions in the <filename>README</filename> file.  Here is
479 32ad0582 Iustin Pop
        the installation procedure:
480 a7a19281 Iustin Pop
      </para>
481 a7a19281 Iustin Pop
482 32ad0582 Iustin Pop
      <screen>
483 32ad0582 Iustin Pop
cd /srv/ganeti/os
484 32ad0582 Iustin Pop
tar xvf instance-debian-etch-0.1.tar
485 32ad0582 Iustin Pop
mv instance-debian-etch-0.1 debian-etch
486 32ad0582 Iustin Pop
      </screen>
487 32ad0582 Iustin Pop
488 a7a19281 Iustin Pop
      <para>
489 16450d30 Iustin Pop
        In order to use this OS definition, you need to have internet
490 16450d30 Iustin Pop
        access from your nodes and have <citerefentry>
491 16450d30 Iustin Pop
        <refentrytitle>debootstrap</refentrytitle>
492 16450d30 Iustin Pop
        <manvolnum>8</manvolnum> </citerefentry> installed on all the
493 16450d30 Iustin Pop
        nodes.
494 16450d30 Iustin Pop
      </para>
495 16450d30 Iustin Pop
      <formalpara>
496 16450d30 Iustin Pop
        <title>Debian</title>
497 16450d30 Iustin Pop
        <para>
498 16450d30 Iustin Pop
          Use this command on all nodes to install
499 16450d30 Iustin Pop
          <computeroutput>debootstrap</computeroutput>:
500 16450d30 Iustin Pop
501 16450d30 Iustin Pop
          <screen>apt-get install debootstrap</screen>
502 16450d30 Iustin Pop
        </para>
503 16450d30 Iustin Pop
      </formalpara>
504 16450d30 Iustin Pop
505 16450d30 Iustin Pop
      <para>
506 32ad0582 Iustin Pop
        Alternatively, you can create your own OS definitions. See the
507 0bac47cf Iustin Pop
        manpage
508 a7a19281 Iustin Pop
        <citerefentry>
509 a7a19281 Iustin Pop
        <refentrytitle>ganeti-os-interface</refentrytitle>
510 a7a19281 Iustin Pop
        <manvolnum>8</manvolnum>
511 a7a19281 Iustin Pop
        </citerefentry>.
512 f1a808df Guido Trotter
      </para>
513 f1a808df Guido Trotter
514 f1a808df Guido Trotter
    </sect2>
515 f1a808df Guido Trotter
516 f1a808df Guido Trotter
    <sect2>
517 f1a808df Guido Trotter
      <title>Initializing the cluster</title>
518 f1a808df Guido Trotter
519 5d6dd340 Iustin Pop
      <para><emphasis role="strong">Mandatory:</emphasis> only on one
520 5d6dd340 Iustin Pop
      node per cluster.</para>
521 f1a808df Guido Trotter
522 f1a808df Guido Trotter
523 f1a808df Guido Trotter
      <para>The last step is to initialize the cluster. After you've repeated
524 32ad0582 Iustin Pop
        the above process on all of your nodes, choose one as the master, and execute:
525 5d6dd340 Iustin Pop
      </para>
526 f1a808df Guido Trotter
527 5d6dd340 Iustin Pop
      <screen>
528 5d6dd340 Iustin Pop
gnt-cluster init <replaceable>CLUSTERNAME</replaceable>
529 5d6dd340 Iustin Pop
      </screen>
530 f1a808df Guido Trotter
531 5d6dd340 Iustin Pop
      <para>
532 0bac47cf Iustin Pop
        The <replaceable>CLUSTERNAME</replaceable> is a hostname,
533 0bac47cf Iustin Pop
        which must be resolvable (e.g. it must exist in DNS or in
534 0bac47cf Iustin Pop
        <filename>/etc/hosts</filename>) by all the nodes in the
535 0bac47cf Iustin Pop
        cluster. You must choose a name different from any of the
536 0bac47cf Iustin Pop
        nodes names for a multi-node cluster. In general the best
537 0bac47cf Iustin Pop
        choice is to have a unique name for a cluster, even if it
538 0bac47cf Iustin Pop
        consists of only one machine, as you will be able to expand it
539 0bac47cf Iustin Pop
        later without any problems.
540 0bac47cf Iustin Pop
      </para>
541 0bac47cf Iustin Pop
542 0bac47cf Iustin Pop
      <para>
543 32ad0582 Iustin Pop
        If the bridge name you are using is not
544 32ad0582 Iustin Pop
        <literal>xen-br0</literal>, use the <option>-b
545 32ad0582 Iustin Pop
        <replaceable>BRIDGENAME</replaceable></option> option to
546 32ad0582 Iustin Pop
        specify the bridge name. In this case, you should also use the
547 32ad0582 Iustin Pop
        <option>--master-netdev
548 32ad0582 Iustin Pop
        <replaceable>BRIDGENAME</replaceable></option> option with the
549 32ad0582 Iustin Pop
        same <replaceable>BRIDGENAME</replaceable> argument.
550 1005b0c1 Iustin Pop
      </para>
551 1005b0c1 Iustin Pop
552 1005b0c1 Iustin Pop
      <para>
553 32ad0582 Iustin Pop
        You can use a different name than <literal>xenvg</literal> for
554 32ad0582 Iustin Pop
        the volume group (but note that the name must be identical on
555 32ad0582 Iustin Pop
        all nodes). In this case you need to specify it by passing the
556 32ad0582 Iustin Pop
        <option>-g <replaceable>VGNAME</replaceable></option> option
557 32ad0582 Iustin Pop
        to <computeroutput>gnt-cluster init</computeroutput>.
558 f1a808df Guido Trotter
      </para>
559 f1a808df Guido Trotter
560 5d6dd340 Iustin Pop
      <para>
561 32ad0582 Iustin Pop
        You can also invoke the command with the
562 32ad0582 Iustin Pop
        <option>--help</option> option in order to see all the
563 32ad0582 Iustin Pop
        possibilities.
564 f1a808df Guido Trotter
      </para>
565 32ad0582 Iustin Pop
566 f1a808df Guido Trotter
    </sect2>
567 f1a808df Guido Trotter
568 f1a808df Guido Trotter
    <sect2>
569 32ad0582 Iustin Pop
      <title>Joining the nodes to the cluster</title>
570 f1a808df Guido Trotter
571 5d6dd340 Iustin Pop
      <para>
572 5d6dd340 Iustin Pop
        <emphasis role="strong">Mandatory:</emphasis> for all the
573 5d6dd340 Iustin Pop
        other nodes.
574 f1a808df Guido Trotter
      </para>
575 f1a808df Guido Trotter
576 f1a808df Guido Trotter
      <para>
577 0bac47cf Iustin Pop
        After you have initialized your cluster you need to join the
578 0bac47cf Iustin Pop
        other nodes to it. You can do so by executing the following
579 0bac47cf Iustin Pop
        command on the master node:
580 32ad0582 Iustin Pop
      </para>
581 5d6dd340 Iustin Pop
        <screen>
582 5d6dd340 Iustin Pop
gnt-node add <replaceable>NODENAME</replaceable>
583 5d6dd340 Iustin Pop
        </screen>
584 32ad0582 Iustin Pop
    </sect2>
585 f1a808df Guido Trotter
586 32ad0582 Iustin Pop
    <sect2>
587 32ad0582 Iustin Pop
      <title>Separate replication network</title>
588 32ad0582 Iustin Pop
589 32ad0582 Iustin Pop
      <para><emphasis role="strong">Optional</emphasis></para>
590 32ad0582 Iustin Pop
      <para>
591 32ad0582 Iustin Pop
        Ganeti uses DRBD to mirror the disk of the virtual instances
592 32ad0582 Iustin Pop
        between nodes. To use a dedicated network interface for this
593 32ad0582 Iustin Pop
        (in order to improve performance or to enhance security) you
594 32ad0582 Iustin Pop
        need to configure an additional interface for each node.  Use
595 32ad0582 Iustin Pop
        the <option>-s</option> option with
596 32ad0582 Iustin Pop
        <computeroutput>gnt-cluster init</computeroutput> and
597 32ad0582 Iustin Pop
        <computeroutput>gnt-node add</computeroutput> to specify the
598 32ad0582 Iustin Pop
        IP address of this secondary inteface to use for each
599 32ad0582 Iustin Pop
        node. Note that if you specified this option at cluster setup
600 32ad0582 Iustin Pop
        time, you must afterwards use it for every node add operation.
601 f1a808df Guido Trotter
      </para>
602 f1a808df Guido Trotter
    </sect2>
603 f1a808df Guido Trotter
604 32ad0582 Iustin Pop
    <sect2>
605 32ad0582 Iustin Pop
      <title>Testing the setup</title>
606 f1a808df Guido Trotter
607 32ad0582 Iustin Pop
      <para>
608 f1a808df Guido Trotter
609 32ad0582 Iustin Pop
        Execute the <computeroutput>gnt-node list</computeroutput>
610 32ad0582 Iustin Pop
        command to see all nodes in the cluster:
611 32ad0582 Iustin Pop
      <screen>
612 32ad0582 Iustin Pop
# gnt-node list
613 32ad0582 Iustin Pop
Node              DTotal  DFree MTotal MNode MFree Pinst Sinst
614 32ad0582 Iustin Pop
node1.example.com 197404 197404   2047  1896   125     0     0
615 32ad0582 Iustin Pop
      </screen>
616 f1a808df Guido Trotter
    </para>
617 32ad0582 Iustin Pop
  </sect2>
618 f1a808df Guido Trotter
619 32ad0582 Iustin Pop
  <sect1>
620 32ad0582 Iustin Pop
    <title>Setting up and managing virtual instances</title>
621 32ad0582 Iustin Pop
    <sect2>
622 32ad0582 Iustin Pop
      <title>Setting up virtual instances</title>
623 32ad0582 Iustin Pop
      <para>
624 32ad0582 Iustin Pop
        This step shows how to setup a virtual instance with either
625 32ad0582 Iustin Pop
        non-mirrored disks (<computeroutput>plain</computeroutput>) or
626 32ad0582 Iustin Pop
        with network mirrored disks
627 32ad0582 Iustin Pop
        (<computeroutput>remote_raid1</computeroutput>).  All commands
628 32ad0582 Iustin Pop
        need to be executed on the Ganeti master node (the one on
629 32ad0582 Iustin Pop
        which <computeroutput>gnt-cluster init</computeroutput> was
630 32ad0582 Iustin Pop
        run).  Verify that the OS scripts are present on all cluster
631 32ad0582 Iustin Pop
        nodes with <computeroutput>gnt-os list</computeroutput>.
632 32ad0582 Iustin Pop
      </para>
633 32ad0582 Iustin Pop
      <para>
634 32ad0582 Iustin Pop
        To create a virtual instance, you need a hostname which is
635 32ad0582 Iustin Pop
        resolvable (DNS or <filename>/etc/hosts</filename> on all
636 32ad0582 Iustin Pop
        nodes). The following command will create a non-mirrored
637 32ad0582 Iustin Pop
        instance for you:
638 32ad0582 Iustin Pop
      </para>
639 32ad0582 Iustin Pop
      <screen>
640 32ad0582 Iustin Pop
gnt-instance add --node=node1 -o debian-etch -t plain inst1.example.com
641 32ad0582 Iustin Pop
* creating instance disks...
642 32ad0582 Iustin Pop
adding instance inst1.example.com to cluster config
643 32ad0582 Iustin Pop
Waiting for instance inst1.example.com to sync disks.
644 32ad0582 Iustin Pop
Instance inst1.example.com's disks are in sync.
645 32ad0582 Iustin Pop
creating os for instance inst1.example.com on node node1.example.com
646 32ad0582 Iustin Pop
* running the instance OS create scripts...
647 32ad0582 Iustin Pop
      </screen>
648 32ad0582 Iustin Pop
649 32ad0582 Iustin Pop
      <para>
650 32ad0582 Iustin Pop
        The above instance will have no network interface enabled.
651 32ad0582 Iustin Pop
        You can access it over the virtual console with
652 32ad0582 Iustin Pop
        <computeroutput>gnt-instance console
653 32ad0582 Iustin Pop
        <literal>inst1</literal></computeroutput>. There is no
654 32ad0582 Iustin Pop
        password for root.  As this is a Debian instance, you can
655 32ad0582 Iustin Pop
        modifiy the <filename>/etc/network/interfaces</filename> file
656 32ad0582 Iustin Pop
        to setup the network interface (<literal>eth0</literal> is the
657 32ad0582 Iustin Pop
        name of the interface provided to the instance).
658 32ad0582 Iustin Pop
      </para>
659 f1a808df Guido Trotter
660 32ad0582 Iustin Pop
      <para>
661 32ad0582 Iustin Pop
        To create a network mirrored instance, change the argument to
662 32ad0582 Iustin Pop
        the <option>-t</option> option from <literal>plain</literal>
663 32ad0582 Iustin Pop
        to <literal>remote_raid1</literal> and specify the node on
664 32ad0582 Iustin Pop
        which the mirror should reside with the
665 32ad0582 Iustin Pop
        <option>--secondary-node</option> option, like this:
666 32ad0582 Iustin Pop
      </para>
667 32ad0582 Iustin Pop
668 32ad0582 Iustin Pop
      <screen>
669 32ad0582 Iustin Pop
# gnt-instance add -t remote_raid1 --secondary-node node1 \
670 32ad0582 Iustin Pop
  -n node2 -o debian-etch instance2
671 32ad0582 Iustin Pop
* creating instance disks...
672 32ad0582 Iustin Pop
adding instance instance2 to cluster config
673 32ad0582 Iustin Pop
Waiting for instance instance1 to sync disks.
674 32ad0582 Iustin Pop
- device sdb:  3.50% done, 304 estimated seconds remaining
675 32ad0582 Iustin Pop
- device sdb: 21.70% done, 270 estimated seconds remaining
676 32ad0582 Iustin Pop
- device sdb: 39.80% done, 247 estimated seconds remaining
677 32ad0582 Iustin Pop
- device sdb: 58.10% done, 121 estimated seconds remaining
678 32ad0582 Iustin Pop
- device sdb: 76.30% done, 72 estimated seconds remaining
679 32ad0582 Iustin Pop
- device sdb: 94.80% done, 18 estimated seconds remaining
680 32ad0582 Iustin Pop
Instance instance2's disks are in sync.
681 32ad0582 Iustin Pop
creating os for instance instance2 on node node2.example.com
682 32ad0582 Iustin Pop
* running the instance OS create scripts...
683 32ad0582 Iustin Pop
* starting instance...
684 32ad0582 Iustin Pop
      </screen>
685 32ad0582 Iustin Pop
686 32ad0582 Iustin Pop
    </sect2>
687 32ad0582 Iustin Pop
688 32ad0582 Iustin Pop
    <sect2>
689 32ad0582 Iustin Pop
      <title>Managing virtual instances</title>
690 32ad0582 Iustin Pop
      <para>
691 32ad0582 Iustin Pop
        All commands need to be executed on the Ganeti master node
692 32ad0582 Iustin Pop
      </para>
693 32ad0582 Iustin Pop
694 32ad0582 Iustin Pop
      <para>
695 32ad0582 Iustin Pop
        To access the console of an instance, use
696 32ad0582 Iustin Pop
        <computeroutput>gnt-instance console
697 32ad0582 Iustin Pop
        <replaceable>INSTANCENAME</replaceable></computeroutput>.
698 32ad0582 Iustin Pop
      </para>
699 32ad0582 Iustin Pop
700 32ad0582 Iustin Pop
      <para>
701 32ad0582 Iustin Pop
        To shutdown an instance, use <computeroutput>gnt-instance
702 32ad0582 Iustin Pop
        shutdown
703 32ad0582 Iustin Pop
        <replaceable>INSTANCENAME</replaceable></computeroutput>. To
704 32ad0582 Iustin Pop
        startup an instance, use <computeroutput>gnt-instance startup
705 32ad0582 Iustin Pop
        <replaceable>INSTANCENAME</replaceable></computeroutput>.
706 32ad0582 Iustin Pop
      </para>
707 32ad0582 Iustin Pop
708 32ad0582 Iustin Pop
      <para>
709 32ad0582 Iustin Pop
        To failover an instance to its secondary node (only possible
710 32ad0582 Iustin Pop
        in <literal>remote_raid1</literal> setup), use
711 32ad0582 Iustin Pop
        <computeroutput>gnt-instance failover
712 32ad0582 Iustin Pop
        <replaceable>INSTANCENAME</replaceable></computeroutput>.
713 32ad0582 Iustin Pop
      </para>
714 32ad0582 Iustin Pop
715 32ad0582 Iustin Pop
      <para>
716 32ad0582 Iustin Pop
        For more instance and cluster administration details, see the
717 32ad0582 Iustin Pop
        <emphasis>Ganeti administrator's guide</emphasis>.
718 32ad0582 Iustin Pop
      </para>
719 32ad0582 Iustin Pop
720 32ad0582 Iustin Pop
    </sect2>
721 32ad0582 Iustin Pop
722 32ad0582 Iustin Pop
  </sect1>
723 f1a808df Guido Trotter
724 f1a808df Guido Trotter
  </article>