--replication option of PgOSM Flex enables
to provide an easy and quick way to keep your OpenStreetMap data refreshed.
--replication mode wraps around the
osm2pgsql. The first time running an import with
mode runs osm2pgsql normally, with
--slim mode and without
After osm2pgsql completes,
osm2pgsql-replication init ... is ran to setup
the DB for updates.
This mode of operation results in larger database as the intermediate osm2pgsql
--slim) must be left in the database (no
Important: The original
--appendoption is now under
--appendoption was removed in PgOSM Flex 0.7.0. See #275 for context.
When using replication you should pin your process to a specific PgOSM Flex version
docker run command. When upgrading to new versions,
be sure to check the release notes for manual upgrade steps for
The release notes for PgOSM Flex 0.6.1 are one example. The notes discussed in the release notes have reference SQL scripts under
WARNING - Due to the ability to configure custom layersets these data-migration scripts need manual review, and possibly manual adjustments for your specific database and process.
The other important change when using replication is to increase Postgres'
See this discussion on osm2pgsql
for why this is necessary.
If using the Docker-internal Postgres instance this is done with
docker run command. External database connections must update this
in the appropriate
docker run --name pgosm -d --rm \
-v ~/pgosm-data:/app/output \
-v /etc/localtime:/etc/localtime:ro \
-e POSTGRES_PASSWORD=$POSTGRES_PASSWORD \
-p 5433:5432 \
-d rustprooflabs/pgosm-flex:0.10.0 \
docker exec step with
docker exec -it \
pgosm python3 docker/pgosm_flex.py \
Running the above command a second time will detect that the target database
osm2pgsql-replication setup and load data via the defined replication
Replication with PgOSM Flex is limited to one data source per database.
While it is possible to load multiple regions,
each into their own schema
--schema-name, replication via osm2pgsql-replication only supports
a single source. See this issue
for details. Possibly this ability will be supported in the future.