@TOC1.yum添加epel源
[root@localhost ~]# yum -y install redis
2.安装yum
[root@localhost ~]# yum -y install redis
3.Redis 服务端配置——Could not connect to Redis at 127.0.0.1:6379: Connection refused
[root@localhost ~]# vim /etc/redis.conf
找到redis.conf 并修改 daemonize no(第128行) 为 daemonize yes
:set number(显示行号)
4. 启动
[root@localhost ~]# redis-server /etc/redis.conf
5.查看版本
[root@localhost ~]# redis-server –v
6、测试启动 redis-cli ping 返回PONG,启动成功。
[root@localhost ~]# redis-cli ping
PONG
7、设置开机自动启动redis
[root@localhost ~]# chkconfig --add redis
启动redis命令行
[root@localhost ~]# redis-cli
设置远程连接密码验证
127.0.0.1:6379> config set requirepass “123456”
三、 允许远程连接redis数据库
1、 编辑redis配置文件
[root@localhost ~]# vim /etc/redis.conf
2、 解除只能本地ip连接redis的绑定
将 bind 127.0.0.1 使用#注释掉,改为# bind 127.0.0.1(bind配置的是允许连接的ip,默认只允许本机连接;若远程连接需注释掉,或改为0.0.0.0)
3、 允许公网访问redis
将 protected-mode yes 改为 protected-mode no(3.2之后加入的新特性,目的是禁止公网访问redis cache,增强redis的安全性)
4、 设置远程连接的密码验证
将 requirepass foobared 注释去掉,foobared为密码,也可修改为别的值(可选,建议设置)
5、 重启redis服务
[root@localhost ~]# service redis restart
6、 下载RedisDesktopManager工具
下载地址: https://redisdesktop.com/download
打开RedisDesktopManager工具 ,左上角点击链接到redis服务器