scrapy-cluster:socket.error:[Errno 98]地址已被使用
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scrapy-cluster:socket.error:[Errno 98]地址已被使用相关的知识,希望对你有一定的参考价值。
我试图在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
我该如何使用另一个端口。
答案
您可以使用sudo netstat -nlp | grep :5343
检查哪个进程正在使用该端口
然后使用其PID kill -9 <pid>
终止该进程
另一答案
转到rest cluster中的localsettings.py并更改FLASK端口
不确定为什么群集开始时端口5343已经被python使用并且无法杀死
问候
以上是关于scrapy-cluster:socket.error:[Errno 98]地址已被使用的主要内容,如果未能解决你的问题,请参考以下文章