root / doc / install.rst @ 0565f862
History | View | Annotate | Download (31.3 kB)
1 | 28e15341 | Iustin Pop | Ganeti installation tutorial |
---|---|---|---|
2 | 28e15341 | Iustin Pop | ============================ |
3 | 28e15341 | Iustin Pop | |
4 | fd07c6b3 | Iustin Pop | Documents Ganeti version |version| |
5 | 28e15341 | Iustin Pop | |
6 | 28e15341 | Iustin Pop | .. contents:: |
7 | 28e15341 | Iustin Pop | |
8 | f6d62af4 | Iustin Pop | .. highlight:: shell-example |
9 | c71a1a3d | Iustin Pop | |
10 | 28e15341 | Iustin Pop | Introduction |
11 | 28e15341 | Iustin Pop | ------------ |
12 | 28e15341 | Iustin Pop | |
13 | 28e15341 | Iustin Pop | Ganeti is a cluster virtualization management system based on Xen or |
14 | c71a1a3d | Iustin Pop | KVM. This document explains how to bootstrap a Ganeti node (Xen *dom0*, |
15 | c71a1a3d | Iustin Pop | the host Linux system for KVM), create a running cluster and install |
16 | c71a1a3d | Iustin Pop | virtual instances (Xen *domUs*, KVM guests). You need to repeat most of |
17 | c71a1a3d | Iustin Pop | the steps in this document for every node you want to install, but of |
18 | c71a1a3d | Iustin Pop | course we recommend creating some semi-automatic procedure if you plan |
19 | c71a1a3d | Iustin Pop | to deploy Ganeti on a medium/large scale. |
20 | 28e15341 | Iustin Pop | |
21 | 28e15341 | Iustin Pop | A basic Ganeti terminology glossary is provided in the introductory |
22 | c71a1a3d | Iustin Pop | section of the :doc:`admin`. Please refer to that document if you are |
23 | c71a1a3d | Iustin Pop | uncertain about the terms we are using. |
24 | 28e15341 | Iustin Pop | |
25 | c71a1a3d | Iustin Pop | Ganeti has been developed for Linux and should be distribution-agnostic. |
26 | f6d62af4 | Iustin Pop | This documentation will use Debian Squeeze as an example system but the |
27 | c71a1a3d | Iustin Pop | examples can be translated to any other distribution. You are expected |
28 | c71a1a3d | Iustin Pop | to be familiar with your distribution, its package management system, |
29 | c71a1a3d | Iustin Pop | and Xen or KVM before trying to use Ganeti. |
30 | 28e15341 | Iustin Pop | |
31 | 28e15341 | Iustin Pop | This document is divided into two main sections: |
32 | 28e15341 | Iustin Pop | |
33 | 28e15341 | Iustin Pop | - Installation of the base system and base components |
34 | 28e15341 | Iustin Pop | |
35 | 28e15341 | Iustin Pop | - Configuration of the environment for Ganeti |
36 | 28e15341 | Iustin Pop | |
37 | 28e15341 | Iustin Pop | Each of these is divided into sub-sections. While a full Ganeti system |
38 | c71a1a3d | Iustin Pop | will need all of the steps specified, some are not strictly required for |
39 | c71a1a3d | Iustin Pop | every environment. Which ones they are, and why, is specified in the |
40 | c71a1a3d | Iustin Pop | corresponding sections. |
41 | 28e15341 | Iustin Pop | |
42 | 28e15341 | Iustin Pop | Installing the base system and base components |
43 | 28e15341 | Iustin Pop | ---------------------------------------------- |
44 | 28e15341 | Iustin Pop | |
45 | 28e15341 | Iustin Pop | Hardware requirements |
46 | 28e15341 | Iustin Pop | +++++++++++++++++++++ |
47 | 28e15341 | Iustin Pop | |
48 | c71a1a3d | Iustin Pop | Any system supported by your Linux distribution is fine. 64-bit systems |
49 | c71a1a3d | Iustin Pop | are better as they can support more memory. |
50 | 28e15341 | Iustin Pop | |
51 | c71a1a3d | Iustin Pop | Any disk drive recognized by Linux (``IDE``/``SCSI``/``SATA``/etc.) is |
52 | c71a1a3d | Iustin Pop | supported in Ganeti. Note that no shared storage (e.g. ``SAN``) is |
53 | c71a1a3d | Iustin Pop | needed to get high-availability features (but of course, one can be used |
54 | f6d62af4 | Iustin Pop | to store the images). Whilte it is highly recommended to use more than |
55 | f6d62af4 | Iustin Pop | one disk drive in order to improve speed, Ganeti also works with one |
56 | f6d62af4 | Iustin Pop | disk per machine. |
57 | 28e15341 | Iustin Pop | |
58 | 28e15341 | Iustin Pop | Installing the base system |
59 | 28e15341 | Iustin Pop | ++++++++++++++++++++++++++ |
60 | 28e15341 | Iustin Pop | |
61 | 28e15341 | Iustin Pop | **Mandatory** on all nodes. |
62 | 28e15341 | Iustin Pop | |
63 | 28e15341 | Iustin Pop | It is advised to start with a clean, minimal install of the operating |
64 | c71a1a3d | Iustin Pop | system. The only requirement you need to be aware of at this stage is to |
65 | c71a1a3d | Iustin Pop | partition leaving enough space for a big (**minimum** 20GiB) LVM volume |
66 | c71a1a3d | Iustin Pop | group which will then host your instance filesystems, if you want to use |
67 | c71a1a3d | Iustin Pop | all Ganeti features. The volume group name Ganeti uses (by default) is |
68 | c71a1a3d | Iustin Pop | ``xenvg``. |
69 | 28e15341 | Iustin Pop | |
70 | c71a1a3d | Iustin Pop | You can also use file-based storage only, without LVM, but this setup is |
71 | c71a1a3d | Iustin Pop | not detailed in this document. |
72 | 28e15341 | Iustin Pop | |
73 | 7ed400f0 | Stratos Psomadakis | If you choose to use RBD-based instances, there's no need for LVM |
74 | f6d62af4 | Iustin Pop | provisioning. However, this feature is experimental, and is not yet |
75 | 7ed400f0 | Stratos Psomadakis | recommended for production clusters. |
76 | 7ed400f0 | Stratos Psomadakis | |
77 | 28e15341 | Iustin Pop | While you can use an existing system, please note that the Ganeti |
78 | 28e15341 | Iustin Pop | installation is intrusive in terms of changes to the system |
79 | 28e15341 | Iustin Pop | configuration, and it's best to use a newly-installed system without |
80 | 28e15341 | Iustin Pop | important data on it. |
81 | 28e15341 | Iustin Pop | |
82 | 28e15341 | Iustin Pop | Also, for best results, it's advised that the nodes have as much as |
83 | 28e15341 | Iustin Pop | possible the same hardware and software configuration. This will make |
84 | 28e15341 | Iustin Pop | administration much easier. |
85 | 28e15341 | Iustin Pop | |
86 | 28e15341 | Iustin Pop | Hostname issues |
87 | 28e15341 | Iustin Pop | ~~~~~~~~~~~~~~~ |
88 | 28e15341 | Iustin Pop | |
89 | 28e15341 | Iustin Pop | Note that Ganeti requires the hostnames of the systems (i.e. what the |
90 | 28e15341 | Iustin Pop | ``hostname`` command outputs to be a fully-qualified name, not a short |
91 | 28e15341 | Iustin Pop | name. In other words, you should use *node1.example.com* as a hostname |
92 | 28e15341 | Iustin Pop | and not just *node1*. |
93 | 28e15341 | Iustin Pop | |
94 | 28e15341 | Iustin Pop | .. admonition:: Debian |
95 | 28e15341 | Iustin Pop | |
96 | f6d62af4 | Iustin Pop | Debian usually configures the hostname differently than you need it |
97 | f6d62af4 | Iustin Pop | for Ganeti. For example, this is what it puts in ``/etc/hosts`` in |
98 | f6d62af4 | Iustin Pop | certain situations:: |
99 | 28e15341 | Iustin Pop | |
100 | 28e15341 | Iustin Pop | 127.0.0.1 localhost |
101 | 28e15341 | Iustin Pop | 127.0.1.1 node1.example.com node1 |
102 | 28e15341 | Iustin Pop | |
103 | 28e15341 | Iustin Pop | but for Ganeti you need to have:: |
104 | 28e15341 | Iustin Pop | |
105 | 28e15341 | Iustin Pop | 127.0.0.1 localhost |
106 | f6d62af4 | Iustin Pop | 192.0.2.1 node1.example.com node1 |
107 | 28e15341 | Iustin Pop | |
108 | 926feaf1 | Manuel Franceschini | replacing ``192.0.2.1`` with your node's address. Also, the file |
109 | 28e15341 | Iustin Pop | ``/etc/hostname`` which configures the hostname of the system |
110 | 28e15341 | Iustin Pop | should contain ``node1.example.com`` and not just ``node1`` (you |
111 | 28e15341 | Iustin Pop | need to run the command ``/etc/init.d/hostname.sh start`` after |
112 | 28e15341 | Iustin Pop | changing the file). |
113 | 28e15341 | Iustin Pop | |
114 | 1232284c | Guido Trotter | .. admonition:: Why a fully qualified host name |
115 | 1232284c | Guido Trotter | |
116 | 7faf5110 | Michael Hanselmann | Although most distributions use only the short name in the |
117 | 7faf5110 | Michael Hanselmann | /etc/hostname file, we still think Ganeti nodes should use the full |
118 | 7faf5110 | Michael Hanselmann | name. The reason for this is that calling 'hostname --fqdn' requires |
119 | 7faf5110 | Michael Hanselmann | the resolver library to work and is a 'guess' via heuristics at what |
120 | 7faf5110 | Michael Hanselmann | is your domain name. Since Ganeti can be used among other things to |
121 | 7faf5110 | Michael Hanselmann | host DNS servers, we don't want to depend on them as much as |
122 | 7faf5110 | Michael Hanselmann | possible, and we'd rather have the uname() syscall return the full |
123 | 7faf5110 | Michael Hanselmann | node name. |
124 | 7faf5110 | Michael Hanselmann | |
125 | 7faf5110 | Michael Hanselmann | We haven't ever found any breakage in using a full hostname on a |
126 | 7faf5110 | Michael Hanselmann | Linux system, and anyway we recommend to have only a minimal |
127 | 7faf5110 | Michael Hanselmann | installation on Ganeti nodes, and to use instances (or other |
128 | 7faf5110 | Michael Hanselmann | dedicated machines) to run the rest of your network services. By |
129 | 7faf5110 | Michael Hanselmann | doing this you can change the /etc/hostname file to contain an FQDN |
130 | 7faf5110 | Michael Hanselmann | without the fear of breaking anything unrelated. |
131 | 1232284c | Guido Trotter | |
132 | 1232284c | Guido Trotter | |
133 | 756d5ec3 | Guido Trotter | Installing The Hypervisor |
134 | 756d5ec3 | Guido Trotter | +++++++++++++++++++++++++ |
135 | 28e15341 | Iustin Pop | |
136 | 28e15341 | Iustin Pop | **Mandatory** on all nodes. |
137 | 28e15341 | Iustin Pop | |
138 | 756d5ec3 | Guido Trotter | While Ganeti is developed with the ability to modularly run on different |
139 | 7faf5110 | Michael Hanselmann | virtualization environments in mind the only two currently useable on a |
140 | f6d62af4 | Iustin Pop | live system are Xen and KVM. Supported Xen versions are: 3.0.3 and later |
141 | f6d62af4 | Iustin Pop | 3.x versions, and 4.x (tested up to 4.1). Supported KVM versions are 72 |
142 | f6d62af4 | Iustin Pop | and above. |
143 | 28e15341 | Iustin Pop | |
144 | c71a1a3d | Iustin Pop | Please follow your distribution's recommended way to install and set up |
145 | c71a1a3d | Iustin Pop | Xen, or install Xen from the upstream source, if you wish, following |
146 | c71a1a3d | Iustin Pop | their manual. For KVM, make sure you have a KVM-enabled kernel and the |
147 | c71a1a3d | Iustin Pop | KVM tools. |
148 | 28e15341 | Iustin Pop | |
149 | 756d5ec3 | Guido Trotter | After installing Xen, you need to reboot into your new system. On some |
150 | 7faf5110 | Michael Hanselmann | distributions this might involve configuring GRUB appropriately, whereas |
151 | 7faf5110 | Michael Hanselmann | others will configure it automatically when you install the respective |
152 | 7faf5110 | Michael Hanselmann | kernels. For KVM no reboot should be necessary. |
153 | 28e15341 | Iustin Pop | |
154 | 756d5ec3 | Guido Trotter | .. admonition:: Xen on Debian |
155 | 28e15341 | Iustin Pop | |
156 | f6d62af4 | Iustin Pop | Under Debian you can install the relevant ``xen-linux-system`` |
157 | c71a1a3d | Iustin Pop | package, which will pull in both the hypervisor and the relevant |
158 | f6d62af4 | Iustin Pop | kernel. Also, if you are installing a 32-bit system, you should |
159 | c71a1a3d | Iustin Pop | install the ``libc6-xen`` package (run ``apt-get install |
160 | c71a1a3d | Iustin Pop | libc6-xen``). |
161 | 28e15341 | Iustin Pop | |
162 | 28e15341 | Iustin Pop | Xen settings |
163 | 28e15341 | Iustin Pop | ~~~~~~~~~~~~ |
164 | 28e15341 | Iustin Pop | |
165 | 28e15341 | Iustin Pop | It's recommended that dom0 is restricted to a low amount of memory |
166 | c71a1a3d | Iustin Pop | (512MiB or 1GiB is reasonable) and that memory ballooning is disabled in |
167 | c71a1a3d | Iustin Pop | the file ``/etc/xen/xend-config.sxp`` by setting the value |
168 | c71a1a3d | Iustin Pop | ``dom0-min-mem`` to 0, like this:: |
169 | 28e15341 | Iustin Pop | |
170 | 28e15341 | Iustin Pop | (dom0-min-mem 0) |
171 | 28e15341 | Iustin Pop | |
172 | 28e15341 | Iustin Pop | For optimum performance when running both CPU and I/O intensive |
173 | c71a1a3d | Iustin Pop | instances, it's also recommended that the dom0 is restricted to one CPU |
174 | 216cb5af | Thomas Thrainer | only. For example you can add ``dom0_max_vcpus=1,dom0_vcpus_pin`` to your |
175 | 216cb5af | Thomas Thrainer | kernels boot command line and set ``dom0-cpus`` in |
176 | 216cb5af | Thomas Thrainer | ``/etc/xen/xend-config.sxp`` like this:: |
177 | 216cb5af | Thomas Thrainer | |
178 | 216cb5af | Thomas Thrainer | (dom0-cpus 1) |
179 | 28e15341 | Iustin Pop | |
180 | 28e15341 | Iustin Pop | It is recommended that you disable xen's automatic save of virtual |
181 | 28e15341 | Iustin Pop | machines at system shutdown and subsequent restore of them at reboot. |
182 | 28e15341 | Iustin Pop | To obtain this make sure the variable ``XENDOMAINS_SAVE`` in the file |
183 | 28e15341 | Iustin Pop | ``/etc/default/xendomains`` is set to an empty value. |
184 | 28e15341 | Iustin Pop | |
185 | aeaa2ea2 | Guido Trotter | If you want to use live migration make sure you have, in the xen config |
186 | aeaa2ea2 | Guido Trotter | file, something that allows the nodes to migrate instances between each |
187 | f6d62af4 | Iustin Pop | other. For example: |
188 | f6d62af4 | Iustin Pop | |
189 | f6d62af4 | Iustin Pop | .. code-block:: text |
190 | 8ab90d80 | Guido Trotter | |
191 | 8ab90d80 | Guido Trotter | (xend-relocation-server yes) |
192 | 8ab90d80 | Guido Trotter | (xend-relocation-port 8002) |
193 | 8ab90d80 | Guido Trotter | (xend-relocation-address '') |
194 | 926feaf1 | Manuel Franceschini | (xend-relocation-hosts-allow '^192\\.0\\.2\\.[0-9]+$') |
195 | 8ab90d80 | Guido Trotter | |
196 | e8a3bf18 | Iustin Pop | |
197 | 84d7362b | Andrea Spadaccini | The second line assumes that the hypervisor parameter |
198 | e8a3bf18 | Iustin Pop | ``migration_port`` is set 8002, otherwise modify it to match. The last |
199 | e8a3bf18 | Iustin Pop | line assumes that all your nodes have secondary IPs in the |
200 | 926feaf1 | Manuel Franceschini | 192.0.2.0/24 network, adjust it accordingly to your setup. |
201 | 8ab90d80 | Guido Trotter | |
202 | c71a1a3d | Iustin Pop | If you want to run HVM instances too with Ganeti and want VNC access to |
203 | c71a1a3d | Iustin Pop | the console of your instances, set the following two entries in |
204 | f6d62af4 | Iustin Pop | ``/etc/xen/xend-config.sxp``: |
205 | f6d62af4 | Iustin Pop | |
206 | f6d62af4 | Iustin Pop | .. code-block:: text |
207 | 28e15341 | Iustin Pop | |
208 | 28e15341 | Iustin Pop | (vnc-listen '0.0.0.0') (vncpasswd '') |
209 | 28e15341 | Iustin Pop | |
210 | 28e15341 | Iustin Pop | You need to restart the Xen daemon for these settings to take effect:: |
211 | 28e15341 | Iustin Pop | |
212 | f6d62af4 | Iustin Pop | $ /etc/init.d/xend restart |
213 | 28e15341 | Iustin Pop | |
214 | 28e15341 | Iustin Pop | Selecting the instance kernel |
215 | 28e15341 | Iustin Pop | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
216 | 28e15341 | Iustin Pop | |
217 | 28e15341 | Iustin Pop | After you have installed Xen, you need to tell Ganeti exactly what |
218 | c71a1a3d | Iustin Pop | kernel to use for the instances it will create. This is done by creating |
219 | f6d62af4 | Iustin Pop | a symlink from your actual kernel to ``/boot/vmlinuz-3-xenU``, and one |
220 | f6d62af4 | Iustin Pop | from your initrd to ``/boot/initrd-3-xenU`` [#defkernel]_. Note that |
221 | c71a1a3d | Iustin Pop | if you don't use an initrd for the domU kernel, you don't need to create |
222 | c71a1a3d | Iustin Pop | the initrd symlink. |
223 | 28e15341 | Iustin Pop | |
224 | 28e15341 | Iustin Pop | .. admonition:: Debian |
225 | 28e15341 | Iustin Pop | |
226 | 28e15341 | Iustin Pop | After installation of the ``xen-linux-system`` package, you need to |
227 | 28e15341 | Iustin Pop | run (replace the exact version number with the one you have):: |
228 | 28e15341 | Iustin Pop | |
229 | f6d62af4 | Iustin Pop | $ cd /boot |
230 | f6d62af4 | Iustin Pop | $ ln -s vmlinuz-%2.6.26-1%-xen-amd64 vmlinuz-3-xenU |
231 | f6d62af4 | Iustin Pop | $ ln -s initrd.img-%2.6.26-1%-xen-amd64 initrd-3-xenU |
232 | f6d62af4 | Iustin Pop | |
233 | f6d62af4 | Iustin Pop | By default, the initrd doesn't contain the Xen block drivers needed |
234 | f6d62af4 | Iustin Pop | to mount the root device, so it is recommended to update the initrd |
235 | f6d62af4 | Iustin Pop | by following these two steps: |
236 | f6d62af4 | Iustin Pop | |
237 | f6d62af4 | Iustin Pop | - edit ``/etc/initramfs-tools/modules`` and add ``xen_blkfront`` |
238 | f6d62af4 | Iustin Pop | - run ``update-initramfs -u`` |
239 | 28e15341 | Iustin Pop | |
240 | 28e15341 | Iustin Pop | Installing DRBD |
241 | 28e15341 | Iustin Pop | +++++++++++++++ |
242 | 28e15341 | Iustin Pop | |
243 | c71a1a3d | Iustin Pop | Recommended on all nodes: DRBD_ is required if you want to use the high |
244 | c71a1a3d | Iustin Pop | availability (HA) features of Ganeti, but optional if you don't require |
245 | c71a1a3d | Iustin Pop | them or only run Ganeti on single-node clusters. You can upgrade a |
246 | f6d62af4 | Iustin Pop | non-HA cluster to an HA one later, but you might need to convert all |
247 | f6d62af4 | Iustin Pop | your instances to DRBD to take advantage of the new features. |
248 | 28e15341 | Iustin Pop | |
249 | 28e15341 | Iustin Pop | .. _DRBD: http://www.drbd.org/ |
250 | 28e15341 | Iustin Pop | |
251 | f6d62af4 | Iustin Pop | Supported DRBD versions: 8.0-8.3. It's recommended to have at least |
252 | f6d62af4 | Iustin Pop | version 8.0.12. Note that for version 8.2 and newer it is needed to pass |
253 | f6d62af4 | Iustin Pop | the ``usermode_helper=/bin/true`` parameter to the module, either by |
254 | c71a1a3d | Iustin Pop | configuring ``/etc/modules`` or when inserting it manually. |
255 | 28e15341 | Iustin Pop | |
256 | 28e15341 | Iustin Pop | Now the bad news: unless your distribution already provides it |
257 | c71a1a3d | Iustin Pop | installing DRBD might involve recompiling your kernel or anyway fiddling |
258 | c71a1a3d | Iustin Pop | with it. Hopefully at least the Xen-ified kernel source to start from |
259 | c71a1a3d | Iustin Pop | will be provided (if you intend to use Xen). |
260 | 28e15341 | Iustin Pop | |
261 | 28e15341 | Iustin Pop | The good news is that you don't need to configure DRBD at all. Ganeti |
262 | c71a1a3d | Iustin Pop | will do it for you for every instance you set up. If you have the DRBD |
263 | c71a1a3d | Iustin Pop | utils installed and the module in your kernel you're fine. Please check |
264 | c71a1a3d | Iustin Pop | that your system is configured to load the module at every boot, and |
265 | c71a1a3d | Iustin Pop | that it passes the following option to the module: |
266 | c71a1a3d | Iustin Pop | ``minor_count=NUMBER``. We recommend that you use 128 as the value of |
267 | c71a1a3d | Iustin Pop | the minor_count - this will allow you to use up to 64 instances in total |
268 | c71a1a3d | Iustin Pop | per node (both primary and secondary, when using only one disk per |
269 | c71a1a3d | Iustin Pop | instance). You can increase the number up to 255 if you need more |
270 | c71a1a3d | Iustin Pop | instances on a node. |
271 | c71a1a3d | Iustin Pop | |
272 | 28e15341 | Iustin Pop | |
273 | 28e15341 | Iustin Pop | .. admonition:: Debian |
274 | 28e15341 | Iustin Pop | |
275 | c71a1a3d | Iustin Pop | On Debian, you can just install (build) the DRBD module with the |
276 | c71a1a3d | Iustin Pop | following commands, making sure you are running the target (Xen or |
277 | c71a1a3d | Iustin Pop | KVM) kernel:: |
278 | 28e15341 | Iustin Pop | |
279 | f6d62af4 | Iustin Pop | $ apt-get install drbd8-source drbd8-utils |
280 | f6d62af4 | Iustin Pop | $ m-a update |
281 | f6d62af4 | Iustin Pop | $ m-a a-i drbd8 |
282 | db0e97f0 | Guido Trotter | |
283 | db0e97f0 | Guido Trotter | Or on newer versions, if the kernel already has modules: |
284 | db0e97f0 | Guido Trotter | |
285 | db0e97f0 | Guido Trotter | $ apt-get install drbd8-utils |
286 | db0e97f0 | Guido Trotter | |
287 | db0e97f0 | Guido Trotter | Then to configure it for Ganeti:: |
288 | db0e97f0 | Guido Trotter | |
289 | f6d62af4 | Iustin Pop | $ echo drbd minor_count=128 usermode_helper=/bin/true >> /etc/modules |
290 | f6d62af4 | Iustin Pop | $ depmod -a |
291 | f6d62af4 | Iustin Pop | $ modprobe drbd minor_count=128 usermode_helper=/bin/true |
292 | 28e15341 | Iustin Pop | |
293 | 216cb5af | Thomas Thrainer | It is also recommended that you comment out the default resources (if any) |
294 | 216cb5af | Thomas Thrainer | in the ``/etc/drbd.conf`` file, so that the init script doesn't try to |
295 | c71a1a3d | Iustin Pop | configure any drbd devices. You can do this by prefixing all |
296 | f6d62af4 | Iustin Pop | *resource* lines in the file with the keyword *skip*, like this: |
297 | f6d62af4 | Iustin Pop | |
298 | f6d62af4 | Iustin Pop | .. code-block:: text |
299 | 28e15341 | Iustin Pop | |
300 | 92c1ea55 | Iustin Pop | skip { |
301 | 92c1ea55 | Iustin Pop | resource r0 { |
302 | 92c1ea55 | Iustin Pop | ... |
303 | 92c1ea55 | Iustin Pop | } |
304 | 28e15341 | Iustin Pop | } |
305 | 28e15341 | Iustin Pop | |
306 | 92c1ea55 | Iustin Pop | skip { |
307 | 92c1ea55 | Iustin Pop | resource "r1" { |
308 | 92c1ea55 | Iustin Pop | ... |
309 | 92c1ea55 | Iustin Pop | } |
310 | 28e15341 | Iustin Pop | } |
311 | 28e15341 | Iustin Pop | |
312 | 7ed400f0 | Stratos Psomadakis | Installing RBD |
313 | f6d62af4 | Iustin Pop | ++++++++++++++ |
314 | 7ed400f0 | Stratos Psomadakis | |
315 | 7ed400f0 | Stratos Psomadakis | Recommended on all nodes: RBD_ is required if you want to create |
316 | 7ed400f0 | Stratos Psomadakis | instances with RBD disks residing inside a RADOS cluster (make use of |
317 | 7ed400f0 | Stratos Psomadakis | the rbd disk template). RBD-based instances can failover or migrate to |
318 | 7ed400f0 | Stratos Psomadakis | any other node in the ganeti cluster, enabling you to exploit of all |
319 | 7ed400f0 | Stratos Psomadakis | Ganeti's high availabilily (HA) features. |
320 | 7ed400f0 | Stratos Psomadakis | |
321 | 7ed400f0 | Stratos Psomadakis | .. attention:: |
322 | 7ed400f0 | Stratos Psomadakis | Be careful though: rbd is still experimental! For now it is |
323 | 7ed400f0 | Stratos Psomadakis | recommended only for testing purposes. No sensitive data should be |
324 | 7ed400f0 | Stratos Psomadakis | stored there. |
325 | 7ed400f0 | Stratos Psomadakis | |
326 | 7ed400f0 | Stratos Psomadakis | .. _RBD: http://ceph.newdream.net/ |
327 | 7ed400f0 | Stratos Psomadakis | |
328 | 7ed400f0 | Stratos Psomadakis | You will need the ``rbd`` and ``libceph`` kernel modules, the RBD/Ceph |
329 | 7ed400f0 | Stratos Psomadakis | userspace utils (ceph-common Debian package) and an appropriate |
330 | 7ed400f0 | Stratos Psomadakis | Ceph/RADOS configuration file on every VM-capable node. |
331 | 7ed400f0 | Stratos Psomadakis | |
332 | 7ed400f0 | Stratos Psomadakis | You will also need a working RADOS Cluster accessible by the above |
333 | 7ed400f0 | Stratos Psomadakis | nodes. |
334 | 7ed400f0 | Stratos Psomadakis | |
335 | 7ed400f0 | Stratos Psomadakis | RADOS Cluster |
336 | 7ed400f0 | Stratos Psomadakis | ~~~~~~~~~~~~~ |
337 | 7ed400f0 | Stratos Psomadakis | |
338 | 7ed400f0 | Stratos Psomadakis | You will need a working RADOS Cluster accesible by all VM-capable nodes |
339 | 7ed400f0 | Stratos Psomadakis | to use the RBD template. For more information on setting up a RADOS |
340 | 7ed400f0 | Stratos Psomadakis | Cluster, refer to the `official docs <http://ceph.newdream.net/>`_. |
341 | 7ed400f0 | Stratos Psomadakis | |
342 | 7ed400f0 | Stratos Psomadakis | If you want to use a pool for storing RBD disk images other than the |
343 | 7ed400f0 | Stratos Psomadakis | default (``rbd``), you should first create the pool in the RADOS |
344 | 7ed400f0 | Stratos Psomadakis | Cluster, and then set the corresponding rbd disk parameter named |
345 | 7ed400f0 | Stratos Psomadakis | ``pool``. |
346 | 7ed400f0 | Stratos Psomadakis | |
347 | 7ed400f0 | Stratos Psomadakis | Kernel Modules |
348 | 7ed400f0 | Stratos Psomadakis | ~~~~~~~~~~~~~~ |
349 | 7ed400f0 | Stratos Psomadakis | |
350 | 7ed400f0 | Stratos Psomadakis | Unless your distribution already provides it, you might need to compile |
351 | 7ed400f0 | Stratos Psomadakis | the ``rbd`` and ``libceph`` modules from source. You will need Linux |
352 | 7ed400f0 | Stratos Psomadakis | Kernel 3.2 or above for the kernel modules. Alternatively you will have |
353 | 7ed400f0 | Stratos Psomadakis | to build them as external modules (from Linux Kernel source 3.2 or |
354 | 7ed400f0 | Stratos Psomadakis | above), if you want to run a less recent kernel, or your kernel doesn't |
355 | 7ed400f0 | Stratos Psomadakis | include them. |
356 | 7ed400f0 | Stratos Psomadakis | |
357 | 7ed400f0 | Stratos Psomadakis | Userspace Utils |
358 | 7ed400f0 | Stratos Psomadakis | ~~~~~~~~~~~~~~~ |
359 | 7ed400f0 | Stratos Psomadakis | |
360 | 7ed400f0 | Stratos Psomadakis | The RBD template has been tested with ``ceph-common`` v0.38 and |
361 | 7ed400f0 | Stratos Psomadakis | above. We recommend using the latest version of ``ceph-common``. |
362 | 7ed400f0 | Stratos Psomadakis | |
363 | 7ed400f0 | Stratos Psomadakis | .. admonition:: Debian |
364 | 7ed400f0 | Stratos Psomadakis | |
365 | 7ed400f0 | Stratos Psomadakis | On Debian, you can just install the RBD/Ceph userspace utils with |
366 | 7ed400f0 | Stratos Psomadakis | the following command:: |
367 | 7ed400f0 | Stratos Psomadakis | |
368 | f6d62af4 | Iustin Pop | $ apt-get install ceph-common |
369 | 7ed400f0 | Stratos Psomadakis | |
370 | cbb533f4 | Raffa Santi | KVM userspace access |
371 | cbb533f4 | Raffa Santi | ~~~~~~~~~~~~~~~~~~~~ |
372 | cbb533f4 | Raffa Santi | |
373 | cbb533f4 | Raffa Santi | If your cluster uses a sufficiently new version of KVM (you will need at |
374 | cbb533f4 | Raffa Santi | least QEMU 0.14 with RBD support compiled in), you can take advantage of |
375 | cbb533f4 | Raffa Santi | KVM's native support for ceph in order to have better performance and |
376 | cbb533f4 | Raffa Santi | avoid potential deadlocks_ in low memory scenarios. |
377 | cbb533f4 | Raffa Santi | |
378 | cbb533f4 | Raffa Santi | .. _deadlocks: http://tracker.ceph.com/issues/3076 |
379 | cbb533f4 | Raffa Santi | |
380 | cbb533f4 | Raffa Santi | To initialize a cluster with support for this feature, use a command |
381 | cbb533f4 | Raffa Santi | such as:: |
382 | cbb533f4 | Raffa Santi | |
383 | cbb533f4 | Raffa Santi | $ gnt-cluster init \ |
384 | cbb533f4 | Raffa Santi | --enabled-disk-templates rbd \ |
385 | cbb533f4 | Raffa Santi | --ipolicy-disk-templates rbd \ |
386 | cbb533f4 | Raffa Santi | --enabled-hypervisors=kvm \ |
387 | cbb533f4 | Raffa Santi | -D rbd:access=userspace |
388 | cbb533f4 | Raffa Santi | |
389 | cbb533f4 | Raffa Santi | (You may want to enable more templates than just ``rbd``.) |
390 | cbb533f4 | Raffa Santi | |
391 | cbb533f4 | Raffa Santi | You can also change this setting on a live cluster by giving the same |
392 | cbb533f4 | Raffa Santi | switches to ``gnt-cluster modify``, or change those settings at the node |
393 | cbb533f4 | Raffa Santi | group level with ``gnt-group modify``. |
394 | cbb533f4 | Raffa Santi | |
395 | 7ed400f0 | Stratos Psomadakis | Configuration file |
396 | 7ed400f0 | Stratos Psomadakis | ~~~~~~~~~~~~~~~~~~ |
397 | 7ed400f0 | Stratos Psomadakis | |
398 | 7ed400f0 | Stratos Psomadakis | You should also provide an appropriate configuration file |
399 | 7ed400f0 | Stratos Psomadakis | (``ceph.conf``) in ``/etc/ceph``. For the rbd userspace utils, you'll |
400 | 7ed400f0 | Stratos Psomadakis | only need to specify the IP addresses of the RADOS Cluster monitors. |
401 | 7ed400f0 | Stratos Psomadakis | |
402 | 7ed400f0 | Stratos Psomadakis | .. admonition:: ceph.conf |
403 | 7ed400f0 | Stratos Psomadakis | |
404 | f6d62af4 | Iustin Pop | Sample configuration file: |
405 | f6d62af4 | Iustin Pop | |
406 | f6d62af4 | Iustin Pop | .. code-block:: text |
407 | 7ed400f0 | Stratos Psomadakis | |
408 | 7ed400f0 | Stratos Psomadakis | [mon.a] |
409 | 7ed400f0 | Stratos Psomadakis | host = example_monitor_host1 |
410 | 7ed400f0 | Stratos Psomadakis | mon addr = 1.2.3.4:6789 |
411 | 7ed400f0 | Stratos Psomadakis | [mon.b] |
412 | 7ed400f0 | Stratos Psomadakis | host = example_monitor_host2 |
413 | 7ed400f0 | Stratos Psomadakis | mon addr = 1.2.3.5:6789 |
414 | 7ed400f0 | Stratos Psomadakis | [mon.c] |
415 | 7ed400f0 | Stratos Psomadakis | host = example_monitor_host3 |
416 | 7ed400f0 | Stratos Psomadakis | mon addr = 1.2.3.6:6789 |
417 | 7ed400f0 | Stratos Psomadakis | |
418 | 7ed400f0 | Stratos Psomadakis | For more information, please see the `Ceph Docs |
419 | 7ed400f0 | Stratos Psomadakis | <http://ceph.newdream.net/docs/latest/>`_ |
420 | 7ed400f0 | Stratos Psomadakis | |
421 | 6488e5bc | Santi Raffa | Installing Gluster |
422 | 6488e5bc | Santi Raffa | ++++++++++++++++++ |
423 | 6488e5bc | Santi Raffa | |
424 | 6488e5bc | Santi Raffa | For Gluster integration, Ganeti requires that ``mount.glusterfs`` is |
425 | 6488e5bc | Santi Raffa | installed on each and every node. On Debian Wheezy and newer, you can |
426 | 6488e5bc | Santi Raffa | satisfy this requirement with the ``glusterfs-client`` package; see |
427 | 6488e5bc | Santi Raffa | `this guide |
428 | 6488e5bc | Santi Raffa | <http://gluster.org/community/documentation/index.php/Gluster_3.2:_Installing_the_Gluster_Native_Client>`_ |
429 | 6488e5bc | Santi Raffa | for details. |
430 | 6488e5bc | Santi Raffa | |
431 | 6488e5bc | Santi Raffa | KVM userspace access |
432 | 6488e5bc | Santi Raffa | ~~~~~~~~~~~~~~~~~~~~ |
433 | 6488e5bc | Santi Raffa | |
434 | 6488e5bc | Santi Raffa | If your cluster uses a sufficiently new version of KVM (you will need at |
435 | 6488e5bc | Santi Raffa | least QEMU 1.3 with Gluster support compiled in), you can take advantage |
436 | 6488e5bc | Santi Raffa | of KVM's native support for gluster in order to have better performance |
437 | 6488e5bc | Santi Raffa | and avoid potential deadlocks in low memory scenarios. |
438 | 6488e5bc | Santi Raffa | |
439 | 6488e5bc | Santi Raffa | Please be aware that QEMU 1.3 was released in December 3, 2012, and as |
440 | 6488e5bc | Santi Raffa | such this feature is not available out of the box in any distribution |
441 | 6488e5bc | Santi Raffa | older than Ubuntu 13.04; this excludes Ubuntu 12.04 LTS and Debian |
442 | 6488e5bc | Santi Raffa | Wheezy. |
443 | 6488e5bc | Santi Raffa | |
444 | 28e15341 | Iustin Pop | Other required software |
445 | 28e15341 | Iustin Pop | +++++++++++++++++++++++ |
446 | 28e15341 | Iustin Pop | |
447 | 216cb5af | Thomas Thrainer | Please install all software requirements mentioned in :doc:`install-quick`. |
448 | 216cb5af | Thomas Thrainer | If you want to build Ganeti from source, don't forget to follow the steps |
449 | 216cb5af | Thomas Thrainer | required for that as well. |
450 | 28e15341 | Iustin Pop | |
451 | 28e15341 | Iustin Pop | Setting up the environment for Ganeti |
452 | 28e15341 | Iustin Pop | ------------------------------------- |
453 | 28e15341 | Iustin Pop | |
454 | 28e15341 | Iustin Pop | Configuring the network |
455 | 28e15341 | Iustin Pop | +++++++++++++++++++++++ |
456 | 28e15341 | Iustin Pop | |
457 | 28e15341 | Iustin Pop | **Mandatory** on all nodes. |
458 | 28e15341 | Iustin Pop | |
459 | 57fb6fcb | Guido Trotter | You can run Ganeti either in "bridged mode", "routed mode" or |
460 | 57fb6fcb | Guido Trotter | "openvswitch mode". In bridged mode, the default, the instances network |
461 | 57fb6fcb | Guido Trotter | interfaces will be attached to a software bridge running in dom0. Xen by |
462 | 57fb6fcb | Guido Trotter | default creates such a bridge at startup, but your distribution might |
463 | 57fb6fcb | Guido Trotter | have a different way to do things, and you'll definitely need to |
464 | 57fb6fcb | Guido Trotter | manually set it up under KVM. |
465 | 28e15341 | Iustin Pop | |
466 | c71a1a3d | Iustin Pop | Beware that the default name Ganeti uses is ``xen-br0`` (which was used |
467 | e721c742 | Guido Trotter | in Xen 2.0) while Xen 3.0 uses ``xenbr0`` by default. See the |
468 | e721c742 | Guido Trotter | `Initializing the cluster`_ section to learn how to choose a different |
469 | e721c742 | Guido Trotter | bridge, or not to use one at all and use "routed mode". |
470 | 28e15341 | Iustin Pop | |
471 | e721c742 | Guido Trotter | In order to use "routed mode" under Xen, you'll need to change the |
472 | 7faf5110 | Michael Hanselmann | relevant parameters in the Xen config file. Under KVM instead, no config |
473 | 7faf5110 | Michael Hanselmann | change is necessary, but you still need to set up your network |
474 | 7faf5110 | Michael Hanselmann | interfaces correctly. |
475 | 9f83899a | Guido Trotter | |
476 | 9f83899a | Guido Trotter | By default, under KVM, the "link" parameter you specify per-nic will |
477 | 7faf5110 | Michael Hanselmann | represent, if non-empty, a different routing table name or number to use |
478 | f6d62af4 | Iustin Pop | for your instances. This allows isolation between different instance |
479 | 7faf5110 | Michael Hanselmann | groups, and different routing policies between node traffic and instance |
480 | 7faf5110 | Michael Hanselmann | traffic. |
481 | 9f83899a | Guido Trotter | |
482 | 7faf5110 | Michael Hanselmann | You will need to configure your routing table basic routes and rules |
483 | 7faf5110 | Michael Hanselmann | outside of ganeti. The vif scripts will only add /32 routes to your |
484 | 7faf5110 | Michael Hanselmann | instances, through their interface, in the table you specified (under |
485 | 7faf5110 | Michael Hanselmann | KVM, and in the main table under Xen). |
486 | 9f83899a | Guido Trotter | |
487 | 57fb6fcb | Guido Trotter | Also for "openvswitch mode" under Xen a custom network script is needed. |
488 | 57fb6fcb | Guido Trotter | Under KVM everything should work, but you'll need to configure your |
489 | 57fb6fcb | Guido Trotter | switches outside of Ganeti (as for bridges). |
490 | 57fb6fcb | Guido Trotter | |
491 | 12f9d75e | Iustin Pop | .. admonition:: Bridging issues with certain kernels |
492 | 12f9d75e | Iustin Pop | |
493 | 12f9d75e | Iustin Pop | Some kernel versions (e.g. 2.6.32) have an issue where the bridge |
494 | 12f9d75e | Iustin Pop | will automatically change its ``MAC`` address to the lower-numbered |
495 | 12f9d75e | Iustin Pop | slave on port addition and removal. This means that, depending on |
496 | 12f9d75e | Iustin Pop | the ``MAC`` address of the actual NIC on the node and the addresses |
497 | 12f9d75e | Iustin Pop | of the instances, it could be that starting, stopping or migrating |
498 | 12f9d75e | Iustin Pop | instances will lead to timeouts due to the address of the bridge |
499 | 12f9d75e | Iustin Pop | (and thus node itself) changing. |
500 | 12f9d75e | Iustin Pop | |
501 | 12f9d75e | Iustin Pop | To prevent this, it's enough to set the bridge manually to a |
502 | 12f9d75e | Iustin Pop | specific ``MAC`` address, which will disable this automatic address |
503 | 12f9d75e | Iustin Pop | change. In Debian, this can be done as follows in the bridge |
504 | 12f9d75e | Iustin Pop | configuration snippet:: |
505 | 12f9d75e | Iustin Pop | |
506 | 12f9d75e | Iustin Pop | up ip link set addr $(cat /sys/class/net/$IFACE/address) dev $IFACE |
507 | 12f9d75e | Iustin Pop | |
508 | 12f9d75e | Iustin Pop | which will "set" the bridge address to the initial one, disallowing |
509 | 12f9d75e | Iustin Pop | changes. |
510 | 12f9d75e | Iustin Pop | |
511 | 9f83899a | Guido Trotter | .. admonition:: Bridging under Debian |
512 | 28e15341 | Iustin Pop | |
513 | 28e15341 | Iustin Pop | The recommended way to configure the Xen bridge is to edit your |
514 | 28e15341 | Iustin Pop | ``/etc/network/interfaces`` file and substitute your normal |
515 | 28e15341 | Iustin Pop | Ethernet stanza with the following snippet:: |
516 | 28e15341 | Iustin Pop | |
517 | 28e15341 | Iustin Pop | auto xen-br0 |
518 | 28e15341 | Iustin Pop | iface xen-br0 inet static |
519 | f6d62af4 | Iustin Pop | address %YOUR_IP_ADDRESS% |
520 | f6d62af4 | Iustin Pop | netmask %YOUR_NETMASK% |
521 | f6d62af4 | Iustin Pop | network %YOUR_NETWORK% |
522 | f6d62af4 | Iustin Pop | broadcast %YOUR_BROADCAST_ADDRESS% |
523 | f6d62af4 | Iustin Pop | gateway %YOUR_GATEWAY% |
524 | 28e15341 | Iustin Pop | bridge_ports eth0 |
525 | 28e15341 | Iustin Pop | bridge_stp off |
526 | 28e15341 | Iustin Pop | bridge_fd 0 |
527 | 12f9d75e | Iustin Pop | # example for setting manually the bridge address to the eth0 NIC |
528 | 12f9d75e | Iustin Pop | up ip link set addr $(cat /sys/class/net/eth0/address) dev $IFACE |
529 | 28e15341 | Iustin Pop | |
530 | f6d62af4 | Iustin Pop | The following commands need to be executed on the local console:: |
531 | 28e15341 | Iustin Pop | |
532 | f6d62af4 | Iustin Pop | $ ifdown eth0 |
533 | f6d62af4 | Iustin Pop | $ ifup xen-br0 |
534 | 28e15341 | Iustin Pop | |
535 | 28e15341 | Iustin Pop | To check if the bridge is setup, use the ``ip`` and ``brctl show`` |
536 | 28e15341 | Iustin Pop | commands:: |
537 | 28e15341 | Iustin Pop | |
538 | f6d62af4 | Iustin Pop | $ ip a show xen-br0 |
539 | 28e15341 | Iustin Pop | 9: xen-br0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc noqueue |
540 | 28e15341 | Iustin Pop | link/ether 00:20:fc:1e:d5:5d brd ff:ff:ff:ff:ff:ff |
541 | 28e15341 | Iustin Pop | inet 10.1.1.200/24 brd 10.1.1.255 scope global xen-br0 |
542 | 28e15341 | Iustin Pop | inet6 fe80::220:fcff:fe1e:d55d/64 scope link |
543 | 28e15341 | Iustin Pop | valid_lft forever preferred_lft forever |
544 | 28e15341 | Iustin Pop | |
545 | f6d62af4 | Iustin Pop | $ brctl show xen-br0 |
546 | 28e15341 | Iustin Pop | bridge name bridge id STP enabled interfaces |
547 | 28e15341 | Iustin Pop | xen-br0 8000.0020fc1ed55d no eth0 |
548 | 28e15341 | Iustin Pop | |
549 | a4669456 | Dimitris Aragiorgis | In order to have a custom and more advanced networking configuration in Xen |
550 | a4669456 | Dimitris Aragiorgis | which can vary among instances, after having successfully installed Ganeti |
551 | a4669456 | Dimitris Aragiorgis | you have to create a symbolic link to the vif-script provided by Ganeti |
552 | a4669456 | Dimitris Aragiorgis | inside /etc/xen/scripts (assuming you installed Ganeti under /usr/lib):: |
553 | a4669456 | Dimitris Aragiorgis | |
554 | a4669456 | Dimitris Aragiorgis | $ ln -s /usr/lib/ganeti/vif-ganeti /etc/xen/scripts/vif-ganeti |
555 | a4669456 | Dimitris Aragiorgis | |
556 | a4669456 | Dimitris Aragiorgis | This has to be done on all nodes. Afterwards you can set the ``vif_script`` |
557 | a4669456 | Dimitris Aragiorgis | hypervisor parameter to point to that script by:: |
558 | a4669456 | Dimitris Aragiorgis | |
559 | a4669456 | Dimitris Aragiorgis | $ gnt-cluster modify -H xen-pvm:vif_script=/etc/xen/scripts/vif-ganeti |
560 | a4669456 | Dimitris Aragiorgis | |
561 | a4669456 | Dimitris Aragiorgis | Having this hypervisor parameter you are able to create your own scripts |
562 | a4669456 | Dimitris Aragiorgis | and create instances with different networking configurations. |
563 | a4669456 | Dimitris Aragiorgis | |
564 | c71a1a3d | Iustin Pop | .. _configure-lvm-label: |
565 | c71a1a3d | Iustin Pop | |
566 | 28e15341 | Iustin Pop | Configuring LVM |
567 | 28e15341 | Iustin Pop | +++++++++++++++ |
568 | 28e15341 | Iustin Pop | |
569 | 28e15341 | Iustin Pop | **Mandatory** on all nodes. |
570 | 28e15341 | Iustin Pop | |
571 | 28e15341 | Iustin Pop | The volume group is required to be at least 20GiB. |
572 | 28e15341 | Iustin Pop | |
573 | c71a1a3d | Iustin Pop | If you haven't configured your LVM volume group at install time you need |
574 | c71a1a3d | Iustin Pop | to do it before trying to initialize the Ganeti cluster. This is done by |
575 | c71a1a3d | Iustin Pop | formatting the devices/partitions you want to use for it and then adding |
576 | c71a1a3d | Iustin Pop | them to the relevant volume group:: |
577 | 28e15341 | Iustin Pop | |
578 | f6d62af4 | Iustin Pop | $ pvcreate /dev/%sda3% |
579 | f6d62af4 | Iustin Pop | $ vgcreate xenvg /dev/%sda3% |
580 | 28e15341 | Iustin Pop | |
581 | 28e15341 | Iustin Pop | or:: |
582 | 28e15341 | Iustin Pop | |
583 | f6d62af4 | Iustin Pop | $ pvcreate /dev/%sdb1% |
584 | f6d62af4 | Iustin Pop | $ pvcreate /dev/%sdc1% |
585 | f6d62af4 | Iustin Pop | $ vgcreate xenvg /dev/%sdb1% /dev/%sdc1% |
586 | 28e15341 | Iustin Pop | |
587 | 28e15341 | Iustin Pop | If you want to add a device later you can do so with the *vgextend* |
588 | 28e15341 | Iustin Pop | command:: |
589 | 28e15341 | Iustin Pop | |
590 | f6d62af4 | Iustin Pop | $ pvcreate /dev/%sdd1% |
591 | f6d62af4 | Iustin Pop | $ vgextend xenvg /dev/%sdd1% |
592 | 28e15341 | Iustin Pop | |
593 | 28e15341 | Iustin Pop | Optional: it is recommended to configure LVM not to scan the DRBD |
594 | 28e15341 | Iustin Pop | devices for physical volumes. This can be accomplished by editing |
595 | c71a1a3d | Iustin Pop | ``/etc/lvm/lvm.conf`` and adding the ``/dev/drbd[0-9]+`` regular |
596 | f6d62af4 | Iustin Pop | expression to the ``filter`` variable, like this: |
597 | f6d62af4 | Iustin Pop | |
598 | f6d62af4 | Iustin Pop | .. code-block:: text |
599 | 28e15341 | Iustin Pop | |
600 | 28e15341 | Iustin Pop | filter = ["r|/dev/cdrom|", "r|/dev/drbd[0-9]+|" ] |
601 | 28e15341 | Iustin Pop | |
602 | c71a1a3d | Iustin Pop | Note that with Ganeti a helper script is provided - ``lvmstrap`` which |
603 | c71a1a3d | Iustin Pop | will erase and configure as LVM any not in-use disk on your system. This |
604 | c71a1a3d | Iustin Pop | is dangerous and it's recommended to read its ``--help`` output if you |
605 | c71a1a3d | Iustin Pop | want to use it. |
606 | c71a1a3d | Iustin Pop | |
607 | 28e15341 | Iustin Pop | Installing Ganeti |
608 | 28e15341 | Iustin Pop | +++++++++++++++++ |
609 | 28e15341 | Iustin Pop | |
610 | 28e15341 | Iustin Pop | **Mandatory** on all nodes. |
611 | 28e15341 | Iustin Pop | |
612 | 28e15341 | Iustin Pop | It's now time to install the Ganeti software itself. Download the |
613 | 28e15341 | Iustin Pop | source from the project page at `<http://code.google.com/p/ganeti/>`_, |
614 | f6d62af4 | Iustin Pop | and install it (replace 2.6.0 with the latest version):: |
615 | 28e15341 | Iustin Pop | |
616 | f6d62af4 | Iustin Pop | $ tar xvzf ganeti-%2.6.0%.tar.gz |
617 | f6d62af4 | Iustin Pop | $ cd ganeti-%2.6.0% |
618 | f6d62af4 | Iustin Pop | $ ./configure --localstatedir=/var --sysconfdir=/etc |
619 | f6d62af4 | Iustin Pop | $ make |
620 | f6d62af4 | Iustin Pop | $ make install |
621 | f6d62af4 | Iustin Pop | $ mkdir /srv/ganeti/ /srv/ganeti/os /srv/ganeti/export |
622 | 28e15341 | Iustin Pop | |
623 | c71a1a3d | Iustin Pop | You also need to copy the file ``doc/examples/ganeti.initd`` from the |
624 | c71a1a3d | Iustin Pop | source archive to ``/etc/init.d/ganeti`` and register it with your |
625 | 28e15341 | Iustin Pop | distribution's startup scripts, for example in Debian:: |
626 | 28e15341 | Iustin Pop | |
627 | 0da22bc3 | Sebastian Gebhard | $ chmod +x /etc/init.d/ganeti |
628 | f6d62af4 | Iustin Pop | $ update-rc.d ganeti defaults 20 80 |
629 | 28e15341 | Iustin Pop | |
630 | c71a1a3d | Iustin Pop | In order to automatically restart failed instances, you need to setup a |
631 | c71a1a3d | Iustin Pop | cron job run the *ganeti-watcher* command. A sample cron file is |
632 | c71a1a3d | Iustin Pop | provided in the source at ``doc/examples/ganeti.cron`` and you can copy |
633 | e48c3613 | Apollon Oikonomopoulos | that (eventually altering the path) to ``/etc/cron.d/ganeti``. Finally, |
634 | e48c3613 | Apollon Oikonomopoulos | a sample logrotate snippet is provided in the source at |
635 | e48c3613 | Apollon Oikonomopoulos | ``doc/examples/ganeti.logrotate`` and you can copy it to |
636 | e48c3613 | Apollon Oikonomopoulos | ``/etc/logrotate.d/ganeti`` to have Ganeti's logs rotated automatically. |
637 | c71a1a3d | Iustin Pop | |
638 | c71a1a3d | Iustin Pop | What gets installed |
639 | c71a1a3d | Iustin Pop | ~~~~~~~~~~~~~~~~~~~ |
640 | c71a1a3d | Iustin Pop | |
641 | c71a1a3d | Iustin Pop | The above ``make install`` invocation, or installing via your |
642 | c71a1a3d | Iustin Pop | distribution mechanisms, will install on the system: |
643 | c71a1a3d | Iustin Pop | |
644 | c71a1a3d | Iustin Pop | - a set of python libraries under the *ganeti* namespace (depending on |
645 | c71a1a3d | Iustin Pop | the python version this can be located in either |
646 | c71a1a3d | Iustin Pop | ``lib/python-$ver/site-packages`` or various other locations) |
647 | c71a1a3d | Iustin Pop | - a set of programs under ``/usr/local/sbin`` or ``/usr/sbin`` |
648 | e58c4f2c | Michele Tartara | - if the htools component was enabled, a set of programs under |
649 | f6d62af4 | Iustin Pop | ``/usr/local/bin`` or ``/usr/bin/`` |
650 | c71a1a3d | Iustin Pop | - man pages for the above programs |
651 | c71a1a3d | Iustin Pop | - a set of tools under the ``lib/ganeti/tools`` directory |
652 | c71a1a3d | Iustin Pop | - an example iallocator script (see the admin guide for details) under |
653 | c71a1a3d | Iustin Pop | ``lib/ganeti/iallocators`` |
654 | c71a1a3d | Iustin Pop | - a cron job that is needed for cluster maintenance |
655 | c71a1a3d | Iustin Pop | - an init script for automatic startup of Ganeti daemons |
656 | c71a1a3d | Iustin Pop | - provided but not installed automatically by ``make install`` is a bash |
657 | c71a1a3d | Iustin Pop | completion script that hopefully will ease working with the many |
658 | c71a1a3d | Iustin Pop | cluster commands |
659 | 28e15341 | Iustin Pop | |
660 | 28e15341 | Iustin Pop | Installing the Operating System support packages |
661 | 28e15341 | Iustin Pop | ++++++++++++++++++++++++++++++++++++++++++++++++ |
662 | 28e15341 | Iustin Pop | |
663 | 28e15341 | Iustin Pop | **Mandatory** on all nodes. |
664 | 28e15341 | Iustin Pop | |
665 | 28e15341 | Iustin Pop | To be able to install instances you need to have an Operating System |
666 | 28e15341 | Iustin Pop | installation script. An example OS that works under Debian and can |
667 | 28e15341 | Iustin Pop | install Debian and Ubuntu instace OSes is provided on the project web |
668 | c71a1a3d | Iustin Pop | site. Download it from the project page and follow the instructions in |
669 | 4f6b32ca | Petr Pudlak | the ``README`` file. Here is the installation procedure (replace 0.14 |
670 | c71a1a3d | Iustin Pop | with the latest version that is compatible with your ganeti version):: |
671 | 28e15341 | Iustin Pop | |
672 | f6d62af4 | Iustin Pop | $ cd /usr/local/src/ |
673 | 4f6b32ca | Petr Pudlak | $ wget http://ganeti.googlecode.com/files/ganeti-instance-debootstrap-%0.14%.tar.gz |
674 | 4f6b32ca | Petr Pudlak | $ tar xzf ganeti-instance-debootstrap-%0.14%.tar.gz |
675 | 4f6b32ca | Petr Pudlak | $ cd ganeti-instance-debootstrap-%0.14% |
676 | 216cb5af | Thomas Thrainer | $ ./configure --with-os-dir=/srv/ganeti/os |
677 | f6d62af4 | Iustin Pop | $ make |
678 | f6d62af4 | Iustin Pop | $ make install |
679 | 28e15341 | Iustin Pop | |
680 | 28e15341 | Iustin Pop | In order to use this OS definition, you need to have internet access |
681 | 28e15341 | Iustin Pop | from your nodes and have the *debootstrap*, *dump* and *restore* |
682 | 28e15341 | Iustin Pop | commands installed on all nodes. Also, if the OS is configured to |
683 | 28e15341 | Iustin Pop | partition the instance's disk in |
684 | 28e15341 | Iustin Pop | ``/etc/default/ganeti-instance-debootstrap``, you will need *kpartx* |
685 | 28e15341 | Iustin Pop | installed. |
686 | 28e15341 | Iustin Pop | |
687 | 28e15341 | Iustin Pop | .. admonition:: Debian |
688 | 28e15341 | Iustin Pop | |
689 | 28e15341 | Iustin Pop | Use this command on all nodes to install the required packages:: |
690 | 28e15341 | Iustin Pop | |
691 | f6d62af4 | Iustin Pop | $ apt-get install debootstrap dump kpartx |
692 | f6d62af4 | Iustin Pop | |
693 | f6d62af4 | Iustin Pop | Or alternatively install the OS definition from the Debian package:: |
694 | f6d62af4 | Iustin Pop | |
695 | f6d62af4 | Iustin Pop | $ apt-get install ganeti-instance-debootstrap |
696 | 28e15341 | Iustin Pop | |
697 | a425810f | Guido Trotter | .. admonition:: KVM |
698 | a425810f | Guido Trotter | |
699 | a425810f | Guido Trotter | In order for debootstrap instances to be able to shutdown cleanly |
700 | f6d62af4 | Iustin Pop | they must install have basic ACPI support inside the instance. Which |
701 | f6d62af4 | Iustin Pop | packages are needed depend on the exact flavor of Debian or Ubuntu |
702 | a425810f | Guido Trotter | which you're installing, but the example defaults file has a |
703 | f6d62af4 | Iustin Pop | commented out configuration line that works for Debian Lenny and |
704 | f6d62af4 | Iustin Pop | Squeeze:: |
705 | a425810f | Guido Trotter | |
706 | a425810f | Guido Trotter | EXTRA_PKGS="acpi-support-base,console-tools,udev" |
707 | a425810f | Guido Trotter | |
708 | f6d62af4 | Iustin Pop | ``kbd`` can be used instead of ``console-tools``, and more packages |
709 | f6d62af4 | Iustin Pop | can be added, of course, if needed. |
710 | a425810f | Guido Trotter | |
711 | 216cb5af | Thomas Thrainer | Please refer to the ``README`` file of ``ganeti-instance-debootstrap`` for |
712 | 216cb5af | Thomas Thrainer | further documentation. |
713 | 216cb5af | Thomas Thrainer | |
714 | 28e15341 | Iustin Pop | Alternatively, you can create your own OS definitions. See the manpage |
715 | 22ac4136 | Michael Hanselmann | :manpage:`ganeti-os-interface(7)`. |
716 | 28e15341 | Iustin Pop | |
717 | 28e15341 | Iustin Pop | Initializing the cluster |
718 | 28e15341 | Iustin Pop | ++++++++++++++++++++++++ |
719 | 28e15341 | Iustin Pop | |
720 | c71a1a3d | Iustin Pop | **Mandatory** once per cluster, on the first node. |
721 | 28e15341 | Iustin Pop | |
722 | c71a1a3d | Iustin Pop | The last step is to initialize the cluster. After you have repeated the |
723 | 216cb5af | Thomas Thrainer | above process on all of your nodes and choose one as the master. Make sure |
724 | 216cb5af | Thomas Thrainer | there is a SSH key pair on the master node (optionally generating one using |
725 | 216cb5af | Thomas Thrainer | ``ssh-keygen``). Finally execute:: |
726 | 28e15341 | Iustin Pop | |
727 | f6d62af4 | Iustin Pop | $ gnt-cluster init %CLUSTERNAME% |
728 | 28e15341 | Iustin Pop | |
729 | c71a1a3d | Iustin Pop | The *CLUSTERNAME* is a hostname, which must be resolvable (e.g. it must |
730 | c71a1a3d | Iustin Pop | exist in DNS or in ``/etc/hosts``) by all the nodes in the cluster. You |
731 | c71a1a3d | Iustin Pop | must choose a name different from any of the nodes names for a |
732 | c71a1a3d | Iustin Pop | multi-node cluster. In general the best choice is to have a unique name |
733 | c71a1a3d | Iustin Pop | for a cluster, even if it consists of only one machine, as you will be |
734 | c71a1a3d | Iustin Pop | able to expand it later without any problems. Please note that the |
735 | c71a1a3d | Iustin Pop | hostname used for this must resolve to an IP address reserved |
736 | 28e15341 | Iustin Pop | **exclusively** for this purpose, and cannot be the name of the first |
737 | 28e15341 | Iustin Pop | (master) node. |
738 | 28e15341 | Iustin Pop | |
739 | 7faf5110 | Michael Hanselmann | If you want to use a bridge which is not ``xen-br0``, or no bridge at |
740 | e721c742 | Guido Trotter | all, change it with the ``--nic-parameters`` option. For example to |
741 | f6d62af4 | Iustin Pop | bridge on br0 you can add:: |
742 | e721c742 | Guido Trotter | |
743 | e721c742 | Guido Trotter | --nic-parameters link=br0 |
744 | e721c742 | Guido Trotter | |
745 | e721c742 | Guido Trotter | Or to not bridge at all, and use a separate routing table:: |
746 | e721c742 | Guido Trotter | |
747 | e721c742 | Guido Trotter | --nic-parameters mode=routed,link=100 |
748 | 9f83899a | Guido Trotter | |
749 | f6d62af4 | Iustin Pop | If you don't have a ``xen-br0`` interface you also have to specify a |
750 | f6d62af4 | Iustin Pop | different network interface which will get the cluster IP, on the master |
751 | e721c742 | Guido Trotter | node, by using the ``--master-netdev <device>`` option. |
752 | 28e15341 | Iustin Pop | |
753 | 28e15341 | Iustin Pop | You can use a different name than ``xenvg`` for the volume group (but |
754 | 28e15341 | Iustin Pop | note that the name must be identical on all nodes). In this case you |
755 | 240c769f | Andrea Spadaccini | need to specify it by passing the *--vg-name <VGNAME>* option to |
756 | 240c769f | Andrea Spadaccini | ``gnt-cluster init``. |
757 | 28e15341 | Iustin Pop | |
758 | c71a1a3d | Iustin Pop | To set up the cluster as an Xen HVM cluster, use the |
759 | 28e15341 | Iustin Pop | ``--enabled-hypervisors=xen-hvm`` option to enable the HVM hypervisor |
760 | c71a1a3d | Iustin Pop | (you can also add ``,xen-pvm`` to enable the PVM one too). You will also |
761 | c71a1a3d | Iustin Pop | need to create the VNC cluster password file |
762 | 28e15341 | Iustin Pop | ``/etc/ganeti/vnc-cluster-password`` which contains one line with the |
763 | 28e15341 | Iustin Pop | default VNC password for the cluster. |
764 | 28e15341 | Iustin Pop | |
765 | 28e15341 | Iustin Pop | To setup the cluster for KVM-only usage (KVM and Xen cannot be mixed), |
766 | 28e15341 | Iustin Pop | pass ``--enabled-hypervisors=kvm`` to the init command. |
767 | 28e15341 | Iustin Pop | |
768 | 28e15341 | Iustin Pop | You can also invoke the command with the ``--help`` option in order to |
769 | 28e15341 | Iustin Pop | see all the possibilities. |
770 | 28e15341 | Iustin Pop | |
771 | b8313b29 | Guido Trotter | Hypervisor/Network/Cluster parameters |
772 | b8313b29 | Guido Trotter | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
773 | b8313b29 | Guido Trotter | |
774 | b8313b29 | Guido Trotter | Please note that the default hypervisor/network/cluster parameters may |
775 | b8313b29 | Guido Trotter | not be the correct one for your environment. Carefully check them, and |
776 | f6d62af4 | Iustin Pop | change them either at cluster init time, or later with ``gnt-cluster |
777 | f6d62af4 | Iustin Pop | modify``. |
778 | b8313b29 | Guido Trotter | |
779 | b8313b29 | Guido Trotter | Your instance types, networking environment, hypervisor type and version |
780 | b8313b29 | Guido Trotter | may all affect what kind of parameters should be used on your cluster. |
781 | b8313b29 | Guido Trotter | |
782 | 18c3417b | Guido Trotter | .. admonition:: KVM |
783 | 18c3417b | Guido Trotter | |
784 | 18c3417b | Guido Trotter | Instances are by default configured to use a host kernel, and to be |
785 | 18c3417b | Guido Trotter | reached via serial console, which works nice for Linux paravirtualized |
786 | 18c3417b | Guido Trotter | instances. If you want fully virtualized instances you may want to |
787 | 18c3417b | Guido Trotter | handle their kernel inside the instance, and to use VNC. |
788 | 18c3417b | Guido Trotter | |
789 | 18c3417b | Guido Trotter | Some versions of KVM have a bug that will make an instance hang when |
790 | 18c3417b | Guido Trotter | configured to use the serial console (which is the default) unless a |
791 | 18c3417b | Guido Trotter | connection is made to it within about 2 seconds of the instance's |
792 | 18c3417b | Guido Trotter | startup. For such case it's recommended to disable the |
793 | 18c3417b | Guido Trotter | ``serial_console`` option. |
794 | 18c3417b | Guido Trotter | |
795 | b8313b29 | Guido Trotter | |
796 | 28e15341 | Iustin Pop | Joining the nodes to the cluster |
797 | 28e15341 | Iustin Pop | ++++++++++++++++++++++++++++++++ |
798 | 28e15341 | Iustin Pop | |
799 | 28e15341 | Iustin Pop | **Mandatory** for all the other nodes. |
800 | 28e15341 | Iustin Pop | |
801 | c71a1a3d | Iustin Pop | After you have initialized your cluster you need to join the other nodes |
802 | c71a1a3d | Iustin Pop | to it. You can do so by executing the following command on the master |
803 | c71a1a3d | Iustin Pop | node:: |
804 | 28e15341 | Iustin Pop | |
805 | f6d62af4 | Iustin Pop | $ gnt-node add %NODENAME% |
806 | 28e15341 | Iustin Pop | |
807 | 28e15341 | Iustin Pop | Separate replication network |
808 | 28e15341 | Iustin Pop | ++++++++++++++++++++++++++++ |
809 | 28e15341 | Iustin Pop | |
810 | 28e15341 | Iustin Pop | **Optional** |
811 | 28e15341 | Iustin Pop | |
812 | 28e15341 | Iustin Pop | Ganeti uses DRBD to mirror the disk of the virtual instances between |
813 | 28e15341 | Iustin Pop | nodes. To use a dedicated network interface for this (in order to |
814 | 28e15341 | Iustin Pop | improve performance or to enhance security) you need to configure an |
815 | 28e15341 | Iustin Pop | additional interface for each node. Use the *-s* option with |
816 | 28e15341 | Iustin Pop | ``gnt-cluster init`` and ``gnt-node add`` to specify the IP address of |
817 | 28e15341 | Iustin Pop | this secondary interface to use for each node. Note that if you |
818 | c71a1a3d | Iustin Pop | specified this option at cluster setup time, you must afterwards use it |
819 | c71a1a3d | Iustin Pop | for every node add operation. |
820 | 28e15341 | Iustin Pop | |
821 | 28e15341 | Iustin Pop | Testing the setup |
822 | 28e15341 | Iustin Pop | +++++++++++++++++ |
823 | 28e15341 | Iustin Pop | |
824 | c71a1a3d | Iustin Pop | Execute the ``gnt-node list`` command to see all nodes in the cluster:: |
825 | 28e15341 | Iustin Pop | |
826 | f6d62af4 | Iustin Pop | $ gnt-node list |
827 | 28e15341 | Iustin Pop | Node DTotal DFree MTotal MNode MFree Pinst Sinst |
828 | 28e15341 | Iustin Pop | node1.example.com 197404 197404 2047 1896 125 0 0 |
829 | 28e15341 | Iustin Pop | |
830 | c71a1a3d | Iustin Pop | The above shows a couple of things: |
831 | 28e15341 | Iustin Pop | |
832 | c71a1a3d | Iustin Pop | - The various Ganeti daemons can talk to each other |
833 | c71a1a3d | Iustin Pop | - Ganeti can examine the storage of the node (DTotal/DFree) |
834 | c71a1a3d | Iustin Pop | - Ganeti can talk to the selected hypervisor (MTotal/MNode/MFree) |
835 | 28e15341 | Iustin Pop | |
836 | c71a1a3d | Iustin Pop | Cluster burnin |
837 | c71a1a3d | Iustin Pop | ~~~~~~~~~~~~~~ |
838 | 28e15341 | Iustin Pop | |
839 | c71a1a3d | Iustin Pop | With Ganeti a tool called :command:`burnin` is provided that can test |
840 | c71a1a3d | Iustin Pop | most of the Ganeti functionality. The tool is installed under the |
841 | c71a1a3d | Iustin Pop | ``lib/ganeti/tools`` directory (either under ``/usr`` or ``/usr/local`` |
842 | c71a1a3d | Iustin Pop | based on the installation method). See more details under |
843 | c71a1a3d | Iustin Pop | :ref:`burnin-label`. |
844 | 28e15341 | Iustin Pop | |
845 | c71a1a3d | Iustin Pop | Further steps |
846 | c71a1a3d | Iustin Pop | ------------- |
847 | 28e15341 | Iustin Pop | |
848 | c71a1a3d | Iustin Pop | You can now proceed either to the :doc:`admin`, or read the manpages of |
849 | c71a1a3d | Iustin Pop | the various commands (:manpage:`ganeti(7)`, :manpage:`gnt-cluster(8)`, |
850 | c71a1a3d | Iustin Pop | :manpage:`gnt-node(8)`, :manpage:`gnt-instance(8)`, |
851 | c71a1a3d | Iustin Pop | :manpage:`gnt-job(8)`). |
852 | 28e15341 | Iustin Pop | |
853 | c71a1a3d | Iustin Pop | .. rubric:: Footnotes |
854 | 28e15341 | Iustin Pop | |
855 | c71a1a3d | Iustin Pop | .. [#defkernel] The kernel and initrd paths can be changed at either |
856 | c71a1a3d | Iustin Pop | cluster level (which changes the default for all instances) or at |
857 | c71a1a3d | Iustin Pop | instance level. |
858 | 558fd122 | Michael Hanselmann | |
859 | 558fd122 | Michael Hanselmann | .. vim: set textwidth=72 : |
860 | c71a1a3d | Iustin Pop | .. Local Variables: |
861 | c71a1a3d | Iustin Pop | .. mode: rst |
862 | c71a1a3d | Iustin Pop | .. fill-column: 72 |
863 | c71a1a3d | Iustin Pop | .. End: |