Statistics
| Branch: | Tag: | Revision:

root / man / gnt-backup.rst @ e715a6d6

History | View | Annotate | Download (9.6 kB)

1 28f3c2dd Iustin Pop
gnt-backup(8) Ganeti | Version @GANETI_VERSION@
2 28f3c2dd Iustin Pop
===============================================
3 28f3c2dd Iustin Pop
4 28f3c2dd Iustin Pop
Name
5 28f3c2dd Iustin Pop
----
6 28f3c2dd Iustin Pop
7 28f3c2dd Iustin Pop
gnt-backup - Ganeti instance import/export
8 28f3c2dd Iustin Pop
9 28f3c2dd Iustin Pop
Synopsis
10 28f3c2dd Iustin Pop
--------
11 28f3c2dd Iustin Pop
12 28f3c2dd Iustin Pop
**gnt-backup** {command} [arguments...]
13 28f3c2dd Iustin Pop
14 28f3c2dd Iustin Pop
DESCRIPTION
15 28f3c2dd Iustin Pop
-----------
16 28f3c2dd Iustin Pop
17 28f3c2dd Iustin Pop
The **gnt-backup** is used for importing and exporting instances
18 28f3c2dd Iustin Pop
and their configuration from a Ganeti system. It is useful for
19 28f3c2dd Iustin Pop
backing up instances and also to migrate them between clusters.
20 28f3c2dd Iustin Pop
21 28f3c2dd Iustin Pop
COMMANDS
22 28f3c2dd Iustin Pop
--------
23 28f3c2dd Iustin Pop
24 28f3c2dd Iustin Pop
EXPORT
25 28f3c2dd Iustin Pop
~~~~~~
26 28f3c2dd Iustin Pop
27 0a6e6e6d Thomas Thrainer
| **export** {-n *node*} [\--compress=*compression-mode*]
28 0a6e6e6d Thomas Thrainer
| [\--shutdown-timeout=*N*] [\--noshutdown] [\--remove-instance]
29 0a6e6e6d Thomas Thrainer
| [\--ignore-remove-failures] [\--submit] [\--print-job-id]
30 f5c0c206 Michael Hanselmann
| {*instance*}
31 28f3c2dd Iustin Pop
32 28f3c2dd Iustin Pop
Exports an instance to the target node. All the instance data and
33 28f3c2dd Iustin Pop
its configuration will be exported under the
34 22ac4136 Michael Hanselmann
``@CUSTOM_EXPORT_DIR@/$instance`` directory on the target node.
35 28f3c2dd Iustin Pop
36 0a6e6e6d Thomas Thrainer
The ``--compress`` option is used to specify which compression mode
37 8ca22fef Thomas Thrainer
is used for moves during the export. Valid values are 'none'
38 8ca22fef Thomas Thrainer
(the default) and 'gzip'.
39 0a6e6e6d Thomas Thrainer
40 28f3c2dd Iustin Pop
The ``--shutdown-timeout`` is used to specify how much time to wait
41 28f3c2dd Iustin Pop
before forcing the shutdown (xm destroy in xen, killing the kvm
42 28f3c2dd Iustin Pop
process, for kvm). By default two minutes are given to each
43 28f3c2dd Iustin Pop
instance to stop.
44 28f3c2dd Iustin Pop
45 28f3c2dd Iustin Pop
The ``--noshutdown`` option will create a snapshot disk of the
46 28f3c2dd Iustin Pop
instance without shutting it down first. While this is faster and
47 28f3c2dd Iustin Pop
involves no downtime, it cannot be guaranteed that the instance
48 28f3c2dd Iustin Pop
data will be in a consistent state in the exported dump.
49 28f3c2dd Iustin Pop
50 28f3c2dd Iustin Pop
The ``--remove`` option can be used to remove the instance after it
51 28f3c2dd Iustin Pop
was exported. This is useful to make one last backup before
52 28f3c2dd Iustin Pop
removing the instance.
53 28f3c2dd Iustin Pop
54 28f3c2dd Iustin Pop
The exit code of the command is 0 if all disks were backed up
55 28f3c2dd Iustin Pop
successfully, 1 if no data was backed up or if the configuration
56 28f3c2dd Iustin Pop
export failed, and 2 if just some of the disks failed to backup.
57 28f3c2dd Iustin Pop
The exact details of the failures will be shown during the command
58 28f3c2dd Iustin Pop
execution (and will be stored in the job log). It is recommended
59 28f3c2dd Iustin Pop
that for any non-zero exit code, the backup is considered invalid,
60 28f3c2dd Iustin Pop
and retried.
61 28f3c2dd Iustin Pop
62 354c4f62 Michael Hanselmann
See **ganeti**\(7) for a description of ``--submit`` and other common
63 f5c0c206 Michael Hanselmann
options.
64 f5c0c206 Michael Hanselmann
65 28f3c2dd Iustin Pop
Example::
66 28f3c2dd Iustin Pop
67 28f3c2dd Iustin Pop
    # gnt-backup export -n node1.example.com instance3.example.com
