关于redis:redis入门教程2

8次阅读

共计 1080 个字符,预计需要花费 3 分钟才能阅读完成。

查看 redis 相干信息

INFO [section]

# 间接输出 info 将返回以后 redis 所有相干信息
127.0.0.1:6379> info

当只须要显示其中局部信息的时候,info 前面加对应须要查看的信息。例如须要查看 redis 客户端信息应用 info clients

127.0.0.1:6379> info clients
# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
# keyspace 提供每个数据库的主字典统计,包含 key 总数,过期 key 总数
127.0.0.1:6379> info keyspace
# Keyspace
db0:keys=8,expires=0,avg_ttl=0
db3:keys=2,expires=0,avg_ttl=0

参考:

  • http://redis.cn/commands/info…
  • https://redis.io/commands/info

连贯相干

AUTH

为 redis 服务申请设置一个明码

SELECT index

切换数据库,下标从 0 开始

127.0.0.1:6379> select 2
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth 123456
OK
# 通过 select 命令切换数据库
127.0.0.1:6379> select 1
OK
127.0.0.1:6379[1]> get 111
(nil)

参考:

  • http://redis.cn/commands.html…

客户端相干

CLIENT LIST

返回所有客户端数据

127.0.0.1:6379[1]> CLIENT LIST
id=19 addr=127.0.0.1:33639 fd=8 name= age=593 idle=0 flags=N db=1 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=client

参考:http://redis.cn/commands/clie…

CONFIG GET parameter
CONFIG SET parameter value

用户在运行期间设置和读取配置。通过 CONFIG GET * 能够查看所有可设置的配置

参考

  • http://redis.cn/commands/conf…
CLIENT KILL kill 链接

具体信息查看文档即可

对于 redis 的三种模式

  • standalone 单机模式
  • Sentinel 哨兵模式
  • cluster 集群模式
正文完
 0