zoukankan      html  css  js  c++  java
  • Redis入门

     先进/usr/local/bin目录下

    [root@hadoop100 bin]# pwd
    /usr/local/bin
    [root@hadoop100 bin]# ll
    总用量 15456
    -rwxr-xr-x. 1 root root 4589155 3月   6 19:30 redis-benchmark
    -rwxr-xr-x. 1 root root   22217 3月   6 19:30 redis-check-aof
    -rwxr-xr-x. 1 root root   45435 3月   6 19:30 redis-check-dump
    -rwxr-xr-x. 1 root root 4693114 3月   6 19:30 redis-cli
    lrwxrwxrwx. 1 root root      12 3月   6 19:30 redis-sentinel -> redis-server
    -rwxr-xr-x. 1 root root 6466389 3月   6 19:30 redis-server

    redis的启动

    [root@hadoop100 bin]# redis-server /myredis/redis.conf 

    启动客户端

    [root@hadoop100 bin]# redis-cli -p 6379
    127.0.0.1:6379> keys *
    (empty list or set)
    127.0.0.1:6379> set s1 1
    OK
    127.0.0.1:6379> get s1
    "1"
    127.0.0.1:6379> select 1
    OK
    127.0.0.1:6379[1]> keys *
    (empty list or set)
    127.0.0.1:6379[1]> set s1 =22
    OK
    127.0.0.1:6379[1]> get s1
    "=22"
    127.0.0.1:6379[1]> 

    关闭redis

    [root@hadoop100 bin]# redis-cli -p 6379
    127.0.0.1:6379> SHUTDOWN
    not connected> exit
    [root@hadoop100 bin]#
    127.0.0.1:6379[2]> config get requirepass
    1) "requirepass"
    2) ""
    127.0.0.1:6379[2]> config get dir
    1) "dir"
    2) "/usr/local/bin"
    127.0.0.1:6379[2]> 

    设置密码

    127.0.0.1:6379> config get requirepass
    1) "requirepass"
    2) ""
    127.0.0.1:6379> config set requirepass "123456"
    OK
    127.0.0.1:6379> ping
    (error) NOAUTH Authentication required.
    127.0.0.1:6379> auth 123456
    OK
    127.0.0.1:6379> ping
    PONG
    127.0.0.1:6379>
  • 相关阅读:
    Docker 安装各种环境
    N级树形菜单封装
    一个周期算出所有高电平的个数
    DDR3新版(3):DDR3自动读写控制器
    DDR3_新版(2):IP核再封装
    数电(6):时序逻辑电路
    Vue表单那些事
    liunx环境修改minio默认端口和后台启动
    liunx 后台启动mongodb服务
    liunx安装和部署nacos配置中心
  • 原文地址:https://www.cnblogs.com/liuyi13535496566/p/12430426.html
Copyright © 2011-2022 走看看