这里我使用的是阿里云的服务器
打开阿里云的安全组,设置端口为6379
在redis.conf文件中,注释bind 127.0.0.1
将protected-mode设置为no,即关闭保护模式
更改服务器中的防火墙,放行6379端口
# 放行端口 firewall-cmd --zone=public --add-port=6379/tcp --permanent # 重启防火墙 systemctl restart firewalld 注意在这边要关闭Redis的服务:进入redis后
127.0.0.1:6379> shudown -> 关闭服务 not connected> exit -> 退出连接 查看进程是否结束:
ps -ef | grep redis 这是进程没有关闭:
这是进程关闭了:
redis-server /etc/redis.conf redis-cli -p 6379 不懂的可以留言