liunx -redis的查看及登陆

  1. 查看端口号命令
[root@iZm5ee9mxelwecp6gnpr8qZ ~]# ps -ef | grep redis
root     11066 10986  0 15:03 pts/5    00:00:00 grep --color=auto redis
root     24074     1  0 Aug05 ?        02:18:10 ./redis-server *:7479
  1. 根据端口看查看路径
[root@iZm5ee9mxelwecp6gnpr8qZ ~]# ls -l /proc/24074/cwd
lrwxrwxrwx 1 root root 0 Aug  5 17:00 /proc/24074/cwd -> /usr/local/redis/bin
  1. 查看路径地址详情
[root@iZm5ee9mxelwecp6gnpr8qZ ~]# cd /usr/local/redis/bin/
[root@iZm5ee9mxelwecp6gnpr8qZ bin]# ls
dump.rdb         redis-check-aof  redis-cli       redis-server
redis-benchmark  redis-check-rdb  redis-sentinel
  1. 登陆redis
 
[root@iZm5ee9mxelwecp6gnpr8qZ bin]# ./redis-cli -h 127.0.0.1 -p 7479
127.0.0.1:6379>
  1. 登陆redis,进行密码授权
127.0.0.1:6379> auth "yourpassword"  
  1. 查看所有key
  127.0.0.1:6379> keys * 
  1. 模糊查看某个key
  127.0.0.1:6379> keys hib:socket:union:doctor_*
  1. 查看key值类型
127.0.0.1:7479> type hib:socket:union:doctor_351
hash
  1. 获取指定键所有的属性「hkeys」
127.0.0.1:7479> hkeys hib:socket:union:doctor_351
1) "name"
2) "age"
  1. 获取某个键的某个属性的值(键属性值)「hget」
  127.0.0.1:7479> hget hib:socket:union:doctor_351 name
  "yuance"
  1. 获取某个键的多个属性的值「hmget」
127.0.0.1:7479> hmget hib:socket:union:doctor_351 name age
1) "yuance"
2) "18"
  1. 获取某个键的所有属性的值「hvals」
127.0.0.1:7479> hvals hib:socket:union:doctor_351
1) "yuance"
2) "18"
  1. 使用 del 命令删除整个 hash 键和属性值
127.0.0.1:7479> del hib:socket:union:doctor_351
(integer) 1
  1. 使用 hdel 命令删除指定 hash 键的某个属性值,可以同时删除一个或多个属性。
 127.0.0.1:7479> del hib:socket:union:doctor_351 name age
(integer) 1
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值