python - pyspider使用redis分布式
問(wèn)題描述
在部署pyspider分布式時(shí),嘗試連接redis集群配置項(xiàng)為: 'message_queue':'redis://127.0.0.1:6380/db'在啟動(dòng)時(shí):報(bào)如下錯(cuò)誤[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 responseResponseError: MOVED 12068 127.0.0.1:6380
經(jīng)查找,得到:因?yàn)閞edis由單節(jié)點(diǎn)變?yōu)榧海鴓ython的redis連接包暫時(shí)還不支持redis集群連接方式,需要更換連接包(redis-py-cluster)。
在安裝完redis-py-cluster之后,依舊報(bào)上面的錯(cuò)誤。
問(wèn)題解答
回答1:鏈接 redis 使用的庫(kù)是寫在代碼里面的,不是你安裝了就會(huì)切換的。就算你要改代碼,也要確認(rèn) API 是兼容的。
相關(guān)文章:
1. boot2docker無(wú)法啟動(dòng)2. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””3. docker-compose中volumes的問(wèn)題4. nignx - docker內(nèi)nginx 80端口被占用5. docker網(wǎng)絡(luò)端口映射,沒(méi)有方便點(diǎn)的操作方法么?6. docker安裝后出現(xiàn)Cannot connect to the Docker daemon.7. java - SSH框架中寫分頁(yè)時(shí)service層中不能注入分頁(yè)類8. javascript - mock.js可以存儲(chǔ)數(shù)據(jù)嗎9. node.js - antdesign怎么集合react-redux對(duì)input控件進(jìn)行初始化賦值10. java - Spring事務(wù)回滾問(wèn)題

網(wǎng)公網(wǎng)安備