68 28f3c2dd Iustin Pop
69 28f3c2dd Iustin Pop
70 28f3c2dd Iustin Pop
IMPORT
71 28f3c2dd Iustin Pop
~~~~~~
72 28f3c2dd Iustin Pop
73 28f3c2dd Iustin Pop
| **import**
74 f624fa95 Iustin Pop
| {-n *node[:secondary-node]* | \--iallocator *name*}
75 8ca22fef Thomas Thrainer
| [\--compress=*compression-mode*]
76 f624fa95 Iustin Pop
| [\--disk *N*:size=*VAL* [,vg=*VG*], [,mode=*ro|rw*]...]
77 f624fa95 Iustin Pop
| [\--net *N* [:options...] | \--no-nics]
78 28f3c2dd Iustin Pop
| [-B *BEPARAMS*]
79 28f3c2dd Iustin Pop
| [-H *HYPERVISOR* [: option=*value*... ]]
80 f624fa95 Iustin Pop
| [\--src-node=*source-node*] [\--src-dir=*source-dir*]
81 28f3c2dd Iustin Pop
| [-t [diskless | plain | drbd | file]]
82 f624fa95 Iustin Pop
| [\--identify-defaults]
83 f624fa95 Iustin Pop
| [\--ignore-ipolicy]
84 d6cd74dd Klaus Aehlig
| [\--submit] [\--print-job-id]
85 28f3c2dd Iustin Pop
| {*instance*}
86 28f3c2dd Iustin Pop
87 28f3c2dd Iustin Pop
Imports a new instance from an export residing on *source-node* in
88 28f3c2dd Iustin Pop
*source-dir*. *instance* must be in DNS and resolve to a IP in the
89 28f3c2dd Iustin Pop
same network as the nodes in the cluster. If the source node and
90 28f3c2dd Iustin Pop
directory are not passed, the last backup in the cluster is used,
91 28f3c2dd Iustin Pop
as visible with the **list** command.
92 28f3c2dd Iustin Pop
93 28f3c2dd Iustin Pop
The ``disk`` option specifies the parameters for the disks of the
94 28f3c2dd Iustin Pop
instance. The numbering of disks starts at zero. For each disk, at
95 28f3c2dd Iustin Pop
least the size needs to be given, and optionally the access mode
96 7af3534e Dmitry Chernyak
(read-only or the default of read-write) and LVM volume group can also
97 7af3534e Dmitry Chernyak
be specified. The size is interpreted (when no unit is given) in
98 7af3534e Dmitry Chernyak
mebibytes. You can also use one of the suffixes m, g or t to specificy
99 7af3534e Dmitry Chernyak
the exact the units used; these suffixes map to mebibytes, gibibytes
100 7af3534e Dmitry Chernyak
and tebibytes.
101 28f3c2dd Iustin Pop
102 28f3c2dd Iustin Pop
Alternatively, a single-disk instance can be created via the ``-s``
103 28f3c2dd Iustin Pop
option which takes a single argument, the size of the disk. This is
104 28f3c2dd Iustin Pop
similar to the Ganeti 1.2 version (but will only create one disk).
105 28f3c2dd Iustin Pop
106 28f3c2dd Iustin Pop
If no disk information is passed, the disk configuration saved at
107 28f3c2dd Iustin Pop
export time will be used.
108 28f3c2dd Iustin Pop
109 28f3c2dd Iustin Pop
The minimum disk specification is therefore empty (export information
110 28f3c2dd Iustin Pop
will be used), a single disk can be specified as ``--disk 0:size=20G``
111 28f3c2dd Iustin Pop
(or ``-s 20G`` when using the ``-s`` option), and a three-disk
112 28f3c2dd Iustin Pop
instance can be specified as ``--disk 0:size=20G --disk 1:size=4G
113 28f3c2dd Iustin Pop
--disk 2:size=100G``.
114 28f3c2dd Iustin Pop
115 28f3c2dd Iustin Pop
The NICs of the instances can be specified via the ``--net``
116 28f3c2dd Iustin Pop
option. By default, the NIC configuration of the original
117 28f3c2dd Iustin Pop
(exported) instance will be reused. Each NIC can take up to three
118 28f3c2dd Iustin Pop
parameters (all optional):
119 28f3c2dd Iustin Pop
120 28f3c2dd Iustin Pop
mac
121 28f3c2dd Iustin Pop
    either a value or ``generate`` to generate a new unique MAC, or
