# Redis

对redis字典服务数据库(key-value数据库)相关指令进行记录。

# 登录redis

可以通过redis-cli指令登录redis。

root@test:/data# redis-cli -p 6379 -a password
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6379> keys DEPARTMENT:*

# 查询keys

通过keys可以查看redis里都有哪些keys。

root@test:/data# redis-cli -p 6379 -a password
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
# 查看所有以DEPARTMENT:开头的keys
127.0.0.1:6379> keys DEPARTMENT:*
# 查看所有的keys
127.0.0.1:6379> keys *

# 查看value

root@test:/data# redis-cli -p 6379 -a password
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
# 通过get key来查看value
127.0.0.1:6379> get "DEPARTMENT:20191115142730138-03DA-4DBF7E1C7"

# 删除key

root@test:/data# redis-cli -p 6379 -a password
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
# 通过del key来删除value
127.0.0.1:6379> DEL "DEPARTMENT:20191115142730138-03DA-4DBF7E1C7"