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