122 28f3c2dd Iustin Pop
    ``auto`` to reuse the old MAC
123 28f3c2dd Iustin Pop
124 28f3c2dd Iustin Pop
ip
125 28f3c2dd Iustin Pop
    specifies the IP address assigned to the instance from the Ganeti
126 28f3c2dd Iustin Pop
    side (this is not necessarily what the instance will use, but what
127 28f3c2dd Iustin Pop
    the node expects the instance to use)
128 28f3c2dd Iustin Pop
129 28f3c2dd Iustin Pop
mode
130 c8b96be4 Guido Trotter
    specifies the connection mode for this NIC: ``routed``,
131 57fb6fcb Guido Trotter
    ``bridged`` or ``openvswitch``
132 28f3c2dd Iustin Pop
133 28f3c2dd Iustin Pop
link
134 57fb6fcb Guido Trotter
    in bridged and openvswitch mode specifies the interface to attach
135 57fb6fcb Guido Trotter
    this NIC to, in routed mode it's intended to differentiate between
136 57fb6fcb Guido Trotter
    different routing tables/instance groups (but the meaning is
137 354c4f62 Michael Hanselmann
    dependent on the network script in use, see **gnt-cluster**\(8) for
138 57fb6fcb Guido Trotter
    more details)
139 28f3c2dd Iustin Pop
140 c8b96be4 Guido Trotter
Of these ``mode`` and ``link`` are NIC parameters, and inherit their
141 28f3c2dd Iustin Pop
default at cluster level.
142 28f3c2dd Iustin Pop
143 28f3c2dd Iustin Pop
If no network is desired for the instance, you should create a single
144 f624fa95 Iustin Pop
empty NIC and delete it afterwards via **gnt-instance modify \--net
145 28f3c2dd Iustin Pop
delete**.
146 28f3c2dd Iustin Pop
147 28f3c2dd Iustin Pop
The ``-B`` option specifies the backend parameters for the
148 28f3c2dd Iustin Pop
instance. If no such parameters are specified, the values are
149 28f3c2dd Iustin Pop
inherited from the export. Possible parameters are:
150 28f3c2dd Iustin Pop
151 90bb3fe1 Guido Trotter
maxmem
152 90bb3fe1 Guido Trotter
    the maximum memory size of the instance; as usual, suffixes can be
153 1cdc9dbb Bernardo Dal Seno
    used to denote the unit, otherwise the value is taken in mebibytes
154 90bb3fe1 Guido Trotter
155 90bb3fe1 Guido Trotter
minmem
156 90bb3fe1 Guido Trotter
    the minimum memory size of the instance; as usual, suffixes can be
157 1cdc9dbb Bernardo Dal Seno
    used to denote the unit, otherwise the value is taken in mebibytes
158 28f3c2dd Iustin Pop
159 28f3c2dd Iustin Pop
vcpus
160 28f3c2dd Iustin Pop
    the number of VCPUs to assign to the instance (if this value makes
161 28f3c2dd Iustin Pop
    sense for the hypervisor)
162 28f3c2dd Iustin Pop
163 28f3c2dd Iustin Pop
auto_balance
164 28f3c2dd Iustin Pop
    whether the instance is considered in the N+1 cluster checks
165 28f3c2dd Iustin Pop
    (enough redundancy in the cluster to survive a node failure)
166 28f3c2dd Iustin Pop
167 11dc66f3 Bernardo Dal Seno
always\_failover
168 11dc66f3 Bernardo Dal Seno
    ``True`` or ``False``, whether the instance must be failed over
