Statistics
| Branch: | Tag: | Revision:

root / man / gnt-backup.rst @ 49a924bc

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