Skip to main content

Redis 备忘

ACL

  1. 注释掉requirepass,启用ACL之后,此字段失效
备注

如果不注释掉,会让default变成无密码(nopass),也就是不需要用户名密码都可以登录.

全开放了等于是.

  1. 指定aclfile 指定了aclfile,就自动启用ACL功能.
aclfile /etc/redis/users.acl
  1. 关闭default用户 以免自动免密
user default off nopass
  1. 明文密码
user admin on >pwd123456 ~* &* +@all
  1. SHA256密码
user admin on #dcc2d18accd87aa006ad2e6aebd6830d250d2eca6d87f99d8792487002889228 ~* &* +@all

无保护模式

Redis默认是启用保护模式的,只能本机127.0.0.1来访问.

启用无保护模式可以:

  1. 命令行
redis-server.exe --protected-mode no
  1. 修改配置redis.conf
# yes为启用,no为不启用
protected-mode no

另外,在保护模式下,可以配置bind参数来指定运行访问的ip

# 用空格来配置多个ip
bind 127.0.0.1 192.168.1.222

dir

find / -name dump.rdb

默认配置:

dir ./

表示在哪里启动server的时候,dump.rdbappendonly.aof就生成在哪里。有时候很难找到。

如果是系统自动启动,很可能在/根目录下。

问题

# Redis Client On Error: Error: write ECONNABORTED Config right

参考: Redis Client On Error: Error: write ECONNABORTED Config 修改配置(redis.conf):

# bind 127.0.0.1 -::1
# 允许所有ip访问
bind 0.0.0.0

# protected-mode yes
# 非保护模式
protected-mode no

资料