1.登陆命令:/usr/local/redis/bin/redis-cli -h 127.0.0.1 -p 6388 -a 123456

2.切换数据库:127.0.0.1:6379[2]> select 1

2.获取所有key:127.0.0.1:6388> keys *

3.获取指定key:127.0.0.1:6388> keys frd_5

4.获取指定key的类型:127.0.0.1:6388> TYPE frd_5

5.查看key下的所有内容:127.0.0.1:6002> HGETALL rank_level_2_i

5.获取指定key的值:127.0.0.1:6388> HGET frd_5 29360136

10、增加,查询,删除数据,在此目录下:/usr/local/redis/bin
[root@iZf8zgmcqbodq6fb8j8k54Z bin]# ./redis-cli
127.0.0.1:6379> set test hello
OK
127.0.0.1:6379> get test
"hello"
127.0.0.1:6379> del test
(integer) 1
127.0.0.1:6379> get test
(nil)
127.0.0.1:6379>

11、查询所有key

127.0.0.1:6379> set test hello
OK
127.0.0.1:6379> set test1 hello1
OK
127.0.0.1:6379> set test2 hello2
OK
127.0.0.1:6379> keys *
1) "test"
2) "test1"
3) "test2"

转自:https://www.cnblogs.com/chenjw-note/p/13036557.html
https://blog.csdn.net/zhiyinweini3/article/details/110674189

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