https://developer.aliyun.com/article/764565
步骤1:安装
1. sudo apt update
2. sudo apt install redis-server
# 检查服务状态
3. sudo systemctl status redis-server
# 输出内容
● redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2020-06-06 20:03:08 UTC; 10s ago
...
步骤2:开启远程服务
1. vim /etc/redis/redis.conf
# 允许任何主机访问
注释掉这行 # bind 0.0.0.0 ::1
允许任何主机访问
protected-mode yes 改为 protected-mode no
# 重启 Redis 服务,使应用生效
2. sudo systemctl restart redis-server
步骤3:开启默认端口
# 查看已开启的端口
1. sudo ufw status
# 开启6379端口
2. sudo ufw allow 6379
步骤4:验证设置是否欧克
# 远程机器ping redis服务器
redis-cli -h 120.46.177.228 ping
# 输出PONG就代表欧克
PONG