root / doc / install.rst @ c71a1a3d
History | View | Annotate | Download (23.5 kB)
1 |
Ganeti installation tutorial |
---|---|
2 |
============================ |
3 |
|
4 |
Documents Ganeti version |version| |
5 |
|
6 |
.. contents:: |
7 |
|
8 |
.. highlight:: text |
9 |
|
10 |
Introduction |
11 |
------------ |
12 |
|
13 |
Ganeti is a cluster virtualization management system based on Xen or |
14 |
KVM. This document explains how to bootstrap a Ganeti node (Xen *dom0*, |
15 |
the host Linux system for KVM), create a running cluster and install |
16 |
virtual instances (Xen *domUs*, KVM guests). You need to repeat most of |
17 |
the steps in this document for every node you want to install, but of |
18 |
course we recommend creating some semi-automatic procedure if you plan |
19 |
to deploy Ganeti on a medium/large scale. |
20 |
|
21 |
A basic Ganeti terminology glossary is provided in the introductory |
22 |
section of the :doc:`admin`. Please refer to that document if you are |
23 |
uncertain about the terms we are using. |
24 |
|
25 |
Ganeti has been developed for Linux and should be distribution-agnostic. |
26 |
This documentation will use Debian Lenny as an example system but the |
27 |
examples can be translated to any other distribution. You are expected |
28 |
to be familiar with your distribution, its package management system, |
29 |
and Xen or KVM before trying to use Ganeti. |
30 |
|
31 |
This document is divided into two main sections: |
32 |
|
33 |
- Installation of the base system and base components |
34 |
|
35 |
- Configuration of the environment for Ganeti |
36 |
|
37 |
Each of these is divided into sub-sections. While a full Ganeti system |
38 |
will need all of the steps specified, some are not strictly required for |
39 |
every environment. Which ones they are, and why, is specified in the |
40 |
corresponding sections. |
41 |
|
42 |
Installing the base system and base components |
43 |
---------------------------------------------- |
44 |
|
45 |
Hardware requirements |
46 |
+++++++++++++++++++++ |
47 |
|
48 |
Any system supported by your Linux distribution is fine. 64-bit systems |
49 |
are better as they can support more memory. |
50 |
|
51 |
Any disk drive recognized by Linux (``IDE``/``SCSI``/``SATA``/etc.) is |
52 |
supported in Ganeti. Note that no shared storage (e.g. ``SAN``) is |
53 |
needed to get high-availability features (but of course, one can be used |
54 |
to store the images). It is highly recommended to use more than one disk |
55 |
drive to improve speed. But Ganeti also works with one disk per machine. |
56 |
|
57 |
Installing the base system |
58 |
++++++++++++++++++++++++++ |
59 |
|
60 |
**Mandatory** on all nodes. |
61 |
|
62 |
It is advised to start with a clean, minimal install of the operating |
63 |
system. The only requirement you need to be aware of at this stage is to |
64 |
partition leaving enough space for a big (**minimum** 20GiB) LVM volume |
65 |
group which will then host your instance filesystems, if you want to use |
66 |
all Ganeti features. The volume group name Ganeti uses (by default) is |
67 |
``xenvg``. |
68 |
|
69 |
You can also use file-based storage only, without LVM, but this setup is |
70 |
not detailed in this document. |
71 |
|
72 |
While you can use an existing system, please note that the Ganeti |
73 |
installation is intrusive in terms of changes to the system |
74 |
configuration, and it's best to use a newly-installed system without |
75 |
important data on it. |
76 |
|
77 |
Also, for best results, it's advised that the nodes have as much as |
78 |
possible the same hardware and software configuration. This will make |
79 |
administration much easier. |
80 |
|
81 |
Hostname issues |
82 |
~~~~~~~~~~~~~~~ |
83 |
|
84 |
Note that Ganeti requires the hostnames of the systems (i.e. what the |
85 |
``hostname`` command outputs to be a fully-qualified name, not a short |
86 |
name. In other words, you should use *node1.example.com* as a hostname |
87 |
and not just *node1*. |
88 |
|
89 |
.. admonition:: Debian |
90 |
|
91 |
Debian Lenny and Etch configures the hostname differently than you |
92 |
need it for Ganeti. For example, this is what Etch puts in |
93 |
``/etc/hosts`` in certain situations:: |
94 |
|
95 |
127.0.0.1 localhost |
96 |
127.0.1.1 node1.example.com node1 |
97 |
|
98 |
but for Ganeti you need to have:: |
99 |
|
100 |
127.0.0.1 localhost |
101 |
192.168.1.1 node1.example.com node1 |
102 |
|
103 |
replacing ``192.168.1.1`` with your node's address. Also, the file |
104 |
``/etc/hostname`` which configures the hostname of the system |
105 |
should contain ``node1.example.com`` and not just ``node1`` (you |
106 |
need to run the command ``/etc/init.d/hostname.sh start`` after |
107 |
changing the file). |
108 |
|
109 |
.. admonition:: Why a fully qualified host name |
110 |
|
111 |
Although most distributions use only the short name in the |
112 |
/etc/hostname file, we still think Ganeti nodes should use the full |
113 |
name. The reason for this is that calling 'hostname --fqdn' requires |
114 |
the resolver library to work and is a 'guess' via heuristics at what |
115 |
is your domain name. Since Ganeti can be used among other things to |
116 |
host DNS servers, we don't want to depend on them as much as |
117 |
possible, and we'd rather have the uname() syscall return the full |
118 |
node name. |
119 |
|
120 |
We haven't ever found any breakage in using a full hostname on a |
121 |
Linux system, and anyway we recommend to have only a minimal |
122 |
installation on Ganeti nodes, and to use instances (or other |
123 |
dedicated machines) to run the rest of your network services. By |
124 |
doing this you can change the /etc/hostname file to contain an FQDN |
125 |
without the fear of breaking anything unrelated. |
126 |
|
127 |
|
128 |
Installing The Hypervisor |
129 |
+++++++++++++++++++++++++ |
130 |
|
131 |
**Mandatory** on all nodes. |
132 |
|
133 |
While Ganeti is developed with the ability to modularly run on different |
134 |
virtualization environments in mind the only two currently useable on a |
135 |
live system are Xen and KVM. Supported Xen versions are: 3.0.3, 3.0.4 |
136 |
and 3.1. Supported KVM version are 72 and above. |
137 |
|
138 |
Please follow your distribution's recommended way to install and set up |
139 |
Xen, or install Xen from the upstream source, if you wish, following |
140 |
their manual. For KVM, make sure you have a KVM-enabled kernel and the |
141 |
KVM tools. |
142 |
|
143 |
After installing Xen, you need to reboot into your new system. On some |
144 |
distributions this might involve configuring GRUB appropriately, whereas |
145 |
others will configure it automatically when you install the respective |
146 |
kernels. For KVM no reboot should be necessary. |
147 |
|
148 |
.. admonition:: Xen on Debian |
149 |
|
150 |
Under Lenny or Etch you can install the relevant ``xen-linux-system`` |
151 |
package, which will pull in both the hypervisor and the relevant |
152 |
kernel. Also, if you are installing a 32-bit Lenny/Etch, you should |
153 |
install the ``libc6-xen`` package (run ``apt-get install |
154 |
libc6-xen``). |
155 |
|
156 |
Xen settings |
157 |
~~~~~~~~~~~~ |
158 |
|
159 |
It's recommended that dom0 is restricted to a low amount of memory |
160 |
(512MiB or 1GiB is reasonable) and that memory ballooning is disabled in |
161 |
the file ``/etc/xen/xend-config.sxp`` by setting the value |
162 |
``dom0-min-mem`` to 0, like this:: |
163 |
|
164 |
(dom0-min-mem 0) |
165 |
|
166 |
For optimum performance when running both CPU and I/O intensive |
167 |
instances, it's also recommended that the dom0 is restricted to one CPU |
168 |
only, for example by booting with the kernel parameter ``nosmp``. |
169 |
|
170 |
It is recommended that you disable xen's automatic save of virtual |
171 |
machines at system shutdown and subsequent restore of them at reboot. |
172 |
To obtain this make sure the variable ``XENDOMAINS_SAVE`` in the file |
173 |
``/etc/default/xendomains`` is set to an empty value. |
174 |
|
175 |
If you want to use live migration make sure you have, in the xen config |
176 |
file, something that allows the nodes to migrate instances between each |
177 |
other. For example:: |
178 |
|
179 |
(xend-relocation-server yes) |
180 |
(xend-relocation-port 8002) |
181 |
(xend-relocation-address '') |
182 |
(xend-relocation-hosts-allow '^192\\.168\\.3\\.[0-9]+$') |
183 |
|
184 |
The last line assumes that all your nodes have secondary IPs in the |
185 |
192.168.3.0/24 network, adjust it accordingly to your setup. |
186 |
|
187 |
.. admonition:: Debian |
188 |
|
189 |
Besides the ballooning change which you need to set in |
190 |
``/etc/xen/xend-config.sxp``, you need to set the memory and nosmp |
191 |
parameters in the file ``/boot/grub/menu.lst``. You need to modify |
192 |
the variable ``xenhopt`` to add ``dom0_mem=1024M`` like this:: |
193 |
|
194 |
## Xen hypervisor options to use with the default Xen boot option |
195 |
# xenhopt=dom0_mem=1024M |
196 |
|
197 |
and the ``xenkopt`` needs to include the ``nosmp`` option like this:: |
198 |
|
199 |
## Xen Linux kernel options to use with the default Xen boot option |
200 |
# xenkopt=nosmp |
201 |
|
202 |
Any existing parameters can be left in place: it's ok to have |
203 |
``xenkopt=console=tty0 nosmp``, for example. After modifying the |
204 |
files, you need to run:: |
205 |
|
206 |
/sbin/update-grub |
207 |
|
208 |
If you want to run HVM instances too with Ganeti and want VNC access to |
209 |
the console of your instances, set the following two entries in |
210 |
``/etc/xen/xend-config.sxp``:: |
211 |
|
212 |
(vnc-listen '0.0.0.0') (vncpasswd '') |
213 |
|
214 |
You need to restart the Xen daemon for these settings to take effect:: |
215 |
|
216 |
/etc/init.d/xend restart |
217 |
|
218 |
Selecting the instance kernel |
219 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
220 |
|
221 |
After you have installed Xen, you need to tell Ganeti exactly what |
222 |
kernel to use for the instances it will create. This is done by creating |
223 |
a symlink from your actual kernel to ``/boot/vmlinuz-2.6-xenU``, and one |
224 |
from your initrd to ``/boot/initrd-2.6-xenU`` [#defkernel]_. Note that |
225 |
if you don't use an initrd for the domU kernel, you don't need to create |
226 |
the initrd symlink. |
227 |
|
228 |
.. admonition:: Debian |
229 |
|
230 |
After installation of the ``xen-linux-system`` package, you need to |
231 |
run (replace the exact version number with the one you have):: |
232 |
|
233 |
cd /boot |
234 |
ln -s vmlinuz-2.6.26-1-xen-amd64 vmlinuz-2.6-xenU |
235 |
ln -s initrd.img-2.6.26-1-xen-amd64 initrd-2.6-xenU |
236 |
|
237 |
Installing DRBD |
238 |
+++++++++++++++ |
239 |
|
240 |
Recommended on all nodes: DRBD_ is required if you want to use the high |
241 |
availability (HA) features of Ganeti, but optional if you don't require |
242 |
them or only run Ganeti on single-node clusters. You can upgrade a |
243 |
non-HA cluster to an HA one later, but you might need to export and |
244 |
re-import all your instances to take advantage of the new features. |
245 |
|
246 |
.. _DRBD: http://www.drbd.org/ |
247 |
|
248 |
Supported DRBD versions: 8.0+. It's recommended to have at least version |
249 |
8.0.12. Note that for version 8.2 and newer it is needed to pass the |
250 |
``usermode_helper=/bin/true`` parameter to the module, either by |
251 |
configuring ``/etc/modules`` or when inserting it manually. |
252 |
|
253 |
Now the bad news: unless your distribution already provides it |
254 |
installing DRBD might involve recompiling your kernel or anyway fiddling |
255 |
with it. Hopefully at least the Xen-ified kernel source to start from |
256 |
will be provided (if you intend to use Xen). |
257 |
|
258 |
The good news is that you don't need to configure DRBD at all. Ganeti |
259 |
will do it for you for every instance you set up. If you have the DRBD |
260 |
utils installed and the module in your kernel you're fine. Please check |
261 |
that your system is configured to load the module at every boot, and |
262 |
that it passes the following option to the module: |
263 |
``minor_count=NUMBER``. We recommend that you use 128 as the value of |
264 |
the minor_count - this will allow you to use up to 64 instances in total |
265 |
per node (both primary and secondary, when using only one disk per |
266 |
instance). You can increase the number up to 255 if you need more |
267 |
instances on a node. |
268 |
|
269 |
|
270 |
.. admonition:: Debian |
271 |
|
272 |
On Debian, you can just install (build) the DRBD module with the |
273 |
following commands, making sure you are running the target (Xen or |
274 |
KVM) kernel:: |
275 |
|
276 |
apt-get install drbd8-source drbd8-utils |
277 |
m-a update |
278 |
m-a a-i drbd8 |
279 |
echo drbd minor_count=128 usermode_helper=/bin/true >> /etc/modules |
280 |
depmod -a |
281 |
modprobe drbd minor_count=128 usermode_helper=/bin/true |
282 |
|
283 |
It is also recommended that you comment out the default resources in |
284 |
the ``/etc/drbd.conf`` file, so that the init script doesn't try to |
285 |
configure any drbd devices. You can do this by prefixing all |
286 |
*resource* lines in the file with the keyword *skip*, like this:: |
287 |
|
288 |
skip resource r0 { |
289 |
... |
290 |
} |
291 |
|
292 |
skip resource "r1" { |
293 |
... |
294 |
} |
295 |
|
296 |
Other required software |
297 |
+++++++++++++++++++++++ |
298 |
|
299 |
Besides Xen and DRBD, you will need to install the following (on all |
300 |
nodes): |
301 |
|
302 |
- LVM version 2, `<http://sourceware.org/lvm2/>`_ |
303 |
|
304 |
- OpenSSL, `<http://www.openssl.org/>`_ |
305 |
|
306 |
- OpenSSH, `<http://www.openssh.com/portable.html>`_ |
307 |
|
308 |
- bridge utilities, `<http://bridge.sourceforge.net/>`_ |
309 |
|
310 |
- iproute2, `<http://developer.osdl.org/dev/iproute2>`_ |
311 |
|
312 |
- arping (part of iputils package), |
313 |
`<ftp://ftp.inr.ac.ru/ip-routing/iputils-current.tar.gz>`_ |
314 |
|
315 |
- Python version 2.4 or 2.5, `<http://www.python.org>`_ |
316 |
|
317 |
- Python OpenSSL bindings, `<http://pyopenssl.sourceforge.net/>`_ |
318 |
|
319 |
- simplejson Python module, `<http://www.undefined.org/python/#simplejson>`_ |
320 |
|
321 |
- pyparsing Python module, `<http://pyparsing.wikispaces.com/>`_ |
322 |
|
323 |
- pyinotify Python module, `<http://trac.dbzteam.org/pyinotify>`_ |
324 |
|
325 |
These programs are supplied as part of most Linux distributions, so |
326 |
usually they can be installed via apt or similar methods. Also many of |
327 |
them will already be installed on a standard machine. |
328 |
|
329 |
|
330 |
.. admonition:: Debian |
331 |
|
332 |
You can use this command line to install all needed packages:: |
333 |
|
334 |
# apt-get install lvm2 ssh bridge-utils iproute iputils-arping \ |
335 |
python python-pyopenssl openssl python-pyparsing \ |
336 |
python-simplejson python-pyinotify |
337 |
|
338 |
Setting up the environment for Ganeti |
339 |
------------------------------------- |
340 |
|
341 |
Configuring the network |
342 |
+++++++++++++++++++++++ |
343 |
|
344 |
**Mandatory** on all nodes. |
345 |
|
346 |
You can run Ganeti either in "bridge mode" or in "routed mode". In |
347 |
bridge mode, the default, the instances network interfaces will be |
348 |
attached to a software bridge running in dom0. Xen by default creates |
349 |
such a bridge at startup, but your distribution might have a different |
350 |
way to do things, and you'll definitely need to manually set it up under |
351 |
KVM. |
352 |
|
353 |
Beware that the default name Ganeti uses is ``xen-br0`` (which was used |
354 |
in Xen 2.0) while Xen 3.0 uses ``xenbr0`` by default. The default bridge |
355 |
your Ganeti cluster will use for new instances can be specified at |
356 |
cluster initialization time. |
357 |
|
358 |
If you want to run in "routing mode" you need to specify that at cluster |
359 |
init time (using the --nicparam option), and then no bridge will be |
360 |
needed. In this mode instance traffic will be routed by dom0, instead of |
361 |
bridged. |
362 |
|
363 |
In order to use "routing mode" under Xen, you'll need to change the |
364 |
relevant parameters in the Xen config file. Under KVM instead, no config |
365 |
change is necessary, but you still need to set up your network |
366 |
interfaces correctly. |
367 |
|
368 |
By default, under KVM, the "link" parameter you specify per-nic will |
369 |
represent, if non-empty, a different routing table name or number to use |
370 |
for your instances. This allows insulation between different instance |
371 |
groups, and different routing policies between node traffic and instance |
372 |
traffic. |
373 |
|
374 |
You will need to configure your routing table basic routes and rules |
375 |
outside of ganeti. The vif scripts will only add /32 routes to your |
376 |
instances, through their interface, in the table you specified (under |
377 |
KVM, and in the main table under Xen). |
378 |
|
379 |
.. admonition:: Bridging under Debian |
380 |
|
381 |
The recommended way to configure the Xen bridge is to edit your |
382 |
``/etc/network/interfaces`` file and substitute your normal |
383 |
Ethernet stanza with the following snippet:: |
384 |
|
385 |
auto xen-br0 |
386 |
iface xen-br0 inet static |
387 |
address YOUR_IP_ADDRESS |
388 |
netmask YOUR_NETMASK |
389 |
network YOUR_NETWORK |
390 |
broadcast YOUR_BROADCAST_ADDRESS |
391 |
gateway YOUR_GATEWAY |
392 |
bridge_ports eth0 |
393 |
bridge_stp off |
394 |
bridge_fd 0 |
395 |
|
396 |
The following commands need to be executed on the local console: |
397 |
|
398 |
ifdown eth0 |
399 |
ifup xen-br0 |
400 |
|
401 |
To check if the bridge is setup, use the ``ip`` and ``brctl show`` |
402 |
commands:: |
403 |
|
404 |
# ip a show xen-br0 |
405 |
9: xen-br0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc noqueue |
406 |
link/ether 00:20:fc:1e:d5:5d brd ff:ff:ff:ff:ff:ff |
407 |
inet 10.1.1.200/24 brd 10.1.1.255 scope global xen-br0 |
408 |
inet6 fe80::220:fcff:fe1e:d55d/64 scope link |
409 |
valid_lft forever preferred_lft forever |
410 |
|
411 |
# brctl show xen-br0 |
412 |
bridge name bridge id STP enabled interfaces |
413 |
xen-br0 8000.0020fc1ed55d no eth0 |
414 |
|
415 |
.. _configure-lvm-label: |
416 |
|
417 |
Configuring LVM |
418 |
+++++++++++++++ |
419 |
|
420 |
**Mandatory** on all nodes. |
421 |
|
422 |
The volume group is required to be at least 20GiB. |
423 |
|
424 |
If you haven't configured your LVM volume group at install time you need |
425 |
to do it before trying to initialize the Ganeti cluster. This is done by |
426 |
formatting the devices/partitions you want to use for it and then adding |
427 |
them to the relevant volume group:: |
428 |
|
429 |
pvcreate /dev/sda3 |
430 |
vgcreate xenvg /dev/sda3 |
431 |
|
432 |
or:: |
433 |
|
434 |
pvcreate /dev/sdb1 |
435 |
pvcreate /dev/sdc1 |
436 |
vgcreate xenvg /dev/sdb1 /dev/sdc1 |
437 |
|
438 |
If you want to add a device later you can do so with the *vgextend* |
439 |
command:: |
440 |
|
441 |
pvcreate /dev/sdd1 |
442 |
vgextend xenvg /dev/sdd1 |
443 |
|
444 |
Optional: it is recommended to configure LVM not to scan the DRBD |
445 |
devices for physical volumes. This can be accomplished by editing |
446 |
``/etc/lvm/lvm.conf`` and adding the ``/dev/drbd[0-9]+`` regular |
447 |
expression to the ``filter`` variable, like this:: |
448 |
|
449 |
filter = ["r|/dev/cdrom|", "r|/dev/drbd[0-9]+|" ] |
450 |
|
451 |
Note that with Ganeti a helper script is provided - ``lvmstrap`` which |
452 |
will erase and configure as LVM any not in-use disk on your system. This |
453 |
is dangerous and it's recommended to read its ``--help`` output if you |
454 |
want to use it. |
455 |
|
456 |
Installing Ganeti |
457 |
+++++++++++++++++ |
458 |
|
459 |
**Mandatory** on all nodes. |
460 |
|
461 |
It's now time to install the Ganeti software itself. Download the |
462 |
source from the project page at `<http://code.google.com/p/ganeti/>`_, |
463 |
and install it (replace 2.0.0 with the latest version):: |
464 |
|
465 |
tar xvzf ganeti-2.0.0.tar.gz |
466 |
cd ganeti-2.0.0 |
467 |
./configure --localstatedir=/var --sysconfdir=/etc |
468 |
make |
469 |
make install |
470 |
mkdir /srv/ganeti/ /srv/ganeti/os /srv/ganeti/export |
471 |
|
472 |
You also need to copy the file ``doc/examples/ganeti.initd`` from the |
473 |
source archive to ``/etc/init.d/ganeti`` and register it with your |
474 |
distribution's startup scripts, for example in Debian:: |
475 |
|
476 |
update-rc.d ganeti defaults 20 80 |
477 |
|
478 |
In order to automatically restart failed instances, you need to setup a |
479 |
cron job run the *ganeti-watcher* command. A sample cron file is |
480 |
provided in the source at ``doc/examples/ganeti.cron`` and you can copy |
481 |
that (eventually altering the path) to ``/etc/cron.d/ganeti``. |
482 |
|
483 |
What gets installed |
484 |
~~~~~~~~~~~~~~~~~~~ |
485 |
|
486 |
The above ``make install`` invocation, or installing via your |
487 |
distribution mechanisms, will install on the system: |
488 |
|
489 |
- a set of python libraries under the *ganeti* namespace (depending on |
490 |
the python version this can be located in either |
491 |
``lib/python-$ver/site-packages`` or various other locations) |
492 |
- a set of programs under ``/usr/local/sbin`` or ``/usr/sbin`` |
493 |
- man pages for the above programs |
494 |
- a set of tools under the ``lib/ganeti/tools`` directory |
495 |
- an example iallocator script (see the admin guide for details) under |
496 |
``lib/ganeti/iallocators`` |
497 |
- a cron job that is needed for cluster maintenance |
498 |
- an init script for automatic startup of Ganeti daemons |
499 |
- provided but not installed automatically by ``make install`` is a bash |
500 |
completion script that hopefully will ease working with the many |
501 |
cluster commands |
502 |
|
503 |
Installing the Operating System support packages |
504 |
++++++++++++++++++++++++++++++++++++++++++++++++ |
505 |
|
506 |
**Mandatory** on all nodes. |
507 |
|
508 |
To be able to install instances you need to have an Operating System |
509 |
installation script. An example OS that works under Debian and can |
510 |
install Debian and Ubuntu instace OSes is provided on the project web |
511 |
site. Download it from the project page and follow the instructions in |
512 |
the ``README`` file. Here is the installation procedure (replace 0.7 |
513 |
with the latest version that is compatible with your ganeti version):: |
514 |
|
515 |
cd /usr/local/src/ |
516 |
wget http://ganeti.googlecode.com/files/ganeti-instance-debootstrap-0.7.tar.gz |
517 |
tar xzf ganeti-instance-debootstrap-0.7.tar.gz |
518 |
cd ganeti-instance-debootstrap-0.7 |
519 |
./configure |
520 |
make |
521 |
make install |
522 |
|
523 |
In order to use this OS definition, you need to have internet access |
524 |
from your nodes and have the *debootstrap*, *dump* and *restore* |
525 |
commands installed on all nodes. Also, if the OS is configured to |
526 |
partition the instance's disk in |
527 |
``/etc/default/ganeti-instance-debootstrap``, you will need *kpartx* |
528 |
installed. |
529 |
|
530 |
.. admonition:: Debian |
531 |
|
532 |
Use this command on all nodes to install the required packages:: |
533 |
|
534 |
apt-get install debootstrap dump kpartx |
535 |
|
536 |
Alternatively, you can create your own OS definitions. See the manpage |
537 |
:manpage:`ganeti-os-interface`. |
538 |
|
539 |
Initializing the cluster |
540 |
++++++++++++++++++++++++ |
541 |
|
542 |
**Mandatory** once per cluster, on the first node. |
543 |
|
544 |
The last step is to initialize the cluster. After you have repeated the |
545 |
above process on all of your nodes, choose one as the master, and |
546 |
execute:: |
547 |
|
548 |
gnt-cluster init <CLUSTERNAME> |
549 |
|
550 |
The *CLUSTERNAME* is a hostname, which must be resolvable (e.g. it must |
551 |
exist in DNS or in ``/etc/hosts``) by all the nodes in the cluster. You |
552 |
must choose a name different from any of the nodes names for a |
553 |
multi-node cluster. In general the best choice is to have a unique name |
554 |
for a cluster, even if it consists of only one machine, as you will be |
555 |
able to expand it later without any problems. Please note that the |
556 |
hostname used for this must resolve to an IP address reserved |
557 |
**exclusively** for this purpose, and cannot be the name of the first |
558 |
(master) node. |
559 |
|
560 |
If you want to use a bridge which is not ``xen-br0``, or no bridge at |
561 |
all, use ``--nicparams``. |
562 |
|
563 |
If the bridge name you are using is not ``xen-br0``, use the *-b |
564 |
<BRIDGENAME>* option to specify the bridge name. In this case, you |
565 |
should also use the *--master-netdev <BRIDGENAME>* option with the same |
566 |
BRIDGENAME argument. |
567 |
|
568 |
You can use a different name than ``xenvg`` for the volume group (but |
569 |
note that the name must be identical on all nodes). In this case you |
570 |
need to specify it by passing the *-g <VGNAME>* option to ``gnt-cluster |
571 |
init``. |
572 |
|
573 |
To set up the cluster as an Xen HVM cluster, use the |
574 |
``--enabled-hypervisors=xen-hvm`` option to enable the HVM hypervisor |
575 |
(you can also add ``,xen-pvm`` to enable the PVM one too). You will also |
576 |
need to create the VNC cluster password file |
577 |
``/etc/ganeti/vnc-cluster-password`` which contains one line with the |
578 |
default VNC password for the cluster. |
579 |
|
580 |
To setup the cluster for KVM-only usage (KVM and Xen cannot be mixed), |
581 |
pass ``--enabled-hypervisors=kvm`` to the init command. |
582 |
|
583 |
You can also invoke the command with the ``--help`` option in order to |
584 |
see all the possibilities. |
585 |
|
586 |
Joining the nodes to the cluster |
587 |
++++++++++++++++++++++++++++++++ |
588 |
|
589 |
**Mandatory** for all the other nodes. |
590 |
|
591 |
After you have initialized your cluster you need to join the other nodes |
592 |
to it. You can do so by executing the following command on the master |
593 |
node:: |
594 |
|
595 |
gnt-node add <NODENAME> |
596 |
|
597 |
Separate replication network |
598 |
++++++++++++++++++++++++++++ |
599 |
|
600 |
**Optional** |
601 |
|
602 |
Ganeti uses DRBD to mirror the disk of the virtual instances between |
603 |
nodes. To use a dedicated network interface for this (in order to |
604 |
improve performance or to enhance security) you need to configure an |
605 |
additional interface for each node. Use the *-s* option with |
606 |
``gnt-cluster init`` and ``gnt-node add`` to specify the IP address of |
607 |
this secondary interface to use for each node. Note that if you |
608 |
specified this option at cluster setup time, you must afterwards use it |
609 |
for every node add operation. |
610 |
|
611 |
Testing the setup |
612 |
+++++++++++++++++ |
613 |
|
614 |
Execute the ``gnt-node list`` command to see all nodes in the cluster:: |
615 |
|
616 |
# gnt-node list |
617 |
Node DTotal DFree MTotal MNode MFree Pinst Sinst |
618 |
node1.example.com 197404 197404 2047 1896 125 0 0 |
619 |
|
620 |
The above shows a couple of things: |
621 |
|
622 |
- The various Ganeti daemons can talk to each other |
623 |
- Ganeti can examine the storage of the node (DTotal/DFree) |
624 |
- Ganeti can talk to the selected hypervisor (MTotal/MNode/MFree) |
625 |
|
626 |
Cluster burnin |
627 |
~~~~~~~~~~~~~~ |
628 |
|
629 |
With Ganeti a tool called :command:`burnin` is provided that can test |
630 |
most of the Ganeti functionality. The tool is installed under the |
631 |
``lib/ganeti/tools`` directory (either under ``/usr`` or ``/usr/local`` |
632 |
based on the installation method). See more details under |
633 |
:ref:`burnin-label`. |
634 |
|
635 |
Further steps |
636 |
------------- |
637 |
|
638 |
You can now proceed either to the :doc:`admin`, or read the manpages of |
639 |
the various commands (:manpage:`ganeti(7)`, :manpage:`gnt-cluster(8)`, |
640 |
:manpage:`gnt-node(8)`, :manpage:`gnt-instance(8)`, |
641 |
:manpage:`gnt-job(8)`). |
642 |
|
643 |
.. rubric:: Footnotes |
644 |
|
645 |
.. [#defkernel] The kernel and initrd paths can be changed at either |
646 |
cluster level (which changes the default for all instances) or at |
647 |
instance level. |
648 |
|
649 |
.. vim: set textwidth=72 : |
650 |
.. Local Variables: |
651 |
.. mode: rst |
652 |
.. fill-column: 72 |
653 |
.. End: |