redis-cli help使用

2024-05-29 12:36
文章标签 使用 redis cli help

本文主要是介绍redis-cli help使用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1. redis-cli命令使用—先连接上服务器

  1. 连接到 Redis 服务器: 使用 redis-cli 命令即可连接到本地运行的 Redis 服务器,默认连接到本地的 6379 端口。
redis-cli

如果 Redis 服务器不在本地或者端口不同,可以使用 -h 和 -p 参数指定主机和端口:

redis-cli -h <hostname> -p <port>
  1. 执行 Redis 命令: 连接成功后,可以直接在命令行中输入各种 Redis 命令来执行对应的操作,比如设置键值对、获取值、操作列表、集合等等。
  2. 交互式模式: 在命令行中输入 redis-cli 后,进入交互式模式,可以一次次地输入命令并查看结果,非常方便进行实时的交互操作。
  3. 执行脚本文件: 可以通过 --eval 参数执行 Lua 脚本文件,例如:
redis-cli --eval script.lua
  1. 其他参数: redis-cli 支持许多其他参数,可以使用 redis-cli --help 查看帮助文档,了解更多用法和选项

2. redis-cli连接到服务器后,可以使用help查看命令

img

根据输出可以看到

help 命令有三种用法

  1. “help @” to get a list of commands in ,
  2. ”help ” for help on ,
  3. ”help ” to get a list of possible help topics

2.1. help

help 之后按 tab 按键可提示参数。在命令行下 tab 按键相信是用的最多的一个按键。

help 空格之后一直按 tab, 可按顺序查看到所有可能的组和命令。也可输入需要查询的 @组或命令的前缀再按 tab 补全。

如:

help @generic 查看通用组的命令包括 del,dump… 等等通用命令。 help @string 查看字符串组命令。还可以查看其他组的命令如

help @list, help @set, help @sorted_set,help @hash 等等,查看所有的分组可以通过 help 提示(即help+空格后,按tab键)

2.2. help @ 查看具体命令组的帮助

img

APPEND key value
summary: Appends a string to the value of a key. Creates the key if it doesn't exist.
since: 2.0.0DECR key
summary: Decrements the integer value of a key by one. Uses 0 as initial value if the key doesn't exist.
since: 1.0.0DECRBY key decrement
summary: Decrements a number from the integer value of a key. Uses 0 as initial value if the key doesn't exist.
since: 1.0.0GET key
summary: Returns the string value of a key.
since: 1.0.0GETDEL key
summary: Returns the string value of a key after deleting the key.
since: 6.2.0GETEX key [EX seconds|PX milliseconds|EXAT unix-time-seconds|PXAT unix-time-milliseconds|PERSIST]
summary: Returns the string value of a key after setting its expiration time.
since: 6.2.0GETRANGE key start end
summary: Returns a substring of the string stored at a key.
since: 2.4.0GETSET key value
summary: Returns the previous string value of a key after setting it to a new value.
since: 1.0.0INCR key
summary: Increments the integer value of a key by one. Uses 0 as initial value if the key doesn't exist.
since: 1.0.0INCRBY key increment
summary: Increments the integer value of a key by a number. Uses 0 as initial value if the key doesn't exist.
since: 1.0.0INCRBYFLOAT key increment
summary: Increment the floating point value of a key by a number. Uses 0 as initial value if the key doesn't exist.
since: 2.6.0LCS key1 key2 [LEN] [IDX] [MINMATCHLEN min-match-len] [WITHMATCHLEN]
summary: Finds the longest common substring.
since: 7.0.0MGET key [key ...]
summary: Atomically returns the string values of one or more keys.
since: 1.0.0MSET key value [key value ...]
summary: Atomically creates or modifies the string values of one or more keys.
since: 1.0.1MSETNX key value [key value ...]
summary: Atomically modifies the string values of one or more keys only when all keys don't exist.
since: 1.0.1PSETEX key milliseconds value
summary: Sets both string value and expiration time in milliseconds of a key. The key is created if it doesn't exist.
since: 2.6.0SET key value [NX|XX] [GET] [EX seconds|PX milliseconds|EXAT unix-time-seconds|PXAT unix-time-milliseconds|KEEPTTL]
summary: Sets the string value of a key, ignoring its type. The key is created if it doesn't exist.
since: 1.0.0SETEX key seconds value
summary: Sets the string value and expiration time of a key. Creates the key if it doesn't exist.
since: 2.0.0SETNX key value
summary: Set the string value of a key only when the key doesn't exist.
since: 1.0.0SETRANGE key offset value
summary: Overwrites a part of a string value with another by an offset. Creates the key if it doesn't exist.
since: 2.2.0STRLEN key
summary: Returns the length of a string value.
since: 2.2.0SUBSTR key start end
summary: Returns a substring from a string value.
since: 1.0.0

