配置Redis
为单实例Redis部署配置Redis,需要修改Redis配置文件中的一些关键设置以及调整Redis的行为。
- 创建Redis运行目录。这里创建的目录是“/home/redis/standalone”。
mkdir -p /home/redis/standalone
- 复制默认配置文件。本例中默认配置文件路径为“/home/redis-6.0.20/redis.conf”。
cd /home/redis/standalone cp /home/redis-6.0.20/redis.conf ./
- 修改配置文件。
- 切换到Redis运行目录。
cd /home/redis/standalone
- 使用sed命令修改配置文件中的几个关键设置,包括允许Redis侦听所有网络接口上的连接、禁用保护模式以提高可访问性(但需注意安全风险),以及忽略ARM64架构上可能遇到的特定错误警告。
sed -i "s/bind 127.0.0.1/#bind 127.0.0.1/g" redis.conf sed -i "s/protected-mode yes/protected-mode no/g" redis.conf sed -i "s/# ignore-warnings ARM64-COW-BUG/ignore-warnings ARM64-COW-BUG/g" redis.conf
- 切换到Redis运行目录。
父主题: 单实例模式部署