Statistics
| Branch: | Tag: | Revision:

root / doc / admin.sgml @ 2395c322

History | View | Annotate | Download (14.2 kB)

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.2</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>local_raid1</term>
177
          <listitem>
178
            <para>A local mirror is set between LVM devices to back the
179
              instance. This provides some redundancy for the instance's
180
              data.</para>
181
          </listitem>
182
        </varlistentry>
183

    
184
        <varlistentry>
185
          <term>remote_raid1</term>
186
          <listitem>
187
            <simpara><emphasis role="strong">Note:</emphasis> This is only
188
              valid for multi-node clusters.</simpara>
189
            <simpara>
190
              A mirror is set between the local node and a remote one, which
191
              must be specified with the second value of the --node option. Use
192
              this option to obtain a highly available instance that can be
193
              failed over to a remote node should the primary one fail.
194
            </simpara>
195
          </listitem>
196
        </varlistentry>
197

    
198
      </variablelist>
199

    
200
      <para>
201
        For example if you want to create an highly available instance use the
202
        remote_raid1 disk template:
203
        <synopsis>gnt-instance add -n <replaceable>TARGET_NODE</replaceable><optional>:<replaceable>SECONDARY_NODE</replaceable></optional> -o <replaceable>OS_TYPE</replaceable> -t remote_raid1 \
204
  <replaceable>INSTANCE_NAME</replaceable></synopsis>
205

    
206
      <para>
207
        To know which operating systems your cluster supports you can use
208
        <synopsis>gnt-os list</synopsis>
209
      </para>
210

    
211
      <para>
212
        Removing an instance is even easier than creating one. This operation
213
        is non-reversible and destroys all the contents of your instance. Use
214
        with care:
215

    
216
        <synopsis>gnt-instance remove <replaceable>INSTANCE_NAME</replaceable></synopsis>
217
      </para>
218
    </sect2>
219

    
220
    <sect2>
221
      <title>Starting/Stopping an instance</title>
222

    
223
      <para>
224
        Instances are automatically started at instance creation time. To
225
        manually start one which is currently stopped you can run:
226

    
227
        <synopsis>gnt-instance startup <replaceable>INSTANCE_NAME</replaceable></synopsis>
228

    
229
        While the command to stop one is:
230

    
231
        <synopsis>gnt-instance shutdown <replaceable>INSTANCE_NAME</replaceable></synopsis>
232

    
233
        The command to see all the instances configured and their status is:
234

    
235
        <synopsis>gnt-instance list</synopsis>
236

    
237
      </para>
238

    
239
      <para>
240
        Do not use the xen commands to stop instances. If you run for
241
        example xm shutdown or xm destroy on an instance Ganeti will
242
        automatically restart it (via the
243
        <citerefentry><refentrytitle>ganeti-watcher</refentrytitle>
244
        <manvolnum>8</manvolnum></citerefentry>)
245
      </para>
246

    
247
    </sect2>
248

    
249
    <sect2>
250
      <title>Exporting/Importing an instance</title>
251

    
252
      <para>
253
        You can create a snapshot of an instance disk and Ganeti
254
        configuration, which then you can backup, or import into
255
        another cluster. The way to export an instance is:
256

    
257
        <synopsis>gnt-backup export -n <replaceable>TARGET_NODE</replaceable> <replaceable>INSTANCE_NAME</replaceable></synopsis>
258

    
259
        The target node can be any node in the cluster with enough
260
        space under <filename class="directory">/srv/ganeti</filename>
261
        to hold the instance image. Use the
262
        <option>--noshutdown</option> option to snapshot an instance
263
        without rebooting it. Any previous snapshot of the same
264
        instance existing cluster-wide under <filename
265
        class="directory">/srv/ganeti</filename> will be removed by
266
        this operation: if you want to keep them move them out of the
267
        Ganeti exports directory.
268
      </para>
269

    
270
      <para>
271
        Importing an instance is similar to creating a new one. The command is:
272

    
273
        <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>
274

    
275
        Most of the options available for the command
276
        <emphasis>gnt-instance add</emphasis> are supported here too.
277

    
278
      </para>
279
    </sect2>
280

    
281
  </sect1>
282

    
283

    
284
  <sect1>
285
    <title>High availability features</title>
286

    
287
    <note>
288
      <simpara>This section only applies to multi-node clusters.</simpara>
289
    </note>
290

    
291
    <sect2>
292
      <title>Failing over an instance</title>
293

    
294
      <para>
295
        If an instance is built in highly available mode you can at
296
        any time fail it over to its secondary node, even if the
