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