File: pg_staging.5

package info (click to toggle)
pgstaging 0.11-1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 436 kB
  • ctags: 223
  • sloc: python: 2,180; sh: 169; makefile: 93; sql: 82
file content (318 lines) | stat: -rw-r--r-- 6,273 bytes parent folder | download
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
'\" t
.\"     Title: pg_staging
.\"    Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\"      Date: 11/24/2009
.\"    Manual: [FIXME: manual]
.\"    Source: [FIXME: source]
.\"  Language: English
.\"
.TH "PG_STAGING" "5" "11/24/2009" "[FIXME: source]" "[FIXME: manual]"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
pg_staging \- Prepare a staging environment from http accessible backups
.SH "SYNOPSIS"
.sp
.nf
[GLOBAL]
[database_name\&.env]
.fi
.SH "DESCRIPTION"
.sp
Configuration file is a \&.ini containing several sections: first a GLOBAL section containing common options to the following sections, then a section per target database\&.
.SH "SECTIONS"
.sp
The [DEFAULT] section allows to provide default values for any setting describe here, that you can override in any of the specific sections\&.
.sp
Each specific section represent a target database to restore\&. The options will allow to say from which backup and on which host\&. The host knob is used in commands such as pg_restore, scp and ssh, so can be either an ip address or a hostname (resolv\&.conf applies)\&.
.SH "OPTIONS"
.PP
backup_host
.RS 4
Which host to connect to to fetch the backup file\&.
HTTP
only\&.
.RE
.PP
backup_base_url
.RS 4
Path leading to the backup for the section\(cqs database\&. The database dump file will get expanded to
dbname\&.date \-I\&.dump, this is not (yet?) configurable as of version
0\&.5\&.
.RE
.PP
dumpall_url
.RS 4
Path to the cluster
pg_dumpall \-g
accompanying file, e\&.g\&.
8\&.2\-main\&.globals\&.sql\&.
.RE
.PP
host
.RS 4
Target where to restore the dump file and manage
pgbouncer
setup\&.
.RE
.PP
dbname
.RS 4
Database name, will get appended by the backup date to form a
dbname_YYYYMMDD
name\&.
.RE
.PP
dbowner
.RS 4
Owner of the database to get restored\&.
.RE
.PP
dbuser
.RS 4
Maintenance database role used in the connections to create or drop databases\&.
.RE
.PP
maintdb
.RS 4
Maintenance database to connect to, usually
postgres\&.
.RE
.PP
db_encoding
.RS 4
Database encoding to use in the following statement:
.sp
.if n \{\
.RS 4
.\}
.nf
CREATE DATABASE \&.\&.\&. WITH OWNER "\&.\&.\&." ENCODING \'\&.\&.\&.\';
.fi
.if n \{\
.RE
.\}
.RE
.PP
postgres_port
.RS 4
PostgreSQL port to use in
pgbouncer
configuration file\&.
.RE
.PP
postgres_major
.RS 4
Major version of
postgresql, allows to choose the
pg_restore
binary with the default settings\&.
.RE
.PP
pgbouncer_port
.RS 4

pgbouncer
port to connect to, used for all
pg_staging
operations\&.
.RE
.PP
pgbouncer_conf
.RS 4
Configuration file name for
pgbouncer, e\&.g\&. +/etc/pgbouncer/pgbouncer\&.ini/
.RE
.PP
remove_dump
.RS 4
boolean (True
or
False) to control if
pg_staging
removes the dump file after restore\&.
.RE
.PP
keep_bases
.RS 4
How many databases to keep arround,
pg_staging
drops less recent databases\&. Not Yet Implemented as of
0\&.5\&.
.RE
.PP
auto_switch
.RS 4
boolean to control if
pg_staging
switches
pgbouncer
configuration at restore time
.RE
.PP
use_sudo
.RS 4
boolean, used when invoking
staging\-client\&.sh
.RE
.PP
pg_restore
.RS 4
/usr/lib/postgresql/%(postgres_major)s/bin/pg_restore
.RE
.PP
pg_restore_st
.RS 4
boolean, use
\-\-single\-statement
option (\-1) in
pg_restore\&.
.RE
.PP
restore_vacuum
.RS 4
boolean, when true the
restore
command will
VACUUM ANALYZE
the database\&.
.RE
.PP
restore_jobs
.RS 4
Number of working process to use at the same time while restoring\&. Will set the
\-j
option to
pg_restore
and will not check for you that you\(cqre using a
pg_restore
client version
8\&.4
or newer\&.
.RE
.PP
replication
.RS 4
configuration filename where to setup the replication options\&.
.RE
.PP
tmpdir
.RS 4
Directory where to fetch backup files, defaults to
/tmp\&. Command line argument
\-t
will override
\&.ini
setting\&.
.RE
.PP
sql_path
.RS 4
Directory where to dispose
SQL
files to be sourced with the
psql
utility, in alphabetical order\&. This directory may contain a
pre
and a
post
subdirectories containing files following the shell
*\&.sql
global pattern\&. No subdirectory of
pre
and
post
will get walked into\&. The name of the section using the files will always get expanded to the given
sql_path\&.
.RE
.PP
schemas
.RS 4
List of schema (comma separated) to restore\&. If present, any schema not listed here nor in
schemas_nodata
will get filtered out from the
pg_restore
catalog\&.
.RE
.PP
search_path
.RS 4
List of schemas (comma separated) to add to the database
search_path, using the
SQL
command +ALTER DATABASE self\&.dbname SET search_path TO +\&.
.RE
.PP
schemas_nodata
.RS 4
List of schema (comma separated) to restore without content\&. The
pg_restore
catalog
TABLE DATA
sections will get filtered out\&.
.RE
.SH "EXAMPLE"
.sp
.if n \{\
.RS 4
.\}
.nf
[DEFAULT]
 backup_host     = backup1\&.backbone
 dbuser          = postgres
 maintdb         = postgres
 postgres_port   = 5432
 postgres_major  = 8\&.3
 pgbouncer_port  = 6432
 pgbouncer_conf  = /etc/pgbouncer/pgbouncer\&.ini
 remove_dump     = True
 keep_bases      = 2
 auto_switch     = True
 use_sudo        = True
 pg_restore      = /usr/lib/postgresql/%(postgres_major)s/bin/pg_restore
 pg_restore_st   = True
 restore_vacuum  = True
 restore_jobs    = 1
 replication     = replication\&.ini
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
[allopass_db\&.dev]
 backup_base_url = /PostgreSQL/allopass_db/nightly/
 dumpall_url     = /PostgreSQL/clusters/bdd\&.allopass/8\&.2\-main\&.globals\&.sql
 host            = bdd\&.allopass\&.dev
 postgres_major  = 8\&.2
 dbname          = allopass_db
 dbowner         = root
 schemas         = public, payment, utils, jdb
.fi
.if n \{\
.RE
.\}
.SH "SEE ALSO"
.sp
pg_staging(1)
.SH "AUTHOR"
.sp
pg_staging is written by Dimitri Fontaine <\m[blue]\fBdim@tapoueh\&.org\fR\m[]\&\s-2\u[1]\d\s+2>\&.
.SH "NOTES"
.IP " 1." 4
dim@tapoueh.org
.RS 4
\%mailto:dim@tapoueh.org
.RE