centos6.5 yum安装redis

@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服务器

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值