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