MENU

标签 Redis 下的文章

Redis5之stream数据结构

redis中stream数据结构用于实现消息队列,当然之前版本也存在有pubsub(发布订阅方式的消息队列),而这个stream的设计引进类似kafka中的消费组

引用来自官方:Consumer groups were initially introduced by the popular messaging system called Kafka (TM). Redis reimplements a similar idea in completely different terms, but the goal is the same: to allow a group of clients to cooperate consuming a different portion of the same stream of messages.

阅读全文

Python与redis数据交互的坑

前言

最近遇到一个将线上的redis数据同步到本地开发环境,想着直接用Python小脚本的方式直接同步就好了。线上是zadd有序集合的数据,习惯性的将平时在shell交互环境方式写。(如下)

# shell交互方式zadd数据
ZADD key score member

# 本次在Python脚本方式写的(错误情况)
online = redis.Redis(host="ip", port="端口")
local = redis.Redis(host="ip", port="端口")
local_pip = local.pipeline()
local_pip.zadd(key, score, member)  // 错误示范

阅读全文