297
        primary has somehow failed and it's not up anymore. Doing it
298
        is really easy, on the master node you can just run:
299

    
300
        <synopsis>gnt-instance failover <replaceable>INSTANCE_NAME</replaceable></synopsis>
301

    
302
        That's it. After the command completes the secondary node is
303
        now the primary, and vice versa.
304
      </para>
305
    </sect2>
306

    
307
    <sect2>
308
      <title>Replacing an instance disks</title>
309

    
310
      <para>
311
        So what if instead the secondary node for an instance has
312
        failed, or you plan to remove a node from your cluster, and
313
        you failed over all its instances, but it's still secondary
314
        for some? The solution here is to replace the instance disks,
315
        changing the secondary node:
316

    
317
        <synopsis>gnt-instance replace-disks -n <replaceable>NEW_SECONDARY</replaceable> <replaceable>INSTANCE_NAME</replaceable></synopsis>
318

    
319
        This process is a bit longer, but involves no instance
320
        downtime, and at the end of it the instance has changed its
321
        secondary node, to which it can if necessary be failed over.
322
      </para>
323
    </sect2>
324
    <sect2>
325
      <title>Failing over the master node</title>
326

    
327
      <para>
328
        This is all good as long as the Ganeti Master Node is
329
        up. Should it go down, or should you wish to decommission it,
330
        just run on any other node the command:
331

    
332
        <synopsis>gnt-cluster masterfailover</synopsis>
333

    
334
        and the node you ran it on is now the new master.
335
      </para>
336
    </sect2>
337
    <sect2>
338
      <title>Adding/Removing nodes</title>
339

    
340
      <para>
341
        And of course, now that you know how to move instances around,
342
        it's easy to free up a node, and then you can remove it from
343
        the cluster:
344

    
345
        <synopsis>gnt-node remove <replaceable>NODE_NAME</replaceable></synopsis>
346

    
347
        and maybe add a new one:
348

    
349
        <synopsis>gnt-node add <optional><option>--secondary-ip=<replaceable>ADDRESS</replaceable></option></optional> <replaceable>NODE_NAME</replaceable>
350

    
351
      </synopsis>
352
      </para>
353
    </sect2>
354
  </sect1>
355

    
356
  <sect1>
357
    <title>Debugging Features</title>
358

    
359
    <para>
360
      At some point you might need to do some debugging operations on
361
      your cluster or on your instances. This section will help you
362
      with the most used debugging functionalities.
363
    </para>
364

    
365
    <sect2>
366
      <title>Accessing an instance's disks</title>
367

    
368
      <para>
369
        From an instance's primary node you have access to its
370
        disks. Never ever mount the underlying logical volume manually
371
        on a fault tolerant instance, or you risk breaking
372
        replication. The correct way to access them is to run the
373
        command:
374

    
375
        <synopsis>gnt-instance activate-disks <replaceable>INSTANCE_NAME</replaceable></synopsis>
376

    
377
        And then access the device that gets created.  After you've
378
        finished you can deactivate them with the deactivate-disks
379
        command, which works in the same way.
380
      </para>
381
    </sect2>
382

    
383
    <sect2>
384
      <title>Accessing an instance's console</title>
385

    
386
      <para>
387
        The command to access a running instance's console is:
388

    
389
        <synopsis>gnt-instance console <replaceable>INSTANCE_NAME</replaceable></synopsis>
390

    
391
        Use the console normally and then type
392
        <userinput>^]</userinput> when done, to exit.
393
      </para>
394
    </sect2>
395

    
396
    <sect2>
397
      <title>Instance Operating System Debugging</title>
398

    
399
      <para>
400
        Should you have any problems with operating systems support
401
        the command to ran to see a complete status for all your nodes
402
        is:
403

    
404
        <synopsis>gnt-os diagnose</synopsis>
405

    
406
      </para>
407

    
408
    </sect2>
409

    
410
    <sect2>
411
      <title>Cluster-wide debugging</title>
412

    
413
      <para>
414
        The gnt-cluster command offers several options to run tests or
415
        execute cluster-wide operations. For example:
416

    
417
      <screen>
418
gnt-cluster command
419
gnt-cluster copyfile
420
gnt-cluster verify
421
gnt-cluster getmaster
422
gnt-cluster version
423
      </screen>
424

    
425
        See the man page <citerefentry>
426
        <refentrytitle>gnt-cluster</refentrytitle>
427
        <manvolnum>8</manvolnum> </citerefentry> to know more about
428
        their usage.
429
      </para>
430
    </sect2>
431

    
432
  </sect1>
433

    
434
  </article>