Linux安装Redis

Linux安装Redis

@Author : GavinLau

@Update Time : 2018-08-16

@Contact Way : 156071616(qq群)

 

Redis官网 https://redis.io

安装 :

安装过程中如遇到问题 , 请查看下方FAQ

1. [root@VM_0_7_centos ~]# cd /usr/local/

2. [root@VM_0_7_centos local]# wget http://download.redis.io/releases/redis-4.0.11.tar.gz

3. [root@VM_0_7_centos local]# tar xzf redis-4.0.11.tar.gz

4. [root@VM_0_7_centos local]# cd redis-4.0.11/

5. [root@VM_0_7_centos redis-4.0.11]# make

6. [root@VM_0_7_centos redis-4.0.11]# make PREFIX=/usr/local/redis install     // 安装到指定目录

7. [root@VM_0_7_centos redis-4.0.11]# cp /usr/local/redis-4.0.11/redis.conf /usr/local/redis      // 复制配置文件

8. [root@VM_0_7_centos redis-4.0.11]# cd /usr/local/redis    // 进入redis目录

9. [root@VM_0_7_centos redis]#  ./bin/redis-server ./redis.conf   // 启动Redis

10. [root@VM_0_7_centos redis]# ./bin/redis-cli     // 连接redis
127.0.0.1:6379>

 

FAQ : 

Question1.  如何获取redis下载链接

Answer :

访问Redis官网 (https://redis.io), 看到 "Download it" ,发现类似"Redis 4.0.11 is the latest stable version"链接,鼠标放到此链接上,鼠标右键复制链接地址即可

Question2.  make后出现 "Hint: It's a good idea to run 'make test' "

Answer : 

// 输入make test

[root@VM_0_7_centos redis-4.0.11]# make test

// 出现如下, 会发现"You need tcl 8.5 or newer in order to run the Redis test"

cd src && make test
make[1]: Entering directory `/usr/local/redis-4.0.11/src'
    CC Makefile.dep
make[1]: Leaving directory `/usr/local/redis-4.0.11/src'
make[1]: Entering directory `/usr/local/redis-4.0.11/src'
You need tcl 8.5 or newer in order to run the Redis test
make[1]: *** [test] Error 1
make[1]: Leaving directory `/usr/local/redis-4.0.11/src'
make: *** [test] Error 2

// 安装tcl

[root@VM_0_7_centos redis-4.0.11]# yum install tcl

[root@VM_0_7_centos redis-4.0.11]# make test

Question3.  Redis目录结构

Answer : 

-rwxr-xr-x 1 root root 2451240 Aug  1 11:59 redis-benchmark    // redir性能测试工具
-rwxr-xr-x 1 root root 5768672 Aug  1 11:59 redis-check-aof    // 检查aof日志的工具
-rwxr-xr-x 1 root root 5768672 Aug  1 11:59 redis-check-rdb    // 检查rdb日志的工具
-rwxr-xr-x 1 root root 2617272 Aug  1 11:59 redis-cli    // 连接用的客户端
lrwxrwxrwx 1 root root      12 Aug  1 11:59 redis-sentinel -> redis-server
-rwxr-xr-x 1 root root 5768672 Aug  1 11:59 redis-server    // redis服务进程

Question4.  Redis如何以后台的形式运行

Answer : 

[root@VM_0_7_centos redis]# vim redis.conf

找到daemonize no

改为daemonize yes

[root@VM_0_7_centos redis]# ./bin/redis-server ./redis.conf  // 重启

[root@VM_0_7_centos redis]# ps aux|grep redis // 查看redis是否在运行中

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值