CentOS 7 平台下编译安装Redis 5.0

1、下载当前稳定版

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

或者

wget http://download.redis.io/releases/redis-5.0.5.tar.g

2、加压缩

tar -zxvf redis-5.0.5.tar.gz

3、编译

cd redis-5.0.5/
make
make install PREFIX=/usr/local/redis

4、编辑配置文件

vi redis.conf
bind 10.17.12.160
protected-mode no
port 6379
daemonize yes
requirepass 123456

说明:
daemonize yes表示后台运行
protected-mode no表示关闭保护模式

cp redis.conf /usr/local/redis

5、启动服务

cd /usr/local/redis
bin/redis-server redis.conf >> /var/log/redis.log &

6、简单使用

登录bin/redis-cli -h 10.17.12.XXX -p 6379 -a 123456

[root@server redis]# bin/redis-cli -h 10.17.12.xxx -p 6379 -a 123456
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
10.17.12.xxx:6379> set "name" "chengyuqiang"
OK
10.17.12.xxx:6379> get "name"
"chengyuqiang"
10.17.12.xxx:6379> quit
[root@server redis]# 

7、关闭服务

[root@server ~]# ps -aux | grep redis
root       763  0.1  0.1 159468 11952 ?        Ssl  09:35   0:02 /usr/local/redis/bin/redis-server 10.17.12.xxx:6379
root      1182  0.0  0.0 112648   952 pts/0    S+   10:08   0:00 grep --color=auto redis
[root@server ~]# kill 763

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值