Linux 安装Redis

11 篇文章 0 订阅

 https://www.cnblogs.com/amberdyy/p/9166778.html

1.下载安装包
[root@VM_0_11_centos mnt]# wget http://download.redis.io/releases/redis-5.0.4.tar.gz

2.解压
[root@VM_0_11_centos mnt]# tar xzf redis-5.0.4.tar.gz

3.编译
[root@VM_0_11_centos mnt]# cd redis-5.0.4
[root@VM_0_11_centos redis-5.0.4]# make

4.现在编译的二进制文件位于src目录中。 运行Redis:
[root@VM_0_11_centos redis-5.0.4]# src/redis-server


前端启动模式
5.您可以使用内置客户端与Redis进行交互:
[root@VM_0_11_centos redis-5.0.4]# ./src/redis-server <==前端启动模式,这种启动模式会占用一个终端。我们一般采用后端启动。

后端启动模式
6.编辑redis.conf,修改daemonize no 为 daemonize yes ,redis.conf 是一个默认的配置文件,我们可以根据需要使用自己的配置文件。
[root@VM_0_11_centos redis-5.0.4]# ./src/redis-server ../redis.conf 

7.查看redis服务有没有启动
[root@VM_0_11_centos redis-5.0.4]# ps aux|grep redis
root     19336  0.0  0.7 153828  8084 pts/0    Tl   10:13   0:00 ./redis-server 127.0.0.1:6379
root     29083  0.0  0.0 112644   948 pts/0    R+   10:23   0:00 grep --color=auto redis

8.连接
[root@VM_0_11_centos redis-5.0.4]# ./src/redis-server redis.conf     
[root@VM_0_11_centos redis-5.0.4]# ./src/redis-cli  <==有时候会有中文乱码后面加上--raw避免中文乱码了。
127.0.0.1:6379> set name ztq
OK
127.0.0.1:6379> get name
"ztq"
127.0.0.1:6379> 

9.退出
127.0.0.1:6379> quit

10.关闭客户端
[root@VM_0_11_centos redis-5.0.4]# src/redis-cli shutdown

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值