forked from MapComplete/MapComplete
Docs: update and simplify docs
This commit is contained in:
parent
eab010a13e
commit
a077a5ee79
2 changed files with 31 additions and 13 deletions
|
@ -45,9 +45,9 @@ A simple server logging everything it receives
|
|||
Provides geolocation based on
|
||||
|
||||
```
|
||||
git clone https://github.com/pietervdvn/geoip-server
|
||||
git clone https://source.mapcomplete.org/MapComplete/geoip-server.git
|
||||
cd geoip-server
|
||||
mkdir data
|
||||
# Drop the databases from https://lite.ip2location.com/ in the data dir
|
||||
npm run start
|
||||
# Drop the databases from https://lite.ip2location.com/ in the data dir; #IP-COUNTRY-with latitude/longitude; from https://lite.ip2location.com/database/db5-ip-country-region-city-latitude-longitude
|
||||
nohup npm run start >> data/log.txt &
|
||||
```
|
||||
|
|
|
@ -6,20 +6,38 @@ Debian machine (e.g. Ubuntu)
|
|||
|
||||
`apt install osmium-tool docker.io osm2pgsql`
|
||||
|
||||
## Tuning the database
|
||||
|
||||
|
||||
|
||||
## Setting up the SQL-server (only once):
|
||||
|
||||
`sudo docker run --name some-postgis -e POSTGRES_PASSWORD=password -e POSTGRES_USER=user -d -p 5444:5432 -v ~/data/pgsql/:/var/lib/postgresql/data postgis/postgis`
|
||||
|
||||
Increase the max number of connections. osm2pgsql needs connection one per table (and a few more), and since we are making one table per layer in MapComplete, this amounts to a lot.
|
||||
For performance, docker needs a specific config file. See https://osm2pgsql.org/doc/manual.html#tuning-the-postgresql-server
|
||||
|
||||
- Open PGAdmin, open the PGSQL-tool (CLI-button at the top); alternativly:
|
||||
`psql --host=172.17.0.1 --port=5444 --user=user`
|
||||
- Run `show config_file;` to get the config file location (in docker). This is probably
|
||||
`/var/lib/postgresql/data/postgresql.conf`
|
||||
- In a terminal, run `sudo docker exec -i <docker-container-id> bash` (run `sudo docker ps` to get the container id)
|
||||
- `sed -i "s/max_connections = 100/max_connections = 5000/" /var/lib/postgresql/data/postgresql.conf`
|
||||
- Validate with `cat /var/lib/postgresql/data/postgresql.conf | grep "max_connections"`
|
||||
- `sudo docker restart <ID>`
|
||||
A suggested config file is:
|
||||
|
||||
(On HDD, 180GB RAM)
|
||||
|
||||
```
|
||||
max_connections = 5000 # needed for OSM2PGSQL
|
||||
shared_buffers = 2GB
|
||||
work_mem = 200MB
|
||||
maintenance_work_mem = 15GB
|
||||
autovacuum_work_mem = 4GB
|
||||
wal_level = minimal
|
||||
checkpoint_timeout = 120min
|
||||
max_wal_size = 20GB
|
||||
checkpoint_completion_target = 0.9
|
||||
max_wal_senders = 0
|
||||
random_page_cost = 8.0
|
||||
```
|
||||
Save this config file somewhere as "postgresql.conf"
|
||||
|
||||
- Start the docker with: `docker run --name osm-cache-db -e POSTGRES_PASSWORD=password -e POSTGRES_USER=user -d -p 5444:5432 -v ~/data/pgsql/:/var/lib/postgresql/data -v postgresql.conf:/var/lib/postgresql/data/postgresql.conf postgis/postgis`
|
||||
- Now, change the config file. This can easily be done as the config file is mirrored to the host system at:
|
||||
`~/data/pgsql/postgresql.conf`. Overwrite this file with configuration above, e.g. with `cp`
|
||||
- Restart the db: `docker restart osm-cache-db`
|
||||
|
||||
# Seeding the data
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue