• Redis 命令


    Redis 命令用于在 redis 服务上执行操作。

    要在 redis 服务上执行命令需要一个 redis 客户端。Redis 客户端在我们之前下载的的 redis 的安装包中。

    语法

    Redis 客户端的基本语法为:

    $ redis-cli

    实例

    以下实例讲解了如何启动 redis 客户端:

    启动 redis 客户端,打开终端并输入命令 redis-cli。该命令会连接本地的 redis 服务。

    $redis-cli
    redis 127.0.0.1:6379>
    redis 127.0.0.1:6379> PING
    
    PONG

    在以上实例中我们连接到本地的 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> PING
    
    PONG

     

    1 篇笔记 写笔记

    1. #1

         iscopy

        isc***@163.com

        参考地址

      有时候会有中文乱码。

      要在 redis-cli 后面加上 --raw

      redis-cli --raw

      就可以避免中文乱码了。

      iscopy

         iscopy

        isc***@163.com

        参考地址

      3个月前 (08-03)
  • 相关阅读:
    这些 Drawable 的小技巧,你都了解吗?
    Android 软键盘的显示和隐藏,这样操作就对了
    在 ReactNative 的 App 中,集成 Bugly 你会遇到的一些坑
    聊聊 Material Design 里,阴影的那些事儿!
    PAT 1069 1070 1071 1072
    PAT1021 Deepest Root
    关于素数:求不超过n的素数,素数的判定(Miller Rabin 测试)
    PAT《数据结构学习与实验指导》实验项目集 2-05 2-06 2-07 2-08
    LeetCode:Gas Station
    LeetCode:Candy
  • 原文地址:https://www.cnblogs.com/lvdongjie/p/9897021.html
Copyright © 2020-2023  润新知