当前位置:网站首页>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 一开始就是一个向编写各种系统开放的 平台
边栏推荐
- UML旅游管理系统「建议收藏」
- 嗨 FUN 一夏,与 StarRocks 一起玩转 SQL Planner!
- How to solve the keyboard key failure of notebook computer
- Origin2018 installation and use (sorting)
- 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
- Go 语言源码级调试器 Delve
- Advantages, values and risks of chain games compared with traditional games
- Problèmes rencontrés dans le développement de la GI pour maintenir le rythme cardiaque en vie
- [nodemon] app crashed - waiting for file changes before starting...解决方法
- UML tourism management system "suggestions collection"
猜你喜欢
[JetsonNano] [教程] [入门系列] [三] 搭建TensorFlow环境
VMware virtual machine failed during startup: VMware Workstation is incompatible with hyper-v
独家消息:阿里云悄然推出RPA云电脑,已与多家RPA厂商开放合作
How to use MySQL language for row and column devices?
[SQL statement] Why do you select two Shanghai and query different counts here? I want it to become a Shanghai, and count only displays a sum
How to cancel automatic search and install device drivers for laptops
Today, at 14:00, 15 ICLR speakers from Hong Kong University, Beihang, Yale, Tsinghua University, Canada, etc. continue!
Guide for high-end programmers to fish at work
VMware 虚拟机启动时出现故障:VMware Workstation 与 Hyper-v 不兼容...
Tutorial on the principle and application of database system (002) -- MySQL installation and configuration: MySQL software uninstallation (Windows Environment)
随机推荐
怎麼用MySQL語言進行行列裝置?
SQLServer查询: a.id与b.id相同时,a.id对应的a.p在b.id对应的b.p里找不到的话,就显示出这个a.id和a.p
FPN网络详解
Germany if was crowned with many awards. How strong is this pair of headphones? In depth evaluation of yinpo GTW 270 hybrid
博睿数据一体化智能可观测平台入选中国信通院2022年“云原生产品名录”
[daily question] 1175 Prime permutation
毕业后5年,我成为了年薪30w+的测试开发工程师
How to repair the laptop that cannot connect to the wireless network
免费抽奖 | 《阿巴豆》探索未来系列盲盒数字版权作品全网首发!
[observation] where is the consulting going in the digital age? Thoughts and actions of softcom consulting
Template engine velocity Foundation
Borui data integrated intelligent observable platform was selected into the "Yunyuan production catalogue" of China Academy of communications in 2022
How to use F1 to F12 correctly on laptop keyboard
Tutorial on the principle and application of database system (001) -- MySQL installation and configuration: installation of MySQL software (Windows Environment)
数据库系统原理与应用教程(001)—— MySQL 安装与配置:MySQL 软件的安装(windows 环境)
Comprehensively view the value of enterprise digital transformation
Chinese diosgenin market forecast and investment strategy report (2022 Edition)
Problèmes rencontrés dans le développement de la GI pour maintenir le rythme cardiaque en vie
Red team Chapter 8: blind guess the difficult utilization process of the package to upload vulnerabilities
Installation and use of sqoop