찾다

 >  Q&A  >  본문

python - pyspider使用redis分布式

在部署pyspider分布式时,尝试连接redis集群
配置项为: "message_queue":"redis://127.0.0.1:6380/db"
在启动时:报如下错误
[E 170221 09:40:39 tornado_fetcher:529] MOVED 12068 127.0.0.1:6380

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pyspider/fetcher/tornado_fetcher.py", line 515, in queue_loop
    if self.outqueue.full():
  File "/usr/lib/python2.6/site-packages/pyspider/message_queue/redis_queue.py", line 50, in full
    if self.maxsize and self.qsize() >= self.maxsize:
  File "/usr/lib/python2.6/site-packages/pyspider/message_queue/redis_queue.py", line 40, in qsize
    self.last_qsize = self.redis.llen(self.name)
  File "/usr/lib/python2.6/site-packages/redis/client.py", line 1219, in llen
    return self.execute_command('LLEN', name)
  File "/usr/lib/python2.6/site-packages/redis/client.py", line 573, in execute_command
    return self.parse_response(connection, command_name, **options)
  File "/usr/lib/python2.6/site-packages/redis/client.py", line 585, in parse_response
    response = connection.read_response()
  File "/usr/lib/python2.6/site-packages/redis/connection.py", line 582, in read_response
    raise response
ResponseError: MOVED 12068 127.0.0.1:6380

经查找,得到:因为redis由单节点变为集群,而python的redis连接包暂时还不支持redis集群连接方式,需要更换连接包(redis-py-cluster)。

在安装完redis-py-cluster之后,依旧报上面的错误。

天蓬老师天蓬老师2781일 전611

모든 응답(1)나는 대답할 것이다

  • 怪我咯

    怪我咯2017-04-18 10:23:53

    redis를 연결하는 데 사용되는 라이브러리는 코드에 작성되어 있으며 설치 후에도 전환되지 않습니다.
    코드를 변경하더라도 API가 호환되는지 확인하세요.

    회신하다
    0
  • 취소회신하다