首先安装redis
安装好后将redis.windows.conf中
bind 127.0.0.1 改为 bind 0.0.0.0 #这样修改是为了让其它机器可以访问本机redis protected-mode yes 改为protected-mode no #在redis3.2之后,redis增加了protected-mode,在这个模式下,即使修改掉了bind 127.0.0.1,再访问redisd时候还是报错。
在redis目录下建立redis.6380.conf文件,6380是redis的端口,默认是6379,我这里修改成了6380,在redis.windows.conf也需要修改port 6379为port 6380
port 6380 loglevel notice logfile "D:/Redis/Logs/redis6380_log.txt" appendonly yes appendfilename "appendonly.6380.aof" cluster-enabled yes cluster-config-file nodes.6380.conf cluster-node-timeout 15000 cluster-slave-validity-factor 10 cluster-migration-barrier 1 cluster-require-full-coverage yes
运行 redis-server.exe redis.windows.conf
master 的config.conf配置:
{ "taskdb": "mysql+taskdb://pyspider:[email protected]:3306/taskdb", "projectdb": "mysql+projectdb://pyspider:[email protected]:3306/projectdb", "resultdb": "mysql+resultdb://pyspider:[email protected]:3306/resultdb", "message_queue": "redis://127.0.0.1:6380/db", "phantomjs-proxy": "10.211.55.23:25555", "scheduler": { "xmlrpc-host": "0.0.0.0", "delete-time": 10 }, "webui": { "port": 5000, "username": "", "password": "", "need-auth": false } }
在master上运行:
python run.py -c D:/Work/Python/loni/pyspider/config.json
slave的config.conf配置如下:
{ "taskdb": "mysql+taskdb://pyspider:[email protected]:3306/taskdb", "projectdb": "mysql+projectdb://pyspider:[email protected]:3306/projectdb", "resultdb": "mysql+resultdb://pyspider:[email protected]:3306/resultdb", "message_queue": "redis://192.168.209.128:6380/db", "phantomjs-proxy": "192.168.209.128:25555", "fetcher": { "xmlrpc-host": "192.168.209.128" } }
slave 上运行:
python run.py -c D:/pyspider/config.json fetcher python run.py -c D:/pyspider/config.json start_processor python run.py -c D:/pyspider/config.json start_result_worker
以上方法也是我自己瞎折腾出来的,不能确定一定能成功。
很少写博客,文笔不好,请见谅。