Handle default/none values in hv/be params
[ganeti-local] / doc / admin.sgml
1 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [
2 ]>
3   <article class="specification">
4   <articleinfo>
5     <title>Ganeti administrator's guide</title>
6   </articleinfo>
7   <para>Documents Ganeti version 1.3</para>
8   <sect1>
9     <title>Introduction</title>
10
11     <para>Ganeti is a virtualization cluster management software. You are
12     expected to be a system administrator familiar with your Linux distribution
13     and the Xen virtualization environment before using it.
14     </para>
15
16     <para>The various components of Ganeti all have man pages and interactive
17     help. This manual though will help you getting familiar with the system by
18     explaining the most common operations, grouped by related use.
19     </para>
20
21     <para>After a terminology glossary and a section on the prerequisites
22     needed to use this manual, the rest of this document is divided in three
23     main sections, which group different features of Ganeti:
24       <itemizedlist>
25         <listitem>
26           <simpara>Instance Management</simpara>
27         </listitem>
28         <listitem>
29           <simpara>High Availability Features</simpara>
30         </listitem>
31         <listitem>
32           <simpara>Debugging Features</simpara>
33         </listitem>
34       </itemizedlist>
35     </para>
36
37     <sect2>
38       <title>Ganeti terminology</title>
39
40       <para>
41         This section provides a small introduction to Ganeti terminology, which
42         might be useful to read the rest of the document.
43
44         <glosslist>
45           <glossentry>
46             <glossterm>Cluster</glossterm>
47             <glossdef>
48               <simpara>
49                 A set of machines (nodes) that cooperate to offer a
50                 coherent highly available virtualization service.
51               </simpara>
52             </glossdef>
53           </glossentry>
54           <glossentry>
55             <glossterm>Node</glossterm>
56             <glossdef>
57               <simpara>
58                 A physical machine which is member of a cluster.
59                 Nodes are the basic cluster infrastructure, and are
60                 not fault tolerant.
61               </simpara>
62             </glossdef>
63           </glossentry>
64           <glossentry>
65             <glossterm>Master node</glossterm>
66             <glossdef>
67               <simpara>
68                 The node which controls the Cluster, from which all
69                 Ganeti commands must be given.
70               </simpara>
71             </glossdef>
72           </glossentry>
73           <glossentry>
74             <glossterm>Instance</glossterm>
75             <glossdef>
76               <simpara>
77                 A virtual machine which runs on a cluster. It can be a
78                 fault tolerant highly available entity.
79               </simpara>
80             </glossdef>
81           </glossentry>
82           <glossentry>
83             <glossterm>Pool</glossterm>
84             <glossdef>
85               <simpara>
86                 A pool is a set of clusters sharing the same network.
87               </simpara>
88             </glossdef>
89           </glossentry>
90           <glossentry>
91             <glossterm>Meta-Cluster</glossterm>
92             <glossdef>
93               <simpara>
94                 Anything that concerns more than one cluster.
95               </simpara>
96             </glossdef>
97           </glossentry>
98         </glosslist>
99       </para>
100     </sect2>
101
102     <sect2>
103       <title>Prerequisites</title>
104
105       <para>
106         You need to have your Ganeti cluster installed and configured before
107         you try any of the commands in this document. Please follow the
108         <emphasis>Ganeti installation tutorial</emphasis> for instructions on
109         how to do that.
110       </para>
111     </sect2>
112
113   </sect1>
114
115   <sect1>
116     <title>Managing Instances</title>
117
118     <sect2>
119       <title>Adding/Removing an instance</title>
120
121       <para>
122         Adding a new virtual instance to your Ganeti cluster is really easy.
123         The command is:
124
125         <synopsis>gnt-instance add -n <replaceable>TARGET_NODE</replaceable> -o <replaceable>OS_TYPE</replaceable> -t <replaceable>DISK_TEMPLATE</replaceable> <replaceable>INSTANCE_NAME</replaceable></synopsis>
126
127         The instance name must be resolvable (e.g. exist in DNS) and
128         of course map to an address in the same subnet as the cluster
129         itself. Options you can give to this command include:
130
131       <itemizedlist>
132         <listitem>
133           <simpara>The disk size (<option>-s</option>)</simpara>
134         </listitem>
135         <listitem>
136           <simpara>The swap size (<option>--swap-size</option>)</simpara>
137         </listitem>
138         <listitem>
139           <simpara>The memory size (<option>-m</option>)</simpara>
140         </listitem>
141         <listitem>
142           <simpara>The number of virtual CPUs (<option>-p</option>)</simpara>
143         </listitem>
144         <listitem>
145           <simpara>The instance ip address (<option>-i</option>) (use the value
146             <literal>auto</literal> to make Ganeti record the address from
147             dns)</simpara>
148         </listitem>
149         <listitem>
150           <simpara>The bridge to connect the instance to (<option>-b</option>),
151             if you don't want to use the default one</simpara>
152         </listitem>
153       </itemizedlist>
154       </para>
155
156       <para>There are four types of disk template you can choose from:</para>
157
158       <variablelist>
159         <varlistentry>
160           <term>diskless</term>
161           <listitem>
162             <para>The instance has no disks. Only used for special purpouse
163               operating systems or for testing.</para>
164           </listitem>
165         </varlistentry>
166
167         <varlistentry>
168           <term>plain</term>
169           <listitem>
170             <para>The instance will use LVM devices as backend for its disks.
171               No redundancy is provided.</para>
172           </listitem>
173         </varlistentry>
174
175         <varlistentry>
176           <term>drbd</term>
177           <listitem>
178             <simpara><emphasis role="strong">Note:</emphasis> This is only
179               valid for multi-node clusters using drbd 8.0.x</simpara>
180             <simpara>
181               A mirror is set between the local node and a remote one, which
182               must be specified with the second value of the --node option. Use
183               this option to obtain a highly available instance that can be
184               failed over to a remote node should the primary one fail.
185             </simpara>
186           </listitem>
187         </varlistentry>
188
189       </variablelist>
190
191       <para>
192         For example if you want to create an highly available instance use the
193         drbd disk templates:
194         <synopsis>gnt-instance add -n <replaceable>TARGET_NODE</replaceable><optional>:<replaceable>SECONDARY_NODE</replaceable></optional> -o <replaceable>OS_TYPE</replaceable> -t drbd \
195   <replaceable>INSTANCE_NAME</replaceable></synopsis>
196
197       <para>
198         To know which operating systems your cluster supports you can use
199         <synopsis>gnt-os list</synopsis>
200       </para>
201
202       <para>
203         Removing an instance is even easier than creating one. This operation
204         is non-reversible and destroys all the contents of your instance. Use
205         with care:
206
207         <synopsis>gnt-instance remove <replaceable>INSTANCE_NAME</replaceable></synopsis>
208       </para>
209     </sect2>
210
211     <sect2>
212       <title>Starting/Stopping an instance</title>
213
214       <para>
215         Instances are automatically started at instance creation time. To
216         manually start one which is currently stopped you can run:
217
218         <synopsis>gnt-instance startup <replaceable>INSTANCE_NAME</replaceable></synopsis>
219
220         While the command to stop one is:
221
222         <synopsis>gnt-instance shutdown <replaceable>INSTANCE_NAME</replaceable></synopsis>
223
224         The command to see all the instances configured and their status is:
225
226         <synopsis>gnt-instance list</synopsis>
227
228       </para>
229
230       <para>
231         Do not use the xen commands to stop instances. If you run for
232         example xm shutdown or xm destroy on an instance Ganeti will
233         automatically restart it (via the
234         <citerefentry><refentrytitle>ganeti-watcher</refentrytitle>
235         <manvolnum>8</manvolnum></citerefentry>)
236       </para>
237
238     </sect2>
239
240     <sect2>
241       <title>Exporting/Importing an instance</title>
242
243       <para>
244         You can create a snapshot of an instance disk and Ganeti
245         configuration, which then you can backup, or import into
246         another cluster. The way to export an instance is:
247
248         <synopsis>gnt-backup export -n <replaceable>TARGET_NODE</replaceable> <replaceable>INSTANCE_NAME</replaceable></synopsis>
249
250         The target node can be any node in the cluster with enough
251         space under <filename class="directory">/srv/ganeti</filename>
252         to hold the instance image. Use the
253         <option>--noshutdown</option> option to snapshot an instance
254         without rebooting it. Any previous snapshot of the same
255         instance existing cluster-wide under <filename
256         class="directory">/srv/ganeti</filename> will be removed by
257         this operation: if you want to keep them move them out of the
258         Ganeti exports directory.
259       </para>
260
261       <para>
262         Importing an instance is similar to creating a new one. The command is:
263
264         <synopsis>gnt-backup import -n <replaceable>TARGET_NODE</replaceable> -t <replaceable>DISK_TEMPLATE</replaceable> --src-node=<replaceable>NODE</replaceable> --src-dir=DIR INSTANCE_NAME</synopsis>
265
266         Most of the options available for the command
267         <emphasis>gnt-instance add</emphasis> are supported here too.
268
269       </para>
270     </sect2>
271
272   </sect1>
273
274
275   <sect1>
276     <title>High availability features</title>
277
278     <note>
279       <simpara>This section only applies to multi-node clusters.</simpara>
280     </note>
281
282     <sect2>
283       <title>Failing over an instance</title>
284
285       <para>
286         If an instance is built in highly available mode you can at
287         any time fail it over to its secondary node, even if the
288         primary has somehow failed and it's not up anymore. Doing it
289         is really easy, on the master node you can just run:
290
291         <synopsis>gnt-instance failover <replaceable>INSTANCE_NAME</replaceable></synopsis>
292
293         That's it. After the command completes the secondary node is
294         now the primary, and vice versa.
295       </para>
296     </sect2>
297
298     <sect2>
299       <title>Replacing an instance disks</title>
300
301       <para>
302         So what if instead the secondary node for an instance has
303         failed, or you plan to remove a node from your cluster, and
304         you failed over all its instances, but it's still secondary
305         for some? The solution here is to replace the instance disks,
306         changing the secondary node:
307         <synopsis>gnt-instance replace-disks <option>-s</option> <option>--new-secondary <replaceable>NODE</replaceable></option> <replaceable>INSTANCE_NAME</replaceable></synopsis>
308
309         This process is a bit long, but involves no instance
310         downtime, and at the end of it the instance has changed its
311         secondary node, to which it can if necessary be failed over.
312       </para>
313     </sect2>
314     <sect2>
315       <title>Failing over the master node</title>
316
317       <para>
318         This is all good as long as the Ganeti Master Node is
319         up. Should it go down, or should you wish to decommission it,
320         just run on any other node the command:
321
322         <synopsis>gnt-cluster masterfailover</synopsis>
323
324         and the node you ran it on is now the new master.
325       </para>
326     </sect2>
327     <sect2>
328       <title>Adding/Removing nodes</title>
329
330       <para>
331         And of course, now that you know how to move instances around,
332         it's easy to free up a node, and then you can remove it from
333         the cluster:
334
335         <synopsis>gnt-node remove <replaceable>NODE_NAME</replaceable></synopsis>
336
337         and maybe add a new one:
338
339         <synopsis>gnt-node add <optional><option>--secondary-ip=<replaceable>ADDRESS</replaceable></option></optional> <replaceable>NODE_NAME</replaceable>
340
341       </synopsis>
342       </para>
343     </sect2>
344   </sect1>
345
346   <sect1>
347     <title>Debugging Features</title>
348
349     <para>
350       At some point you might need to do some debugging operations on
351       your cluster or on your instances. This section will help you
352       with the most used debugging functionalities.
353     </para>
354
355     <sect2>
356       <title>Accessing an instance's disks</title>
357
358       <para>
359         From an instance's primary node you have access to its
360         disks. Never ever mount the underlying logical volume manually
361         on a fault tolerant instance, or you risk breaking
362         replication. The correct way to access them is to run the
363         command:
364
365         <synopsis>gnt-instance activate-disks <replaceable>INSTANCE_NAME</replaceable></synopsis>
366
367         And then access the device that gets created.  After you've
368         finished you can deactivate them with the deactivate-disks
369         command, which works in the same way.
370       </para>
371     </sect2>
372
373     <sect2>
374       <title>Accessing an instance's console</title>
375
376       <para>
377         The command to access a running instance's console is:
378
379         <synopsis>gnt-instance console <replaceable>INSTANCE_NAME</replaceable></synopsis>
380
381         Use the console normally and then type
382         <userinput>^]</userinput> when done, to exit.
383       </para>
384     </sect2>
385
386     <sect2>
387       <title>Instance OS definitions Debugging</title>
388
389       <para>
390         Should you have any problems with operating systems support
391         the command to ran to see a complete status for all your nodes
392         is:
393
394         <synopsis>gnt-os diagnose</synopsis>
395
396       </para>
397
398     </sect2>
399
400     <sect2>
401       <title>Cluster-wide debugging</title>
402
403       <para>
404         The gnt-cluster command offers several options to run tests or
405         execute cluster-wide operations. For example:
406
407       <screen>
408 gnt-cluster command
409 gnt-cluster copyfile
410 gnt-cluster verify
411 gnt-cluster getmaster
412 gnt-cluster version
413       </screen>
414
415         See the man page <citerefentry>
416         <refentrytitle>gnt-cluster</refentrytitle>
417         <manvolnum>8</manvolnum> </citerefentry> to know more about
418         their usage.
419       </para>
420     </sect2>
421
422   </sect1>
423
424   </article>