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

这是进程关闭了:

- 开启服务:
            
            
              shell
              
              
            
          
          redis-server /etc/redis.conf
redis-cli -p 6379不懂的可以留言