scrapy-redis让redis不止使用db0

废话不多说,直接在  custom_settings 设置即可

代码:

 1 class MySpider(RedisSpider):
 2     """Spider that reads urls from redis queue (myspider:start_urls)."""
 3     name = 'xxxx'
 4     redis_key = 'xxxx:start_urls'
 5 
 6     # ……
 7     custom_settings = {
 8         'LOG_LEVEL': 'DEBUG',
 9         'DOWNLOAD_DELAY': 0,
10 
11         # 指定redis数据库的连接参数
12         'REDIS_HOST': '192.168.1.99',
13         'REDIS_PORT': 6379,
14 
15         # 指定 redis链接密码,和使用哪一个数据库
16         'REDIS_PARAMS' : {
17             'password': 'redisPasswordTest123456',
18             'db': 2
19         },
20     }
原文地址:https://www.cnblogs.com/ltn26/p/10120250.html