]> git.openstreetmap.org Git - nominatim.git/blob - docs/admin/Update.md
Put install instructions of test tools into separate docs/ markdown file
[nominatim.git] / docs / admin / Update.md
1 # Updating the Database
2
3 There are many different ways to update your Nominatim database.
4 The following section describes how to keep it up-to-date with Pyosmium.
5 For a list of other methods see the output of `./utils/update.php --help`.
6
7 !!! warning
8     If you have configured a flatnode file for the import, then you
9     need to keep this flatnode file around for updates as well.
10
11 #### Installing the newest version of Pyosmium
12
13 It is recommended to install Pyosmium via pip. Make sure to use python3.
14 Run (as the same user who will later run the updates):
15
16 ```sh
17 pip3 install --user osmium
18 ```
19
20 Nominatim needs a tool called `pyosmium-get-updates` which comes with
21 Pyosmium. You need to tell Nominatim where to find it. Add the
22 following line to your `settings/local.php`:
23
24     @define('CONST_Pyosmium_Binary', '/home/user/.local/bin/pyosmium-get-changes');
25
26 The path above is fine if you used the `--user` parameter with pip.
27 Replace `user` with your user name.
28
29 #### Setting up the update process
30
31 Next the update needs to be initialised. By default Nominatim is configured
32 to update using the global minutely diffs.
33
34 If you want a different update source you will need to add some settings
35 to `settings/local.php`. For example, to use the daily country extracts
36 diffs for Ireland from Geofabrik add the following:
37
38     // base URL of the replication service
39     @define('CONST_Replication_Url', 'https://download.geofabrik.de/europe/ireland-and-northern-ireland-updates');
40     // How often upstream publishes diffs
41     @define('CONST_Replication_Update_Interval', '86400');
42     // How long to sleep if no update found yet
43     @define('CONST_Replication_Recheck_Interval', '900');
44
45 To set up the update process now run the following command:
46
47     ./utils/update.php --init-updates
48
49 It outputs the date where updates will start. Recheck that this date is
50 what you expect.
51
52 The `--init-updates` command needs to be rerun whenever the replication service
53 is changed.
54
55 #### Updating Nominatim
56
57 The following command will keep your database constantly up to date:
58
59     ./utils/update.php --import-osmosis-all
60
61 (Note that even though the old name "import-osmosis-all" has been kept for
62 compatibility reasons, Osmosis is not required to run this - it uses pyosmium
63 behind the scenes.)
64
65 If you have imported multiple country extracts and want to keep them
66 up-to-date, [Advanced installations section](Advanced-Installations.md) contains instructions 
67 to set up and update multiple country extracts.