169 11dc66f3 Bernardo Dal Seno
    (shut down and rebooted) always or it may be migrated (briefly
170 11dc66f3 Bernardo Dal Seno
    suspended)
171 11dc66f3 Bernardo Dal Seno
172 28f3c2dd Iustin Pop
173 28f3c2dd Iustin Pop
The ``-t`` options specifies the disk layout type for the instance.
174 28f3c2dd Iustin Pop
If not passed, the configuration of the original instance is used.
175 28f3c2dd Iustin Pop
The available choices are:
176 28f3c2dd Iustin Pop
177 28f3c2dd Iustin Pop
diskless
178 28f3c2dd Iustin Pop
    This creates an instance with no disks. Its useful for testing only
179 28f3c2dd Iustin Pop
    (or other special cases).
180 28f3c2dd Iustin Pop
181 28f3c2dd Iustin Pop
plain
182 28f3c2dd Iustin Pop
    Disk devices will be logical volumes.
183 28f3c2dd Iustin Pop
184 28f3c2dd Iustin Pop
drbd
185 28f3c2dd Iustin Pop
    Disk devices will be drbd (version 8.x) on top of lvm volumes.
186 28f3c2dd Iustin Pop
187 28f3c2dd Iustin Pop
file
188 49a924bc Helga Velroyen
    Disk devices will be backed up by files, under the cluster's
189 49a924bc Helga Velroyen
    default file storage directory. By default, each instance will
190 49a924bc Helga Velroyen
    get a directory (as its own name) under this path, and each disk
191 49a924bc Helga Velroyen
    is stored as individual files in this (instance-specific) directory.
192 28f3c2dd Iustin Pop
193 28f3c2dd Iustin Pop
The ``--iallocator`` option specifies the instance allocator plugin
194 28f3c2dd Iustin Pop
to use. If you pass in this option the allocator will select nodes
195 28f3c2dd Iustin Pop
for this instance automatically, so you don't need to pass them
196 28f3c2dd Iustin Pop
with the ``-n`` option. For more information please refer to the
197 28f3c2dd Iustin Pop
instance allocator documentation.
198 28f3c2dd Iustin Pop
199 28f3c2dd Iustin Pop
The optional second value of the ``--node`` is used for the drbd
200 28f3c2dd Iustin Pop
template and specifies the remote node.
201 28f3c2dd Iustin Pop
202 8ca22fef Thomas Thrainer
The ``--compress`` option is used to specify which compression mode
203 8ca22fef Thomas Thrainer
is used for moves during the import. Valid values are 'none'
204 8ca22fef Thomas Thrainer
(the default) and 'gzip'.
205 8ca22fef Thomas Thrainer
206 b7d7876b Agata Murawska
The ``--src-dir`` option allows importing instances from a directory
207 b7d7876b Agata Murawska
below ``@CUSTOM_EXPORT_DIR@``.
208 b7d7876b Agata Murawska
209 2a84b7d3 René Nussbaumer
If ``--ignore-ipolicy`` is given any instance policy violations occuring
210 2a84b7d3 René Nussbaumer
during this operation are ignored.
211 2a84b7d3 René Nussbaumer
212 28f3c2dd Iustin Pop
Since many of the parameters are by default read from the exported
213 28f3c2dd Iustin Pop
instance information and used as such, the new instance will have
214 28f3c2dd Iustin Pop
all parameters explicitly specified, the opposite of a newly added
215 28f3c2dd Iustin Pop
instance which has most parameters specified via cluster defaults.
216 28f3c2dd Iustin Pop
To change the import behaviour to recognize parameters whose saved
217 28f3c2dd Iustin Pop
value matches the current cluster default and mark it as such
218 28f3c2dd Iustin Pop
(default value), pass the ``--identify-defaults`` option. This will
219 28f3c2dd Iustin Pop
affect the hypervisor, backend and NIC parameters, both read from
220 28f3c2dd Iustin Pop
the export file and passed in via the command line.
221 28f3c2dd Iustin Pop
222 354c4f62 Michael Hanselmann
See **ganeti**\(7) for a description of ``--submit`` and other common
223 f5c0c206 Michael Hanselmann
options.
224 f5c0c206 Michael Hanselmann
225 28f3c2dd Iustin Pop
Example for identical instance import::
226 28f3c2dd Iustin Pop
227 28f3c2dd Iustin Pop
    # gnt-backup import -n node1.example.com instance3.example.com
