-
查看是否已经安装了redis
- 检测后台是否存在该进程
ps -ef |grep redis
- 检查redis常用端口6379是否在使用
netstat -lntp |grep 6379
- 下载redis安装包
yum install redis
- 配置端口和密码
vim /etc/redis.conf
# 可以使用vim查找功能 vim命令模式下 /port 查找 小写n下一个 N上一个
# 更改默认端口号 找到port 默认端口容易被攻击 如果开启外网就建议替换
port your_port
# 设置密码 找到 requirepass 打开注释 后面填写你的密码
requirepass your_password
- 改完配置后重启
systemctl restart redis # 重启
sudo systemctl start redis # 启动
sudo systemctl enable redis # 开启? 不知道和启动什么区别
sudo systemctl status redis # 查看状态
- 登录redis客户端
redis-cli -p 6379
# 提示 NOAUTH Authentication required 输入密码
auth yourpassword