redis快速入门教程

更新中

基本概念

安装

centOS

安装redis:yum install redis -y

启动:systemctl start redis

设置开机启动:systemctl enable redis

检查运行状态:systemctl status redis

远程访问

编辑配置文件 vi /etc/redis.conf

在其中修改为bind 0.0.0.0,方便允许远程访问(开发用,生产环境不允许)

修改后 systemctl restart redis

远程测试是否连接成功

在另一台机器上同样的安装redis

然后输入指令

复制代码
redis-cli -h 123.123.123.123 -p 6379
PING  # 应返回 PONG
SET test "hello world"
GET test  # 应返回 "hello world"