2017-08-02 70 views
0

我在AWS Ubuntu服务器上设置了scrapy和scrapy-splash。它在一段时间内工作正常,但几个小时后,我会开始得到这样的错误消息;Scrapy + Splash(Docker)问题

Traceback (most recent call last): 
    File "/home/ubuntu/.local/lib/python3.5/site- 
packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks 
result = result.throwExceptionIntoGenerator(g) 
    File "/home/ubuntu/.local/lib/python3.5/site- 
packages/twisted/python/failure.py", line 393, in throwExceptionIntoGe 
nerator 
    return g.throw(self.type, self.value, self.tb) 
    File "/home/ubuntu/.local/lib/python3.5/site- 
packages/scrapy/core/downloader/middleware.py", line 43, in process_re 
quest 
defer.returnValue((yield download_func(request=request,spider=spider))) 
twisted.internet.error.ConnectionRefusedError: Connection was refused by 
other side: 111: Connection refused. 

我会发现docker中的splash进程已终止或无响应。

我一直在运行着飞溅过程;

sudo docker run -p 8050:8050 scrapinghub/splash 

根据scrapy-splash说明。

我试着在tmux shell中启动进程以确保ssh连接不会干扰splah进程,但没有运气。

想法?

回答

1

您应该运行容器--restart-d选项。请参阅documentation如何在生产中运行Splash。

+0

谢谢。我自己偶然发现了这个想法,用Google搜索,但这是一个很好的资源。我只是为下一个人添加......你可以看到为什么你的docker进程因'docker ps -a'失败了,并且注意退出代码137似乎与内存过度使用有关。而@Tomas建议的是当docker automaticalky由于缺乏内存而失败时重启该进程。 – Ike