@@ -68,10 +68,10 @@ the update interval no new data has been published yet, it will go to sleep
68
68
until the next expected update and only then attempt to download the next batch.
69
69
70
70
The one-time mode is particularly useful if you want to run updates continuously
71
- but need to schedule other work in between updates. For example, the main
72
- service at osm.org uses it, to regularly recompute postcodes -- a process that
73
- must not be run while updates are in progress. Its update script
74
- looks like this:
71
+ but need to schedule other work in between updates. For example, you might
72
+ want to regularly recompute postcodes -- a process that
73
+ must not be run while updates are in progress. An update script refreshing
74
+ postcodes regularly might look like this:
75
75
76
76
``` sh
77
77
#! /bin/bash
@@ -109,17 +109,19 @@ Unit=nominatim-updates.service
109
109
WantedBy=multi-user.target
110
110
```
111
111
112
- And then a similar service definition: ` /etc/systemd/system/nominatim-updates.service ` :
112
+ ` OnUnitActiveSec ` defines how often the individual update command is run.
113
+
114
+ Then add a service definition for the timer in ` /etc/systemd/system/nominatim-updates.service ` :
113
115
114
116
```
115
117
[Unit]
116
118
Description=Single updates of Nominatim
117
119
118
120
[Service]
119
- WorkingDirectory=/srv/nominatim
120
- ExecStart=nominatim replication --once
121
- StandardOutput=append:/var/log/nominatim-updates.log
122
- StandardError=append:/var/log/nominatim-updates.error.log
121
+ WorkingDirectory=/srv/nominatim-project
122
+ ExecStart=/srv/nominatim-venv/bin/ nominatim replication --once
123
+ StandardOutput=journald
124
+ StandardError=inherit
123
125
User=nominatim
124
126
Group=nominatim
125
127
Type=simple
@@ -128,9 +130,9 @@ Type=simple
128
130
WantedBy=multi-user.target
129
131
```
130
132
131
- Replace the ` WorkingDirectory ` with your project directory. Also adapt user and
132
- group names as required. ` OnUnitActiveSec ` defines how often the individual
133
- update command is run .
133
+ Replace the ` WorkingDirectory ` with your project directory. ` ExecStart ` points
134
+ to the nominatim binary that was installed in your virtualenv earlier.
135
+ Finally, you might need to adapt user and group names as required .
134
136
135
137
Now activate the service and start the updates:
136
138
@@ -140,12 +142,13 @@ sudo systemctl enable nominatim-updates.timer
140
142
sudo systemctl start nominatim-updates.timer
141
143
```
142
144
143
- You can stop future data updates, while allowing any current, in-progress
145
+ You can stop future data updates while allowing any current, in-progress
144
146
update steps to finish, by running `sudo systemctl stop
145
147
nominatim-updates.timer` and waiting until ` nominatim-updates.service` isn't
146
- running (` sudo systemctl is-active nominatim-updates.service ` ). Current output
147
- from the update can be seen like above (`systemctl status
148
- nominatim-updates.service`).
148
+ running (` sudo systemctl is-active nominatim-updates.service ` ).
149
+
150
+ To check the output from the update process, use journalctl: `journalctl -u
151
+ nominatim-updates.service`
149
152
150
153
151
154
#### Catch-up mode
@@ -155,13 +158,13 @@ all changes from the server until the database is up-to-date. The catch-up mode
155
158
still respects the parameter ` NOMINATIM_REPLICATION_MAX_DIFF ` . It downloads and
156
159
applies the changes in appropriate batches until all is done.
157
160
158
- The catch-up mode is foremost useful to bring the database up to speed after the
161
+ The catch-up mode is foremost useful to bring the database up to date after the
159
162
initial import. Give that the service usually is not in production at this
160
163
point, you can temporarily be a bit more generous with the batch size and
161
164
number of threads you use for the updates by running catch-up like this:
162
165
163
166
```
164
- cd /srv/nominatim
167
+ cd /srv/nominatim-project
165
168
NOMINATIM_REPLICATION_MAX_DIFF=5000 nominatim replication --catch-up --threads 15
166
169
```
167
170
@@ -173,13 +176,13 @@ replication catch-up at whatever interval you desire.
173
176
When running scheduled updates with catch-up, it is a good idea to choose
174
177
a replication source with an update frequency that is an order of magnitude
175
178
lower. For example, if you want to update once a day, use an hourly updated
176
- source. This makes sure that you don't miss an entire day of updates when
179
+ source. This ensures that you don't miss an entire day of updates when
177
180
the source is unexpectedly late to publish its update.
178
181
179
182
If you want to use the source with the same update frequency (e.g. a daily
180
183
updated source with daily updates), use the
181
- continuous update mode. It ensures to re-request the newest update until it
182
- is published.
184
+ once mode together with a frequently run systemd script as described above.
185
+ It ensures to re-request the newest update until they have been published.
183
186
184
187
185
188
#### Continuous updates
@@ -197,36 +200,3 @@ parameters:
197
200
198
201
The update application keeps running forever and retrieves and applies
199
202
new updates from the server as they are published.
200
-
201
- You can run this command as a simple systemd service. Create a service
202
- description like that in ` /etc/systemd/system/nominatim-updates.service ` :
203
-
204
- ```
205
- [Unit]
206
- Description=Continuous updates of Nominatim
207
-
208
- [Service]
209
- WorkingDirectory=/srv/nominatim
210
- ExecStart=nominatim replication
211
- StandardOutput=append:/var/log/nominatim-updates.log
212
- StandardError=append:/var/log/nominatim-updates.error.log
213
- User=nominatim
214
- Group=nominatim
215
- Type=simple
216
-
217
- [Install]
218
- WantedBy=multi-user.target
219
- ```
220
-
221
- Replace the ` WorkingDirectory ` with your project directory. Also adapt user
222
- and group names as required.
223
-
224
- Now activate the service and start the updates:
225
-
226
- ```
227
- sudo systemctl daemon-reload
228
- sudo systemctl enable nominatim-updates
229
- sudo systemctl start nominatim-updates
230
- ```
231
-
232
-
0 commit comments