当前位置:网站首页>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 一开始就是一个向编写各种系统开放的 平台
边栏推荐
- 【Hot100】19. Delete the penultimate node of the linked list
- 圈铁发音,动感与无噪强强出彩,魔浪HIFIair蓝牙耳机测评
- 【Hot100】20. Valid parentheses
- The supply of chips has turned to excess, and the daily output of Chinese chips has increased to 1billion, which will make it more difficult for foreign chips
- Apple's self-developed baseband chip failed again, which shows Huawei Hisilicon's technological leadership
- China nylon 11 industry research and future forecast report (2022 Edition)
- 数据库系统原理与应用教程(002)—— MySQL 安装与配置:MySQL 软件的卸载(windows 环境)
- 数据库系统原理与应用教程(001)—— MySQL 安装与配置:MySQL 软件的安装(windows 环境)
- [observation] where is the consulting going in the digital age? Thoughts and actions of softcom consulting
- Zabbix2.2 monitoring system and application log monitoring alarm
猜你喜欢

Template engine velocity Foundation

Principes et applications du système de base de données (006) - - compilation et installation de MySQL 5.7 (environnement Linux)

Template Engine Velocity Foundation

程序员职业生涯真的很短吗?
![[JetsonNano] [教程] [入门系列] [三] 搭建TensorFlow环境](/img/0e/52e37527bc717c7a55741725087bad.png)
[JetsonNano] [教程] [入门系列] [三] 搭建TensorFlow环境

How to restore the system of Sony laptop

Kali install Nessus

游戏行业安全选择游戏盾,效果怎么样?

瑞典公布决定排除华为5G设备,但是华为已成功找到新出路

模板引擎Velocity 基礎
随机推荐
I'm a senior test engineer who has been outsourced by Alibaba and now has an annual salary of 40w+. My two-year career changing experience is sad
Kali install Nessus
Motion capture system for apple picking robot
苹果自研基带芯片再次失败,说明了华为海思的技术领先性
Template engine velocity Foundation
How to restore the system with one click on Lenovo laptop
PR basic clip operation / video export operation
德国iF多项大奖加冕,这副耳机有多强?音珀GTW 270 Hybrid深度评测
Principle of motion capture system
嗨 FUN 一夏,与 StarRocks 一起玩转 SQL Planner!
Learn selenium to simulate mouse operation, and you can be lazy a little bit
程序员职业生涯真的很短吗?
Virtual serial port simulator and serial port debugging assistant tutorial "suggestions collection"
游戏行业安全选择游戏盾,效果怎么样?
[nodemon] app crashed - waiting for file changes before starting... resolvent
Template Engine Velocity Foundation
Authentication processing in interface testing framework
The supply of chips has turned to excess, and the daily output of Chinese chips has increased to 1billion, which will make it more difficult for foreign chips
Tutorial on the principle and application of database system (005) -- Yum offline installation of MySQL 5.7 (Linux Environment)
數據庫系統原理與應用教程(006)—— 編譯安裝 MySQL5.7(Linux 環境)