/
bura-freezer_scheduler.xml
278 lines (278 loc) · 9.9 KB
/
bura-freezer_scheduler.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<?xml version="1.0"?>
<?xml-stylesheet href="urn:x-suse:xslt:profiling:docbook51-profile.xsl"
type="text/xml"
title="Profiling step"?>
<!DOCTYPE section [
<!ENTITY % entities SYSTEM "entities.ent"> %entities;
]>
<section xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="topic-mlh-wtn-rt">
<title>Backup/Restore Scheduler</title>
<!---->
<section>
<title>Freezer (backup/restore service) Scheduler Overview</title>
<para>
This document explains, through examples, how to set up backup and restore
jobs using the backup/restore service scheduler (referred to as Freezer
Scheduler).
</para>
<para>
The scheduler is a long running process that executes the following:
</para>
<itemizedlist>
<listitem>
<para>
Interact with the Freezer API
</para>
</listitem>
<listitem>
<para>
Generate a client_id to register the client on to the API (to identify the
node during the next executions)
</para>
</listitem>
<listitem>
<para>
Execute the freezer-agent according the jobs information retrieved from
the API
</para>
</listitem>
<listitem>
<para>
Write to the freezer API the outcome of the freezer-agent execution
</para>
</listitem>
</itemizedlist>
<note>
<para>
Freezer API maintains information about jobs in the &elasticsearch;
Database.
</para>
</note>
<note>
<para>
You must run as root to perform any tasks using the Freezer backup/restore
service.
</para>
</note>
</section>
<section>
<title>Freezer (backup/restore service) Scheduler Client-ID</title>
<para>
In &kw-hos-phrase;, Freezer Scheduler is automatically installed on the
&clm; and controller nodes.
</para>
<para>
There is a client_id for each node and its corresponds to the hostname. The
client_id is created at registration time. The registration is done
automatically when the scheduler executes any request to the API.
<!---->
</para>
<para>
The following command lists all the freezer scheduler clients:
</para>
<screen>&prompt.ardana;freezer client-list</screen>
<para>
Here is an example:
</para>
<screen>&prompt.ardana;freezer client-list
+--------------------------------+----------------------------------+--------------------------------+-------------+
| Client ID | uuid | hostname | description |
+--------------------------------+----------------------------------+--------------------------------+-------------+
| ardana-qe202-cp1-c1-m3-mgmt | 7869340f2efc4fb9b29e94397385ac39 | ardana-qe202-cp1-c1-m3-mgmt | |
| ardana-qe202-cp1-c1-m2-mgmt | 18041c2b12054802bdaf8cc458abc35d | ardana-qe202-cp1-c1-m2-mgmt | |
| ardana-qe202-cp1-c1-m1-mgmt | 884045a72026425dbcea754806d1022d | ardana-qe202-cp1-c1-m1-mgmt | |
| ardana-qe202-cp1-comp0001-mgmt | e404b34e5f7844ed957ca5dd90e6446f | ardana-qe202-cp1-comp0001-mgmt | |
+--------------------------------+----------------------------------+--------------------------------+-------------+</screen>
</section>
<section>
<title>Creating a Scheduler Job</title>
<procedure>
<step>
<para>
Log in to a controller node and create the job.
</para>
</step>
<step>
<para>
Source the operating system variables and use the correct client_id. (The
client-id corresponds to the node where the backup
files/directory/database resides.) In &productname; the sourcing of the variable
should be done like this when you need to use ardana_backup user and backup
tenant (used for infrastructure backup): Note that when you perform these
actions you must be <emphasis role="bold">running as root</emphasis>. The
following command will provide the necessary credentials to run the job.
</para>
<note vendor="hpe">
<para>
The location of backup.osrc has now changed from the old location of
<filename>/opt/stack/service/freezer-agent/etc/backup.osrc</filename>.
</para>
</note>
<screen>&prompt.ardana;source ~/backup.osrc</screen>
<para>
And with the following when you need to use admin user and admin tenant.
The following file will contain the admin user credentials. These are not
for jobs that were created automatically; they are only used for jobs
created manually to be created/executed under the admin account. Jobs
created automatically use the credentials stored in the backup.osrc file
noted above.
</para>
<screen>source ~/service.osrc</screen>
<screen> {
"job_actions": [
{
"freezer_action": {
"action": "backup",
"mode": "fs",
"backup_name": "backup1",
"path_to_backup": "/home/user/tmp",
"container": "tmp_backups"
},
"max_retries": 3,
"max_retries_interval": 60
}
],
"job_schedule": {
"schedule_interval": "24 hours"
},
"description": "backup for tmp dir"
}
</screen>
</step>
<step>
<para>
Upload it into the api using the correct client_id:
</para>
<screen>&prompt.ardana;freezer job-create -C <replaceable>CLIENT-ID</replaceable> --file <replaceable>FREEZER-FILE</replaceable></screen>
<note>
<para>
Freezer file examples can be found in
<xref linkend="idg-all-bura-freezer-scheduler-xml-6"/>.
</para>
</note>
</step>
<step>
<para>
The status of the jobs can be checked with:
</para>
<screen>&prompt.ardana;freezer job-list -C <replaceable>CLIENT-ID</replaceable></screen>
</step>
<step>
<para>
If no scheduling information is provided, the job will be executed as soon
as possible so its status will go into a "running" state, then
"completed".
</para>
</step>
</procedure>
<para>
You can find information about the scheduling and backup-execution in
/var/log/freezer/freezer-scheduler.log and /var/log/freezer-api/freezer-api.log, respectively.
</para>
<note>
<para>
Recurring jobs never go into a "completed" state, as they go back into
"scheduled" state.
</para>
</note>
</section>
<section>
<title>Restore from a Different Node</title>
<para>
The scheduler can be used to restore from a different node using the
hostname parameter that you see in the JSON below. Here is an example conf
file.
<!---->
</para>
<screen>{
"job_actions": [
{
"freezer_action": {
"action": "restore",
"restore_abs_path": "/var/lib/mysql",
"hostname": "test_machine_1",
"backup_name": "freezer-db-mysql",
"container": "freezer_backup_devstack_1"
},
"max_retries": 5,
"max_retries_interval": 60,
"mandatory": true
}
],
"description": "mysql test restore"
}</screen>
<para>
Create the job like so:
</para>
<screen>&prompt.ardana;freezer job-create -C <replaceable>CLIENT-ID</replaceable> --file job-restore-mysql.conf</screen>
</section>
<section>
<title>Differential Backup and Restore</title>
<para>
The difference is in the use of the parameter
<literal>always_level: 1</literal>. We also specify a different container,
so it is easier to spot the files created in the Swift container:
</para>
<screen>&prompt.ardana;swift list freezer_backup_devstack_1_alwayslevel</screen>
</section>
<section xml:id="idg-all-bura-freezer-scheduler-xml-6">
<title>Example Backup Job File</title>
<para>
Here is a sample backup file:
</para>
<screen>{
"job_actions": [
{
"freezer_action": {
"mode" : "mysql",
"mysql_conf" : "/etc/mysql/debian.cnf",
"path_to_backup": "/var/lib/mysql/",
"backup_name": "freezer-db-mysql",
"snapshot": true,
"always_level": 1,
"max_priority": true,
"remove_older_than": 90,
"container": "freezer_backup_devstack_1_alwayslevel"
},
"max_retries": 5,
"max_retries_interval": 60,
"mandatory": true
}
],
"job_schedule" : {
},
"description": "mysql backup"
}</screen>
<para>
To create the job:
</para>
<screen>&prompt.ardana;freezer job-create -C client_node_1 --file job-backup.conf</screen>
</section>
<section>
<title>Example Restore Job File</title>
<para>
Here is an example of <filename>job-restore.conf</filename>
</para>
<screen>{
"job_actions": [
{
"freezer_action": {
"action": "restore",
"restore_abs_path": "/var/lib/mysql",
"hostname": "test_machine_1",
"backup_name": "freezer-db-mysql",
"container": "freezer_backup_devstack_1_alwayslevel"
},
"max_retries": 5,
"max_retries_interval": 60,
"mandatory": true
}
],
"description": "mysql test restore"
}</screen>
<para>
To create the job:
</para>
<screen>&prompt.ardana;freezer job-create -C client_node_1 --file job-restore.conf</screen>
</section>
</section>