我正在尝试使用 Docker 设置 OSRM 后端服务器。主机是配备 32GB RAM、运行 OS 10.14 (Mojave) 的 MacBook Pro。
下载了 england-latest.osm.pbf 文件后,我尝试使用以下命令启动该过程。
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/england-latest.osm.pbf
Run Code Online (Sandbox Code Playgroud)
输出如下:
[info] Parsed 0 location-dependent features with 0 GeoJSON polygons
[info] Using script /opt/car.lua
[info] Input file: england-latest.osm.pbf
[info] Profile: car.lua
[info] Threads: 6
[info] Parsing in progress..
[info] input file generated by osmium/1.8.0
[info] timestamp: 2018-11-02T21:15:02Z
[info] Using profile api version 4
[info] Found 3 turn restriction tags:
[info] motorcar
[info] motor_vehicle
[info] vehicle
[info] Parse relations ...
[info] Parse ways and nodes ...
[info] Using profile api version 4
[info] Using profile api version 4
[info] Using profile api version 4
[info] Using profile api version 4
[info] Using profile api version 4
Run Code Online (Sandbox Code Playgroud)
在这一点上,该过程默默地失败并且不会写入您期望的任何文件。如果我使用greater-london-latest.osm.pbf 文件,那么一切正常,所以我猜这是某种内存限制。我如何去识别问题并解决它?
小智 5
在我的 Mac 上遇到同样的问题后,我通过增加 Docker 的可用内存来解决它。在菜单栏上查找鲸鱼图标,单击然后选择首选项 > 高级。将滑块更改为更高的值,按“应用并重新启动”,然后再次尝试运行。
https://docs.docker.com/docker-for-mac/#memory
我可以在 2GB 默认限制内运行 415MB 文件(加拿大 > 不列颠哥伦比亚省),但不能更大。鉴于 England 文件为 422MB,您可能可以增加到 4GB 并使其正常工作。(尝试在整个加拿大运行 2.4GB 文件,需要 >8GB RAM。)