scrapy-cluster:socket.error:[Errno 98]地址已被使用

时间:2017-02-01 03:27:50

标签: python docker scrapy

我正试图在this quick-start.之后运行scrapy-cluster 我收到了以下错误。

# python rest_service.py
2017-02-01 03:02:20,009 [rest-service] INFO: Successfully connected to redis
2017-02-01 03:02:20,011 [rest-service] INFO: Running main flask method on port 5343
2017-02-01 03:02:20,014 [rest-service] INFO: Closing Rest Service
Traceback (most recent call last):
  File "rest_service.py", line 711, in <module>
    rest_service.run()
  File "rest_service.py", line 449, in run
    self.app.run(host='0.0.0.0', port=self.settings['FLASK_PORT'])
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 843, in run
    run_simple(host, port, self, **options)
  File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 694, in run_simple
    inner()
  File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 656, in inner
    fd=fd)
  File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 550, in make_server
    passthrough_errors, ssl_context, fd=fd)
  File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 464, in __init__
    HTTPServer.__init__(self, (host, int(port)), handler)
  File "/usr/local/lib/python2.7/SocketServer.py", line 417, in __init__
    self.server_bind()
  File "/usr/local/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "/usr/local/lib/python2.7/SocketServer.py", line 431, in server_bind
    self.socket.bind(self.server_address)
  File "/usr/local/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use

我应该如何使用其他端口。

2 个答案:

答案 0 :(得分:1)

您可以使用该端口检查正在使用的进程 sudo netstat -nlp | grep :5343

然后使用其PID终止该进程 kill -9 <pid>

答案 1 :(得分:0)

转到其余群集中的localsettings.py并更改FLASK端口

不确定为什么群集以Python已使用的端口5343开始并且无法终止

致谢