Redis的安装和使用

官网地址: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,如图

将NO更改为YES.png

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 
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • RedisRedis命令参考网址:http://doc.redisfans.com/ Redis 简介Redis ...
    野柳阅读 1,241评论 0 9
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 136,634评论 19 139
  • 关于Mongodb的全面总结 MongoDB的内部构造《MongoDB The Definitive Guide》...
    中v中阅读 32,311评论 2 89
  • 本文是我自己在秋招复习时的读书笔记,整理的知识点,也是为了防止忘记,尊重劳动成果,转载注明出处哦!如果你也喜欢,那...
    波波波先森阅读 3,483评论 0 40
  • 我们要飞到那遥远地方,看一看这世界,并非那么凄凉;我们要飞到那遥远地方,望一望这世界,还是一片的光亮…… NO.1...
    阳光Sunflower阅读 2,178评论 2 5

友情链接更多精彩内容