当前位置:网站首页>Redis6.0 新功能
Redis6.0 新功能
2022-07-01 16:26:00 【BugMaker-shen】
文章目录
一、ACL访问控制列表
Redis ACL 是 Access Control List(访问控制列表)的缩写,该功能允许根据可以执行的命令和可以访问的键来限制某些连接
在 Redis 5 版本之前,Redis 安全规则只有密码控制 还有通过 rename 来调整高危命令比如 flushdb,KEYS* ,shutdown 等。Redis 6 则提供 ACL 的功能对用户进行更细粒度的权限控制 :
(1)接入权限:用户名和密码
(2)可以执行的命令
(3)可以操作的 KEY
参考官网:https://redis.io/topics/acl
1. 使用 acl list 命令展现用户权限列

2. 使用 acl cat 命令
(1)查看添加权限指令类别

(2)加参数类型名可以查看类型下具体命令

3. 使用 acl whoami 命令查看当前用户

4. 使用 acl setuser 命令创建和编辑用户 ACL
(1)ACL 规则
下面是有效 ACL 规则的列表,某些规则只是用于激活或删除标志,或对用户 ACL 执行给定更改的单个单词。其他规则是字符前缀,它们与命令或类别名称、键模式等连接在一起

(2)通过命令创建新用户默认权限
acl setuser user1

在上面的示例中,我根本没有指定任何规则。如果用户不存在,这将使用 just created 的默认属性来创建用户。如果用户已经存在,则上面的命令将不执行任何操作
(3)设置有用户名、密码、ACL 权限、并启用的用户
acl setuser user2 on >password ~cached:* +get # user2只允许对cached:开头的key进行get操作

(4)切换用户,验证权限
auth 用户 密码

二、IO 多线程
1. 简介
Redis6 终于支撑多线程了,告别单线程了吗?
IO 多线程其实指客户端交互部分的网络 IO 交互处理模块多线程,而非多线程执行命令,Redis6 执行命令依然是单线程
2. 原理架构
Redis 6 加入多线程,但跟 Memcached 这种从 IO 处理到数据访问多线程的实现模式有些差异
Redis 的多线程部分只是用来处理网络数据的读写和协议解析,执行命令仍然是单线程。之所以这么设计是不想因为多线程而变得复杂,需要去控制 key、lua、事务, LPUSH/LPOP 等等的并发问题
整体的设计大体如下:
另外,多线程网络IO 默认也是不开启的,需要再配置文件redis-6379.conf中配置
io-threads-do-reads yes
io-threads 4
三、集群工具支持 Cluster
之前老版本 Redis 想要搭集群需要单独安装 ruby 环境,Redis 5 将 redis-trib.rb 的功能集成到 redis-cli。另外官方 redis-benchmark 工具开始支持 cluster 模式了,通过多线程的方式对多个分片进行压测。

四、Redis6 其他新功能
RESP3 新的 Redis 通信协议:优化服务端与客户端之间通信
Client side caching 客户端缓存:基于 RESP3 协议实现的客户端缓存功能。为 了进一步提升缓存的性能,将客户端经常访问的数据 cache 到客户端。减少 TCP 网络 交互。
Proxy 集群代理模式:Proxy 功能,让 Cluster 拥有像单实例一样的接入方式, 降低大家使用 cluster 的门槛。不过需要注意的是代理不改变 Cluster 的功能限制,不 支持的命令还是不会支持,比如跨 slot 的多 Key 操作。
Modules API Redis 6 中模块 API 开发进展非常大,因为 Redis Labs 为了开发复杂的功能,从一 开始就用上 Redis 模块。Redis 可以变成一个框架,利用 Modules 来构建不同系统,而 不需要从头开始写然后还要 BSD 许可。Redis 一开始就是一个向编写各种系统开放的 平台
边栏推荐
- 【SQL语句】请问这边为什么select出了两个上海,查询出了不同的count我想让他变成一个上海,count只显示一个总和
- Zabbix2.2监控之系统及应用日志监控报警
- Submission lottery - light application server essay solicitation activity (may) award announcement
- Buuctf gold III
- Problems encountered in IM instant messaging development to maintain heartbeat
- P2893 [USACO08FEB] Making the Grade G(dp&优先队列)
- Tutorial on the principle and application of database system (003) -- MySQL installation and configuration: manually configure MySQL (Windows Environment)
- Go 语言源码级调试器 Delve
- PR basic clip operation / video export operation
- 普通二本,去过阿里外包,到现在年薪40W+的高级测试工程师,我的两年转行心酸经历...
猜你喜欢

Rhcsa Road

How to use MySQL language for row and column devices?

数据库系统原理与应用教程(004)—— MySQL 安装与配置:重置 MySQL 登录密码(windows 环境)

Principle of motion capture system

数据库系统原理与应用教程(001)—— MySQL 安装与配置:MySQL 软件的安装(windows 环境)

【观察】数字化时代的咨询往何处走?软通咨询的思与行

Stonedb is building blocks for domestic databases, and the integrated real-time HTAP database based on MySQL is officially open source!

制造业数字化转型究竟是什么

数据库系统原理与应用教程(006)—— 编译安装 MySQL5.7(Linux 环境)
![[jetsonnano] [tutorial] [introductory series] [III] build tensorflow environment](/img/0e/52e37527bc717c7a55741725087bad.png)
[jetsonnano] [tutorial] [introductory series] [III] build tensorflow environment
随机推荐
What is the effect of choosing game shield safely in the game industry?
UML tourism management system "suggestions collection"
芯片供应转向过剩,中国芯片日产增加至10亿,国外芯片将更难受
数据库系统原理与应用教程(005)—— yum 离线安装 MySQL5.7(Linux 环境)
Leetcode 216 combined summation III -- backtracking method
苹果自研基带芯片再次失败,说明了华为海思的技术领先性
程序员职业生涯真的很短吗?
今天14:00 | 港大、北航、耶鲁、清华、加大等15位ICLR一作讲者精彩继续!
模板引擎Velocity 基礎
Hi Fun Summer, play SQL planner with starrocks!
毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?
[observation] where is the consulting going in the digital age? Thoughts and actions of softcom consulting
sql刷题1050. 合作过至少三次的演员和导演
P2592 [zjoi2008] birthday party (DP)
The sharp drop in electricity consumption in Guangdong shows that the substitution of high-tech industries for high-energy consumption industries has achieved preliminary results
How to optimize repeated if err in go language= Nil template code?
瑞典公布决定排除华为5G设备,但是华为已成功找到新出路
Ring iron pronunciation, dynamic and noiseless, strong and brilliant, magic wave hifiair Bluetooth headset evaluation
Bugku's file contains
Principes et applications du système de base de données (006) - - compilation et installation de MySQL 5.7 (environnement Linux)