1.yum添加epel源
yum install epel-release
2.安装yum
yum install redis
3.Redis 服务端配置
Could not connect to Redis at 127.0.0.1:6379: Connection refused
vim /etc/redis.conf
找到redis.conf 并修改 daemonize no(第128行) 为 daemonize yes
:set number(显示行号)
. 4.开启客户端要确保服务端启动
redis-server /etc/redis.conf
5.redis-server -v 查看版本
redis-server /etc/redis.conf 启动
redis-cli ping
PONG
测试启动 redis-cli ping 返回PONG,启动成功。
设置 远程连接redis
修改配置文件,监听所有的IP地址
vim /etc/redis.conf
找到下面这一行
bind 127.0.0.1
注释掉
#bind 127.0.0.1(指定具体ip可以访问,如果不想绑定,注释此行或者设置为:bind 0.0.0.0)
配置认证密码
1.通过配置文件进行配置
yum方式安装的redis配置文件通常在/etc/redis.conf中,打开配置文件找到
#requirepass foobared
去掉行前的注释,并修改密码为所需的密码,保存文件
requirepass youpwd
重启redis完成
支持远程访问:
vim /etc/redis.conf
protected-mode 要设置成no
#bind 127.0.0.1(注释或者设置为:bind 0.0.0.0)
redis-cli 链接