scrapy-redis分布式爬取 读取redis数据库中内容存储到mongo

import json
import pymongo
from redis import StrictRedis

rediscli=StrictRedis(host='192.168.6.223',port=6379,db=0,decode_responses=True)
client=pymongo.MongoClient('mongoip',27017)
db=client.xixian
collention=db.demo

while True:
    source, data = rediscli.blpop(["jincai_data:items"])
    item = json.loads(data)
    collention.insert_one(item)
    print(item)
上一篇:Mongo查询语句


下一篇:docker-mongo添加用户名密码