2.3. help 查看具体命令的用法

help 具体命令可以查看命令的用法描述,命令从那个版本开始,命令属于哪个组等信息。如 help APPEND,

img

这篇关于redis-cli help使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1013674

相关文章

使用Python实现IP地址和端口状态检测与监控

《使用Python实现IP地址和端口状态检测与监控》在网络运维和服务器管理中,IP地址和端口的可用性监控是保障业务连续性的基础需求,本文将带你用Python从零打造一个高可用IP监控系统,感兴趣的小伙... 目录概述:为什么需要IP监控系统使用步骤说明1. 环境准备2. 系统部署3. 核心功能配置系统效果展

使用Java将各种数据写入Excel表格的操作示例

《使用Java将各种数据写入Excel表格的操作示例》在数据处理与管理领域,Excel凭借其强大的功能和广泛的应用,成为了数据存储与展示的重要工具,在Java开发过程中,常常需要将不同类型的数据,本文... 目录前言安装免费Java库1. 写入文本、或数值到 Excel单元格2. 写入数组到 Excel表格

redis中使用lua脚本的原理与基本使用详解

《redis中使用lua脚本的原理与基本使用详解》在Redis中使用Lua脚本可以实现原子性操作、减少网络开销以及提高执行效率,下面小编就来和大家详细介绍一下在redis中使用lua脚本的原理... 目录Redis 执行 Lua 脚本的原理基本使用方法使用EVAL命令执行 Lua 脚本使用EVALSHA命令

Java 中的 @SneakyThrows 注解使用方法(简化异常处理的利与弊)

《Java中的@SneakyThrows注解使用方法(简化异常处理的利与弊)》为了简化异常处理,Lombok提供了一个强大的注解@SneakyThrows,本文将详细介绍@SneakyThro... 目录1. @SneakyThrows 简介 1.1 什么是 Lombok?2. @SneakyThrows

使用Python和Pyecharts创建交互式地图

《使用Python和Pyecharts创建交互式地图》在数据可视化领域,创建交互式地图是一种强大的方式,可以使受众能够以引人入胜且信息丰富的方式探索地理数据,下面我们看看如何使用Python和Pyec... 目录简介Pyecharts 简介创建上海地图代码说明运行结果总结简介在数据可视化领域,创建交互式地

Redis 热 key 和大 key 问题小结

《Redis热key和大key问题小结》:本文主要介绍Redis热key和大key问题小结,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录一、什么是 Redis 热 key?热 key(Hot Key)定义: 热 key 常见表现:热 key 的风险:二、

Java Stream流使用案例深入详解

《JavaStream流使用案例深入详解》:本文主要介绍JavaStream流使用案例详解,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录前言1. Lambda1.1 语法1.2 没参数只有一条语句或者多条语句1.3 一个参数只有一条语句或者多

Java Spring 中 @PostConstruct 注解使用原理及常见场景

《JavaSpring中@PostConstruct注解使用原理及常见场景》在JavaSpring中,@PostConstruct注解是一个非常实用的功能,它允许开发者在Spring容器完全初... 目录一、@PostConstruct 注解概述二、@PostConstruct 注解的基本使用2.1 基本代

C#使用StackExchange.Redis实现分布式锁的两种方式介绍

《C#使用StackExchange.Redis实现分布式锁的两种方式介绍》分布式锁在集群的架构中发挥着重要的作用,:本文主要介绍C#使用StackExchange.Redis实现分布式锁的... 目录自定义分布式锁获取锁释放锁自动续期StackExchange.Redis分布式锁获取锁释放锁自动续期分布式

springboot使用Scheduling实现动态增删启停定时任务教程

《springboot使用Scheduling实现动态增删启停定时任务教程》:本文主要介绍springboot使用Scheduling实现动态增删启停定时任务教程,具有很好的参考价值,希望对大家有... 目录1、配置定时任务需要的线程池2、创建ScheduledFuture的包装类3、注册定时任务,增加、删