我正在尝试使用mapnik和mod_tile运行一个tile服务器。现在,我能够从(缩放,x,y)请求生成元数据,但我不明白为什么瓷砖从未真正服务过(如png)。原因似乎是以下错误:无法读取FD 4上的cmd
我已经检查过metatile对应于我使用这个工具的问题,一切看起来都很好。
以防万一,以下是调试/信息方面的内容:
$ sudo -u postgres renderd -f -c /usr/local/etc/renderd.conf
renderd[16811] <Info>: config renderd: unix socketname=/var/run/renderd/renderd.sock
renderd[16811] <Info>: config renderd: num_threads=4
renderd[16811] <Info>: config renderd: num_slaves=0
renderd[16811] <Info>: config renderd: tile_dir=/var/lib/mod_tile
renderd[16811] <Info>: config renderd: stats_file=/var/run/renderd/renderd.stats
renderd[16811] <Info>: config mapnik: plugins_dir=/usr/local/lib/mapnik/input
renderd[16811] <Info>: config mapnik: font_dir=/usr/local/lib/mapnik/fonts
renderd[16811] <Info>: config mapnik: font_dir_recurse=1
renderd[16811] <Info>: config renderd(0): Active
renderd[16811] <Info>: config renderd(0): unix socketname=/var/run/renderd/renderd.sock
renderd[16811] <Info>: config renderd(0): num_threads=4
renderd[16811] <Info>: config renderd(0): tile_dir=/var/lib/mod_tile
renderd[16811] <Info>: config renderd(0): stats_file=/var/run/renderd/renderd.stats
renderd[16811] <Info>: config map 0: name(default) file(openstreetmap-carto/mapnik.xml) uri(/osm_tiles/) htcp() host(localhost)
renderd[16811] <Info>: Initialising unix server socket on /var/run/renderd/renderd.sock
renderd[16811] <Debug>: Created server socket 3
renderd[16811] <Info>: Renderd is using mapnik version 3.0.13
...
...
Running in foreground mode...
renderd[16811] <Debug>: Starting stats thread
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
renderd[16811] <Info>: Loading parameterization function for
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
renderd[16811] <Info>: Loading parameterization function for
renderd[16811] <Info>: Loading parameterization function for
renderd[16811] <Info>: Loading parameterization function for
Mapnik LOG> 2017-06-10 04:07:37: warning: unable to find face-name 'unifont Medium' in FontSet 'fontset-0'
这个特定的字体无法加载,但我非常确定它只是我的mapnik.xml文件中的副本(它带有一个上部和下部的&#39; u&#39;)。启动渲染守护程序后的最终输出是(4次):
Jun 10 04:07:39 renderd[16811] <Debug>: Using web Mercator projection settings
然后我只是清理所有内容并重新启动apache:
$ rm -rf /var/lib/mod_tile/default/*
$ sudo bash -c 'echo -e "\c" > /var/log/apache2/error-mode_tile.log'
$ sudo apachectl -k restart
最后,我尝试加载一个特定的磁贴,使用我的本地地址说tile(8,251,160):localhost / osm_tiles / 8/251 / 160.png。渲染守护程序提供以下调试输出:
renderd[17950] <Debug>: DEBUG: Got incoming connection, fd 4, number 1
renderd[17950] <Debug>: DEBUG: Got incoming request with protocol version 2
renderd[17950] <Debug>: DEBUG: Got command RenderPrio fd(4) xml(default), z(8), x(251), y(160), mime(image/png), options()
renderd[17950] <Debug>: DEBUG: START TILE default 8 248-255 160-167, new metatile
renderd[17950] <Debug>: Rendering projected coordinates 8 248 160 -> 18785164.071375|-6261721.357125 20037508.342800|-5009377.085700 to a 8 x 8 tile
renderd[17950] <Debug>: DEBUG: DONE TILE default 8 248-255 160-167 in 6.177 seconds
debug: Creating and writing a metatile to /var/lib/mod_tile/default/8/0/0/0/250/128.meta
renderd[17950] <Debug>: DEBUG: Sending render cmd(3 default 8/251/160) with protocol version 2 to fd 4
renderd[17950] <Info>: DEBUG: Failed to read cmd on fd 4
renderd[17950] <Debug>: DEBUG: Connection 0, fd 4 closed, now 0 left
问题出现在哪里&#34;无法读取fd 4&#34;上的cmd,我试图在线查找,但无法找到明确的答案。这是相应的apache跟踪:
[core:trace5] [pid 18636] protocol.c(643): [client ::1:56548] Request received from client: GET /osm_tiles/8/251/160.png HTTP/1.1
...
[tile:debug] [pid 18636] ./src/mod_tile.c(1306): [client ::1:56548] tile_translate: testing baseuri(/osm_tiles/) name(default) extension(png)
[tile:debug] [pid 18636] ./src/mod_tile.c(1352): [client ::1:56548] tile_translate: request for default was 251 160 256
[tile:debug] [pid 18636] ./src/mod_tile.c(324): [client ::1:56548] get_storage_backend: Retrieving storage back end for tile layer 0 in pool 7fb684031628 and thread -1075362880
[tile:debug] [pid 18636] ./src/mod_tile.c(338): [client ::1:56548] get_storage_backend: No storage backends for this lifecycle 7fb684031628, creating it in thread -1075362880
[tile:debug] [pid 18636] ./src/mod_tile.c(353): [client ::1:56548] get_storage_backend: No storage backend in current lifecycle 7fb684031628 in thread -1075362880 for current tile layer 0
[tile:debug] [pid 18636] ./src/mod_tile.c(1391): [client ::1:56548] tile_translate: op(tile_serve) xml(default) mime(image/png) z(8) x(251) y(160)
[tile:info] [pid 18636] [client ::1:56548] tile_storage_hook: handler(tile_serve), uri(/osm_tiles/8/251/160.png)
[tile:debug] [pid 18636] ./src/mod_tile.c(374): [client ::1:56548] tile_state: determined state of default 251 160 8 on store 7fb683502f90: Tile size: 317572, expired: 0 created: 1497065892
[tile:debug] [pid 18335] ./src/mod_tile.c(176): [client ::1:56547] Connecting to renderd on Unix socket /var/run/renderd/renderd.sock
[tile:info] [pid 18335] [client ::1:56547] Requesting style(default) z(8) x(251) y(160) from renderer with priority 5
[authz_core:debug] [pid 18636] mod_authz_core.c(834): [client ::1:56548] AH01628: authorization result: granted (no directives)
[core:trace3] [pid 18636] request.c(296): [client ::1:56548] request authorized without authentication by access_checker_ex hook: /osm_tiles/8/251/160.png
然后它结束了,没有其他事情发生。我真的不太了解这一点,所以欢迎提出任何建议。如果它有帮助我也可以给我的配置文件。
答案 0 :(得分:1)
以防有人碰巧遇到保存问题。问题来自apache(mod_hfs_apple.so)默认加载的apple模块。为了解决这个问题,我只需进入/etc/apache2/httpd.conf并注释以下行:
LoadModule hfs_apple_module libexec/apache2/mod_hfs_apple.so
这个黑客对我来说不是很满意,目标是纠正mod_tile。看起来需要修复的部分位于mod_tile.c:1643:
static void register_hooks(__attribute__((unused)) apr_pool_t *p)
{
...
ap_hook_translate_name(tile_translate, NULL, NULL, APR_HOOK_MIDDLE);
...
}
现在我没有勇气找到真正的解决方案,只是快速查看我发现这个奇怪的行可能会导致任何人(例如,mod_hfs_apple)尝试读取请求时出现问题。在mod_tile.c中:1278:
static int tile_translate(request_rec *r)
{
...
r->filename = NULL;
...
}
答案 1 :(得分:0)
“无法读取fd上的cmd”消息实际上并不是一个错误,它实际上只是一些调试日志记录。有关引入它的更改的详细信息,请参阅https://github.com/openstreetmap/mod_tile/issues/77的顶部。如果您只是想“看不到那条消息”,那么我从那里分配的版本(对于其他一些更改)https://github.com/SomeoneElseOSM/mod_tile可能会有用,因为我在那里删除了那条消息。
然而,这不会解决你的根本问题(获得一个正常工作的磁贴服务器) - 为此我建议找到一个“喝汤坚果”的MacOS安装指南,或者开始,这样你就可以理解事物融合在一起,是Ubuntu VM中的磁贴服务器。