Statistics
| Branch: | Tag: | Revision:

root / man / gnt-backup.rst @ 56956bcb

History | View | Annotate | Download (7.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 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 28f3c2dd Iustin Pop
| [--disk *N*:size=*VAL* [,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 28f3c2dd Iustin Pop
| {*instance*}
74 28f3c2dd Iustin Pop
75 28f3c2dd Iustin Pop
Imports a new instance from an export residing on *source-node* in
76 28f3c2dd Iustin Pop
*source-dir*. *instance* must be in DNS and resolve to a IP in the
77 28f3c2dd Iustin Pop
same network as the nodes in the cluster. If the source node and
78 28f3c2dd Iustin Pop
directory are not passed, the last backup in the cluster is used,
79 28f3c2dd Iustin Pop
as visible with the **list** command.
80 28f3c2dd Iustin Pop
81 28f3c2dd Iustin Pop
The ``disk`` option specifies the parameters for the disks of the
82 28f3c2dd Iustin Pop
instance. The numbering of disks starts at zero. For each disk, at
83 28f3c2dd Iustin Pop
least the size needs to be given, and optionally the access mode
84 28f3c2dd Iustin Pop
(read-only or the default of read-write) can also be specified. The
85 28f3c2dd Iustin Pop
size is interpreted (when no unit is given) in mebibytes. You can
86 28f3c2dd Iustin Pop
also use one of the suffixes m, g or t to specificy the exact the
87 28f3c2dd Iustin Pop
units used; these suffixes map to mebibytes, gibibytes and
88 28f3c2dd Iustin Pop
tebibytes.
89 28f3c2dd Iustin Pop
90 28f3c2dd Iustin Pop
Alternatively, a single-disk instance can be created via the ``-s``
91 28f3c2dd Iustin Pop
option which takes a single argument, the size of the disk. This is
92 28f3c2dd Iustin Pop
similar to the Ganeti 1.2 version (but will only create one disk).
93 28f3c2dd Iustin Pop
94 28f3c2dd Iustin Pop
If no disk information is passed, the disk configuration saved at
95 28f3c2dd Iustin Pop
export time will be used.
96 28f3c2dd Iustin Pop
97 28f3c2dd Iustin Pop
The minimum disk specification is therefore empty (export information
98 28f3c2dd Iustin Pop
will be used), a single disk can be specified as ``--disk 0:size=20G``
99 28f3c2dd Iustin Pop
(or ``-s 20G`` when using the ``-s`` option), and a three-disk
100 28f3c2dd Iustin Pop
instance can be specified as ``--disk 0:size=20G --disk 1:size=4G
101 28f3c2dd Iustin Pop
--disk 2:size=100G``.
102 28f3c2dd Iustin Pop
103 28f3c2dd Iustin Pop
The NICs of the instances can be specified via the ``--net``
104 28f3c2dd Iustin Pop
option. By default, the NIC configuration of the original
105 28f3c2dd Iustin Pop
(exported) instance will be reused. Each NIC can take up to three
106 28f3c2dd Iustin Pop
parameters (all optional):
107 28f3c2dd Iustin Pop
108 28f3c2dd Iustin Pop
mac
109 28f3c2dd Iustin Pop
    either a value or ``generate`` to generate a new unique MAC, or
110 28f3c2dd Iustin Pop
    ``auto`` to reuse the old MAC
111 28f3c2dd Iustin Pop
112 28f3c2dd Iustin Pop
ip
113 28f3c2dd Iustin Pop
    specifies the IP address assigned to the instance from the Ganeti
114 28f3c2dd Iustin Pop
    side (this is not necessarily what the instance will use, but what
115 28f3c2dd Iustin Pop
    the node expects the instance to use)
116 28f3c2dd Iustin Pop
117 28f3c2dd Iustin Pop
mode
118 28f3c2dd Iustin Pop
    specifies the connection mode for this nic: ``routed`` or
119 28f3c2dd Iustin Pop
    ``bridged``.
120 28f3c2dd Iustin Pop
121 28f3c2dd Iustin Pop
link
122 28f3c2dd Iustin Pop
    in bridged mode specifies the bridge to attach this NIC to, in
123 28f3c2dd Iustin Pop
    routed mode it's intended to differentiate between different
124 28f3c2dd Iustin Pop
    routing tables/instance groups (but the meaning is dependent on
125 28f3c2dd Iustin Pop
    the network script in use, see **gnt-cluster**(8) for more
126 28f3c2dd Iustin Pop
    details)
127 28f3c2dd Iustin Pop
128 28f3c2dd Iustin Pop
Of these ``mode`` and ``link`` are nic parameters, and inherit their
129 28f3c2dd Iustin Pop
default at cluster level.
130 28f3c2dd Iustin Pop
131 28f3c2dd Iustin Pop
If no network is desired for the instance, you should create a single
132 28f3c2dd Iustin Pop
empty NIC and delete it afterwards via **gnt-instance modify --net
133 28f3c2dd Iustin Pop
delete**.
134 28f3c2dd Iustin Pop
135 28f3c2dd Iustin Pop
The ``-B`` option specifies the backend parameters for the
136 28f3c2dd Iustin Pop
instance. If no such parameters are specified, the values are
137 28f3c2dd Iustin Pop
inherited from the export. Possible parameters are:
138 28f3c2dd Iustin Pop
139 28f3c2dd Iustin Pop
memory
140 28f3c2dd Iustin Pop
    the memory size of the instance; as usual, suffixes can be used to
141 28f3c2dd Iustin Pop
    denote the unit, otherwise the value is taken in mebibites
142 28f3c2dd Iustin Pop
143 28f3c2dd Iustin Pop
vcpus
144 28f3c2dd Iustin Pop
    the number of VCPUs to assign to the instance (if this value makes
145 28f3c2dd Iustin Pop
    sense for the hypervisor)
146 28f3c2dd Iustin Pop
147 28f3c2dd Iustin Pop
auto_balance
148 28f3c2dd Iustin Pop
    whether the instance is considered in the N+1 cluster checks
149 28f3c2dd Iustin Pop
    (enough redundancy in the cluster to survive a node failure)
150 28f3c2dd Iustin Pop
151 28f3c2dd Iustin Pop
152 28f3c2dd Iustin Pop
The ``-t`` options specifies the disk layout type for the instance.
153 28f3c2dd Iustin Pop
If not passed, the configuration of the original instance is used.
154 28f3c2dd Iustin Pop
The available choices are:
155 28f3c2dd Iustin Pop
156 28f3c2dd Iustin Pop
diskless
157 28f3c2dd Iustin Pop
    This creates an instance with no disks. Its useful for testing only
158 28f3c2dd Iustin Pop
    (or other special cases).
159 28f3c2dd Iustin Pop
160 28f3c2dd Iustin Pop
plain
161 28f3c2dd Iustin Pop
    Disk devices will be logical volumes.
162 28f3c2dd Iustin Pop
163 28f3c2dd Iustin Pop
drbd
164 28f3c2dd Iustin Pop
    Disk devices will be drbd (version 8.x) on top of lvm volumes.
165 28f3c2dd Iustin Pop
166 28f3c2dd Iustin Pop
file
167 28f3c2dd Iustin Pop
    Disk devices will be backed up by files, under the directory
168 28f3c2dd Iustin Pop
    ``@RPL_FILE_STORAGE_DIR@``. By default, each instance will get a
169 28f3c2dd Iustin Pop
    directory (as its own name) under this path, and each disk is
170 28f3c2dd Iustin Pop
    stored as individual files in this (instance-specific) directory.
171 28f3c2dd Iustin Pop
172 28f3c2dd Iustin Pop
173 28f3c2dd Iustin Pop
The ``--iallocator`` option specifies the instance allocator plugin
174 28f3c2dd Iustin Pop
to use. If you pass in this option the allocator will select nodes
175 28f3c2dd Iustin Pop
for this instance automatically, so you don't need to pass them
176 28f3c2dd Iustin Pop
with the ``-n`` option. For more information please refer to the
177 28f3c2dd Iustin Pop
instance allocator documentation.
178 28f3c2dd Iustin Pop
179 28f3c2dd Iustin Pop
The optional second value of the ``--node`` is used for the drbd
180 28f3c2dd Iustin Pop
template and specifies the remote node.
181 28f3c2dd Iustin Pop
182 28f3c2dd Iustin Pop
Since many of the parameters are by default read from the exported
183 28f3c2dd Iustin Pop
instance information and used as such, the new instance will have
184 28f3c2dd Iustin Pop
all parameters explicitly specified, the opposite of a newly added
185 28f3c2dd Iustin Pop
instance which has most parameters specified via cluster defaults.
186 28f3c2dd Iustin Pop
To change the import behaviour to recognize parameters whose saved
187 28f3c2dd Iustin Pop
value matches the current cluster default and mark it as such
188 28f3c2dd Iustin Pop
(default value), pass the ``--identify-defaults`` option. This will
189 28f3c2dd Iustin Pop
affect the hypervisor, backend and NIC parameters, both read from
190 28f3c2dd Iustin Pop
the export file and passed in via the command line.
191 28f3c2dd Iustin Pop
192 28f3c2dd Iustin Pop
Example for identical instance import::
193 28f3c2dd Iustin Pop
194 28f3c2dd Iustin Pop
    # gnt-backup import -n node1.example.com instance3.example.com
195 28f3c2dd Iustin Pop
196 28f3c2dd Iustin Pop
197 28f3c2dd Iustin Pop
Explicit configuration example::
198 28f3c2dd Iustin Pop
199 28f3c2dd Iustin Pop
    # gnt-backup import -t plain --disk 0:size=1G -B memory=512 \
200 28f3c2dd Iustin Pop
    > -n node1.example.com \
201 28f3c2dd Iustin Pop
    > instance3.example.com
202 28f3c2dd Iustin Pop
203 28f3c2dd Iustin Pop
204 28f3c2dd Iustin Pop
LIST
205 28f3c2dd Iustin Pop
~~~~
206 28f3c2dd Iustin Pop
207 28f3c2dd Iustin Pop
**list** [--node=*NODE*]
208 28f3c2dd Iustin Pop
209 28f3c2dd Iustin Pop
Lists the exports currently available in the default directory in
210 28f3c2dd Iustin Pop
all the nodes of the current cluster, or optionally only a subset
211 28f3c2dd Iustin Pop
of them specified using the ``--node`` option (which can be used
212 28f3c2dd Iustin Pop
multiple times)
213 28f3c2dd Iustin Pop
214 28f3c2dd Iustin Pop
Example::
215 28f3c2dd Iustin Pop
216 28f3c2dd Iustin Pop
    # gnt-backup list --nodes node1 --nodes node2
217 28f3c2dd Iustin Pop
218 28f3c2dd Iustin Pop
219 28f3c2dd Iustin Pop
REMOVE
220 28f3c2dd Iustin Pop
~~~~~~
221 28f3c2dd Iustin Pop
222 28f3c2dd Iustin Pop
**remove** {instance_name}
223 28f3c2dd Iustin Pop
224 28f3c2dd Iustin Pop
Removes the backup for the given instance name, if any. If the backup
225 28f3c2dd Iustin Pop
was for a deleted instance, it is needed to pass the FQDN of the
226 28f3c2dd Iustin Pop
instance, and not only the short hostname.