228 28f3c2dd Iustin Pop
229 28f3c2dd Iustin Pop
230 28f3c2dd Iustin Pop
Explicit configuration example::
231 28f3c2dd Iustin Pop
232 28f3c2dd Iustin Pop
    # gnt-backup import -t plain --disk 0:size=1G -B memory=512 \
233 28f3c2dd Iustin Pop
    > -n node1.example.com \
234 28f3c2dd Iustin Pop
    > instance3.example.com
235 28f3c2dd Iustin Pop
236 28f3c2dd Iustin Pop
237 28f3c2dd Iustin Pop
LIST
238 28f3c2dd Iustin Pop
~~~~
239 28f3c2dd Iustin Pop
240 0fdf247d Michael Hanselmann
| **list** [\--node=*NODE*] [\--no-headers] [\--separator=*SEPARATOR*]
241 0fdf247d Michael Hanselmann
| [-o *[+]FIELD,...*]
242 28f3c2dd Iustin Pop
243 28f3c2dd Iustin Pop
Lists the exports currently available in the default directory in
244 28f3c2dd Iustin Pop
all the nodes of the current cluster, or optionally only a subset
245 28f3c2dd Iustin Pop
of them specified using the ``--node`` option (which can be used
246 28f3c2dd Iustin Pop
multiple times)
247 28f3c2dd Iustin Pop
248 0fdf247d Michael Hanselmann
The ``--no-headers`` option will skip the initial header line. The
249 0fdf247d Michael Hanselmann
``--separator`` option takes an argument which denotes what will be
250 0fdf247d Michael Hanselmann
used between the output fields. Both these options are to help
251 0fdf247d Michael Hanselmann
scripting.
252 0fdf247d Michael Hanselmann
253 0fdf247d Michael Hanselmann
The ``-o`` option takes a comma-separated list of output fields.
254 0fdf247d Michael Hanselmann
The available fields and their meaning are:
255 0fdf247d Michael Hanselmann
256 0fdf247d Michael Hanselmann
@QUERY_FIELDS_EXPORT@
257 0fdf247d Michael Hanselmann
258 0fdf247d Michael Hanselmann
If the value of the option starts with the character ``+``, the new
259 0fdf247d Michael Hanselmann
fields will be added to the default list. This allows one to quickly
260 0fdf247d Michael Hanselmann
see the default list plus a few other fields, instead of retyping
261 0fdf247d Michael Hanselmann
the entire list of fields.
262 0fdf247d Michael Hanselmann
263 28f3c2dd Iustin Pop
Example::
264 28f3c2dd Iustin Pop
265 0fdf247d Michael Hanselmann
    # gnt-backup list --node node1 --node node2
266 0fdf247d Michael Hanselmann
267 0fdf247d Michael Hanselmann
268 0fdf247d Michael Hanselmann
LIST-FIELDS
269 0fdf247d Michael Hanselmann
~~~~~~~~~~~
270 0fdf247d Michael Hanselmann
271 0fdf247d Michael Hanselmann
**list-fields** [field...]
272 0fdf247d Michael Hanselmann
273 0fdf247d Michael Hanselmann
Lists available fields for exports.
274 28f3c2dd Iustin Pop
275 28f3c2dd Iustin Pop
276 28f3c2dd Iustin Pop
REMOVE
277 28f3c2dd Iustin Pop
~~~~~~
278 28f3c2dd Iustin Pop
279 28f3c2dd Iustin Pop
**remove** {instance_name}
280 28f3c2dd Iustin Pop
281 28f3c2dd Iustin Pop
Removes the backup for the given instance name, if any. If the backup
282 28f3c2dd Iustin Pop
was for a deleted instance, it is needed to pass the FQDN of the
283 28f3c2dd Iustin Pop
instance, and not only the short hostname.
284 9ff4f2c0 Michael Hanselmann
285 9ff4f2c0 Michael Hanselmann
.. vim: set textwidth=72 :
286 9ff4f2c0 Michael Hanselmann
.. Local Variables:
287 9ff4f2c0 Michael Hanselmann
.. mode: rst
288 9ff4f2c0 Michael Hanselmann
.. fill-column: 72
289 9ff4f2c0 Michael Hanselmann
.. End: