Centos7.5安装Redis

Centos7.5安装Redis

1、下载Redis

wget http://download.redis.io/releases/redis-4.0.10.tar.gz

2、解压文件

tar -zxvf redis-4.0.10.tar.gz 

3、编译安装

cd redis-4.0.10/
make
cd src
make install PREFIX=/usr/local/redis

将解压目录下的redis.conf复制到/usr/local/redis目录下。

4、配置文件启动服务

默认情况下redis是前台运行,我们把它改为后台,修改/usr/local/redis/redis.conf文件。

daemonize yes   # 修改为yes,启动不占用窗口
protected-mode no   # 修改为no,关闭安全模式,不然远程连接会报错误
bind 0.0.0.0  # 修改为指定ip,或者0.0.0.0
requirepass 密码  # 添加密码

后台启动Redis-Server。

[root@VM_129_36_centos bin]# ./redis-server redis.conf
24848:C 27 Sep 18:14:48.550 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
24848:C 27 Sep 18:14:48.550 # Redis version=4.0.10, bits=64, commit=00000000, modified=0, pid=24848, just started
24848:C 27 Sep 18:14:48.550 # Configuration loaded

关闭Redis-Server

[root@VM_129_36_centos bin]# ./redis-cli shutdown

指定服务器端口,和密码连接。

[root@VM_129_36_centos bin]# ./redis-cli -h 127.0.0.1 -p 6379 -a 密码
Warning: Using a password with '-a' option on the command line interface may not be safe.
127.0.0.1:6379> PING
PONG
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值