1osm2pgsql-replication(1)    General Commands Manual   osm2pgsql-replication(1)
2
3
4

NAME

6       osm2pgsql-replication
7

SYNOPSIS

9       osm2pgsql-replication [-h] {init,update,status} ...
10

DESCRIPTION

12       Update  an  osm2pgsql  database  with  changes  from  a OSM replication
13       server.
14
15       This tool initialises the updating process by  looking  at  the  import
16       file
17       or  the newest object in the database. The state is then saved in a ta‐
18       ble
19       in the database. Subsequent runs download newly available data and  ap‐
20       ply
21       it to the database.
22
23       See the help of the 'init' and 'update' command for more information on
24       how to use osm2pgsql-replication.
25

OPTIONS

27   Sub-commands
28       osm2pgsql-replication init
29                  Initialise the replication process.
30
31       osm2pgsql-replication update
32                  Download newly available data and apply it to the database.
33
34       osm2pgsql-replication status
35                  Print  information about the current replication status, op‐
36              tionally as JSON.
37

OPTIONS 'osm2pgsql-replication init'

39       usage: osm2pgsql-replication init [-h] [-q] [-v] [-d DB] [-U NAME]  [-H
40       HOST]
41                                         [-P PORT] [-p PREFIX]
42                                         [--osm-file FILE | --server URL]
43
44       Initialise the replication process.
45
46       There  are  two ways to initialise the replication process: if you have
47       imported
48       from a file that contains replication source information, then the
49       initialisation process can use this and set up replication from there.
50       Use the command '%(prog)s --osm-file <filename>' for this.
51
52       If the file has no replication information or you don't have  the  ini‐
53       tial
54       import file anymore then replication can be set up according to
55       the  data found in the database. It checks the planet_osm_way table for
56       the
57       newest way in the database and then queries the OSM API  when  the  way
58       was
59       created.  The  date  is used as the start date for replication. In this
60       mode
61       the minutely diffs from the OSM servers are used as a source.  You  can
62       change
63       this with the '--server' parameter.
64
65
66
67
68       -q, --quiet
69              Print only error messages
70
71
72       -v, --verbose
73              Increase verboseness of output
74
75
76       -d DB, --database DB
77              Name of PostgreSQL database to connect to or conninfo string
78
79
80       -U NAME, --username NAME
81              PostgreSQL user name
82
83
84       -H HOST, --host HOST
85              Database server host name or socket location
86
87
88       -P PORT, --port PORT
89              Database server port
90
91
92       -p PREFIX, --prefix PREFIX
93              Prefix for table names (default 'planet_osm')
94
95
96       --osm-file FILE
97              Get replication information from the given file.
98
99
100       --server URL
101              Use    replication   server   at   the   given   URL   (default:
102              https://planet.openstreetmap.org/replication/minute)
103
104

OPTIONS 'osm2pgsql-replication update'

106       usage: osm2pgsql-replication update update [options] [--  param  [param
107       ...]]
108
109       Download newly available data and apply it to the database.
110
111       The data is downloaded in chunks of '--max-diff-size' MB. Each chunk is
112       saved in a temporary file and imported with osm2pgsql from there. The
113       temporary  file  is normally deleted afterwards unless you state an ex‐
114       plicit
115       location with '--diff-file'. Once the database is up to date with the
116       replication source, the update process exits with 0.
117
118       Any additional arguments to osm2pgsql need  to  be  given  after  '--'.
119       Database
120       and  the  prefix parameter are handed through to osm2pgsql. They do not
121       need
122       to be repeated. '--append' and '--slim' will always be added as well.
123
124       Use  the  '--post-processing'  parameter  to  execute  a  script  after
125       osm2pgsql has
126       run successfully. If the updates consists of multiple runs because the
127       maximum  size  of  downloaded data was reached, then the script is exe‐
128       cuted
129       each time that osm2pgsql has run. When the post-processing fails, then
130       the entire update run is considered a failure and the  replication  in‐
131       formation
132       is  not  updated. That means that when 'update' is run the next time it
133       will
134       recommence with downloading the diffs again and reapplying them to the
135       database. This is usually safe. The script receives two parameters:
136       the sequence ID and timestamp of the last successful run. The timestamp
137       may be missing in the rare case that the replication service stops  re‐
138       sponding
139       after the updates have been downloaded.
140
141
142       param  Extra parameters to hand in to osm2pgsql.
143
144
145       --diff-file FILE
146              File to save changes before they are applied to osm2pgsql.
147
148
149       --max-diff-size MAX_DIFF_SIZE
150              Maximum data to load in MB (default: 500MB)
151
152
153       --osm2pgsql-cmd OSM2PGSQL_CMD
154              Path to osm2pgsql command (default: osm2pgsql)
155
156
157       --once Run updates only once, even when more data is available.
158
159
160       --post-processing SCRIPT
161              Post-processing script to run after each execution of osm2pgsql.
162
163
164       -q, --quiet
165              Print only error messages
166
167
168       -v, --verbose
169              Increase verboseness of output
170
171
172       -d DB, --database DB
173              Name of PostgreSQL database to connect to or conninfo string
174
175
176       -U NAME, --username NAME
177              PostgreSQL user name
178
179
180       -H HOST, --host HOST
181              Database server host name or socket location
182
183
184       -P PORT, --port PORT
185              Database server port
186
187
188       -p PREFIX, --prefix PREFIX
189              Prefix for table names (default 'planet_osm')
190
191
192

OPTIONS 'osm2pgsql-replication status'

194       usage:  osm2pgsql-replication  status  [-h] [-q] [-v] [-d DB] [-U NAME]
195       [-H HOST]
196                                           [-P PORT] [-p PREFIX] [--json]
197
198       Print information about the current replication status,  optionally  as
199       JSON.
200
201       Sample output:
202
203           2021-08-17    15:20:28    [INFO]:    Using    replication   service
204       'https://planet.openstreetmap.org/replication/minute', which is at  se‐
205       quence 4675115 ( 2021-08-17T13:19:43Z )
206           2021-08-17  15:20:28  [INFO]: Replication server's most recent data
207       is <1 minute old
208           2021-08-17 15:20:28 [INFO]: Local database is 8288 sequences behind
209       the server, i.e. 5 day(s) 20 hour(s) 58 minute(s)
210           2021-08-17  15:20:28 [INFO]: Local database's most recent data is 5
211       day(s) 20 hour(s) 59 minute(s) old
212
213
214       With the '--json' option, the status is printed as a json object.
215
216           {
217             "server": {
218               "base_url":          "https://planet.openstreetmap.org/replica
219       tion/minute",
220               "sequence": 4675116,
221               "timestamp": "2021-08-17T13:20:43Z",
222               "age_sec": 27
223             },
224             "local": {
225               "sequence": 4666827,
226               "timestamp": "2021-08-11T16:21:09Z",
227               "age_sec": 507601
228             },
229             "status": 0
230           }
231
232
233       improperly  set  up  replication.  3 for network issues. If status ≠ 0,
234       then
235       the 'error' key is an error message (as string). 'status'  is  used  as
236       the
237       exit code.
238
239       sequence number, 'timestamp' the time of that, and 'age_sec' the age of
240       the
241       data in seconds.
242
243
244
245
246       --json Output status as json.
247
248
249       -q, --quiet
250              Print only error messages
251
252
253       -v, --verbose
254              Increase verboseness of output
255
256
257       -d DB, --database DB
258              Name of PostgreSQL database to connect to or conninfo string
259
260
261       -U NAME, --username NAME
262              PostgreSQL user name
263
264
265       -H HOST, --host HOST
266              Database server host name or socket location
267
268
269       -P PORT, --port PORT
270              Database server port
271
272
273       -p PREFIX, --prefix PREFIX
274              Prefix for table names (default 'planet_osm')
275
276

DISTRIBUTION

278       The latest version of  osm2pgsql-replication  may  be  downloaded  from
279       ⟨osm2pgsql.org⟩
280
281
282
283                                    Manual            osm2pgsql-replication(1)
Impressum