【问题标题】:Scrapy Splash server not starting via docker runScrapy Splash 服务器未通过 docker run 启动
【发布时间】:2016-09-03 07:57:43
【问题描述】:

按照 alexce 的说明 here 安装 docker、scrapyjs 和 splash。

然后,运行docker run -p 8050:8050 scrapinghub/splash,我得到这个输出:

2016-05-08 17:17:45+0000 [-] Log opened.
2016-05-08 17:17:45.978866 [-] Splash version: 2.1
2016-05-08 17:17:45.979553 [-] Qt 5.5.1, PyQt 5.5.1, WebKit 538.1, sip 4.17, Twisted 16.1.1, Lua 5.2
2016-05-08 17:17:45.980138 [-] Python 3.4.3 (default, Oct 14 2015, 20:28:29) [GCC 4.8.4]
2016-05-08 17:17:45.980401 [-] Open files limit: 1048576
2016-05-08 17:17:45.981020 [-] Can't bump open files limit
2016-05-08 17:17:46.086232 [-] Xvfb is started: ['Xvfb', ':1', '-screen', '0', '1024x768x24']
2016-05-08 17:17:46.161902 [-] proxy profiles support is enabled, proxy profiles path: /etc/splash/proxy-profiles
2016-05-08 17:17:46.260357 [-] verbosity=1
2016-05-08 17:17:46.260607 [-] slots=50
2016-05-08 17:17:46.261170 [-] argument_cache_max_entries=500
2016-05-08 17:17:46.262476 [-] Web UI: enabled, Lua: enabled (sandbox: enabled)
2016-05-08 17:17:46.264565 [-] Site starting on 8050
2016-05-08 17:17:46.265203 [-] Starting factory <twisted.web.server.Site object at 0x7f270ec81e10>

它挂在那里。我尝试根据指令here 进行故障排除(重新安装 docker,验证 vm 是否正在运行,重新生成证书,设置环境),但仍然没有。

My settings fileSpider

当在yield scrapy.Request' call withinstart_requests`中没有meta=参数运行蜘蛛时,蜘蛛运行良好(除了没有捕获动态字段),所以我不确定这是docker的问题还是飞溅。

提前致谢。

【问题讨论】:

    标签: python docker scrapy


    【解决方案1】:

    当使用 Docker 运行 Splash 时,控制台一开始确实会“挂在那里”。 Splash 正在通过其端点之一等待请求。

    $ sudo docker run -p 8050:8050 scrapinghub/splash
    2016-05-09 10:21:42+0000 [-] Log opened.
    2016-05-09 10:21:42.773541 [-] Splash version: 2.1
    2016-05-09 10:21:42.774298 [-] Qt 5.5.1, PyQt 5.5.1, WebKit 538.1, sip 4.17, Twisted 16.1.1, Lua 5.2
    2016-05-09 10:21:42.774453 [-] Python 3.4.3 (default, Oct 14 2015, 20:28:29) [GCC 4.8.4]
    2016-05-09 10:21:42.774632 [-] Open files limit: 1048576
    2016-05-09 10:21:42.774842 [-] Can't bump open files limit
    2016-05-09 10:21:42.879868 [-] Xvfb is started: ['Xvfb', ':1', '-screen', '0', '1024x768x24']
    2016-05-09 10:21:43.072351 [-] proxy profiles support is enabled, proxy profiles path: /etc/splash/proxy-profiles
    2016-05-09 10:21:43.214478 [-] verbosity=1
    2016-05-09 10:21:43.214617 [-] slots=50
    2016-05-09 10:21:43.214703 [-] argument_cache_max_entries=500
    2016-05-09 10:21:43.215195 [-] Web UI: enabled, Lua: enabled (sandbox: enabled)
    2016-05-09 10:21:43.217494 [-] Site starting on 8050
    2016-05-09 10:21:43.217635 [-] Starting factory <twisted.web.server.Site object at 0x7f529d0fee48>
    

    要测试 Splash 是否正常运行,请在 http://localhost:8050/ 尝试其 Web UI

    您应该会看到如下内容:

    然后您可以尝试输入一些 URL 并单击“渲染我!”

    【讨论】:

    • 再次感谢-我已经做到了这一点,但是当我转到本地主机时,它说无法访问-本地主机拒绝连接。有什么建议吗?
    • 如我所说,如果我能看到settings.py 可能会更容易
    • settings.py 与 Splash 服务器无关。我不知道是什么原因导致在端口 8050 上与 localhost 的连接被拒绝。您在该端口上运行了其他东西吗?
    • 不,我做了lsof -i | grep LISTEN,但 8050 没有被列为正在使用。由于我在 Mac 上,我们的系统管理员说我可能需要双重暴露端口(在 vm 和我的机器上).. 对此有什么建议吗?抱歉打扰了,但我注意到你为 scrapinghub 工作。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-10
    • 2023-03-09
    • 1970-01-01
    • 1970-01-01
    • 2018-08-23
    • 1970-01-01
    相关资源
    最近更新 更多