安装redis
sudo apt install redis-server
sudo systemctl start redis-server
添加开机启动
systemctl enable redis-server.service
配置reids
配置文件/etc/redis/redis.conf
sudo vi /etc/redis/redis.conf
修改配置文件
#远程访问 默认bind 127.0.0.1 ::1 bind 0.0.0.0
# 更改端口 port 6379
# 设置密码 requirepass password
更改之后记得重启 :sudo systemctl restart redis-server
使用redis-cli连接:$redis-cli -h 127.0.0.1 -p 6379 -a ‘thisizmy!PASS‘
-h 是网址,-p 端口 -a 是密码
引用:https://www.jianshu.com/p/c5cc3ee8402c