最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Redis 命令
时间:2026-09-03 07:12:50 编辑:袖梨 来源:一聚教程网
Redis 命令用于在 redis 服务上执行操作。

要在 redis 服务上执行命令需要一个 redis 客户端。Redis 客户端在我们之前下载的的 redis 的安装包中。
语法
Redis 客户端的基本语法为:
$ redis-cli实例
以下实例讲解了如何启动 redis 客户端:
启动 redis 服务器,打开终端并输入命令 redis-cli,该命令会连接本地的 redis 服务。
$ redis-cliredis 127.0.0.1:6379>redis 127.0.0.1:6379> PINGPONG在以上实例中我们连接到本地的 redis 服务并执行 PING 命令,该命令用于检测 redis 服务是否启动。
在远程服务上执行命令
如果需要在远程 redis 服务上执行命令,同样我们使用的也是 redis-cli 命令。
语法
$ redis-cli -h host -p port -a password实例
以下实例演示了如何连接到主机为 127.0.0.1,端口为 6379 ,密码为 mypass 的 redis 服务上。
$redis-cli -h 127.0.0.1 -p 6379 -a "mypass"redis 127.0.0.1:6379>redis 127.0.0.1:6379> PINGPONG
相关文章
- 关于Dart中的异步编程实用指南 09-03
- MongoDB 原子操作 09-03
- MongoDB 高级索引 09-03
- MongoDB 索引限制 09-03
- MongoDB 全文检索 09-03
- MongoDB 管理工具: Rockmongo 09-03