官网地址:https://redis.io/
中文地址:http://www.redis.cn/
1:下载Redis文件
[root@wuxl ~]# wget http://download.redis.io/releases/redis-4.0.11.tar.gz
2:解压文件
[root@wuxl ~]# tar -zxvf redis-4.0.11.tar.gz
3:安装Redis
a)进入解压后的redis目录
[root@wuxl ~]# cd /root/redis-4.0.11/
b)执行make命令
[root@wuxl redis-4.0.11]# make
c)安装
[root@wuxl redis-4.0.11]# make install
4:更改Redis配置文件
Redis默认不是后台运行的,所以现在要更改下配置文件,设置成后台运行
[root@wuxl ~]# vi /root/redis-4.0.11/redis.conf
By default Redis does not run as a daemon. Use 'yes' if you need it.
将NO更改为YES,如图

5:运行Redis
[root@wuxl redis-4.0.11]# redis-server /root/redis-4.0.11/redis.conf
3992:C 17 Oct 14:32:24.464 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
3992:C 17 Oct 14:32:24.464 # Redis version=4.0.11, bits=64, commit=00000000, modified=0, pid=3992, just started
3992:C 17 Oct 14:32:24.464 # Configuration loaded
运行成功,现在可以测试一下
[root@wuxl redis-4.0.11]# redis-cli -p 6379
127.0.0.1:6379> set aa hello
OK
127.0.0.1:6379> get aa
"hello"
127.0.0.1:6379>
6:关闭Redis
127.0.0.1:6379> SHUTDOWN
not connected> exit
[root@wuxl redis-4.0.11]#
7:Redis自带性能测试
[root@wuxl redis-4.0.11]# cd /usr/local/bin/
[root@wuxl bin]# ll
total 21940
-rw-r--r-- 1 root root 7449 Oct 16 18:05 dump.rdb
-rwxr-xr-x 1 root root 2451696 Oct 16 16:55 redis-benchmark
-rwxr-xr-x 1 root root 5775984 Oct 16 16:55 redis-check-aof
-rwxr-xr-x 1 root root 5775984 Oct 16 16:55 redis-check-rdb
-rwxr-xr-x 1 root root 2617776 Oct 16 16:55 redis-cli
lrwxrwxrwx 1 root root 12 Oct 16 16:55 redis-sentinel -> redis-server
-rwxr-xr-x 1 root root 5775984 Oct 16 16:55 redis-server
[root@wuxl bin]#
其中redis-benchmark就是Redis自带性能测试文件
首先运行redis
[root@wuxl bin]# redis-server /root/redis-4.0.11/redis.conf
3992:C 17 Oct 14:32:24.464 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
3992:C 17 Oct 14:32:24.464 # Redis version=4.0.11, bits=64, commit=00000000, modified=0, pid=3992, just started
3992:C 17 Oct 14:32:24.464 # Configuration loaded
运行测试文件
[root@wuxl bin]# redis-benchmark
网友评论