- 安装
- 配置
- 启动 redis
- 从「别处」连接 redis server
dnf install -y redis配置
默认情况下,redis 只允许从本地发起连接。所以,如果我们要从「别处」连接 redis server ,需要修改配置放开这个限制。
redis 的配置文件在 /etc 目录下,名为 redis.conf
执行以下命令,间接修改 redis.conf 配置文件:
# 取消本地绑定。69 行附近 sed -i -e "s|bind 127.0.0.1|#bind 127.0.0.1|" /etc/redis.conf # 关闭保护模式。88 行附近 sed -i -e "s|protected-mode yes|protected-mode no|" /etc/redis.conf启动 redis
# 查看 redis 运行状态 systemctl status redis # 为避免防火墙的干扰,在开发环境中,我们通常会关闭 linux 防火墙 systemctl disable firewalld --now # 将 redis 设置为开机启动,并立即启动 systemctl enable redis --now # 启动redis cd /usr/local/bin redis-cli # 查看redis进程 ps -ef | grep redis # 关闭redis进程 kill -9 -端口号 或者 shutdown从「别处」连接 redis server
redis-cli -h



