Statistics
| Branch: | Tag: | Revision:

root / man / gnt-backup.rst @ ad0e078e

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