Redis能做什么?
- 内存存储,持久化,内存中是断电即失,所以说持久化很重要(RDB,AOF)
- 效率高,可用于高速缓存
- 发布订阅系统
- 地图信息分析
- 计时器,计数器(浏览量)
- 。。。。
特性
- 多样的数据库类型
- 持久化
- 集群
- 事务
Redis安装(Linux环境)
下载Redis-7.0.2.tar.gz
移动至/opt
解压 tar -zxvf redis-7.0.2.tar.gz

基本环境安装
# 安装gcc (gcc version)
yum install gcc-c++

# 安装redis环境(server、sentinel等)
make
# 确认安装
make install

# 默认安装到了/usr/local/bin路径

# 在/usr/local/bin目录下创建config目录
mkdir config
# 移动redis.conf文件到/usr/local/bin
mv /opt/redis-7.0.2/redis.conf /usr/local/bin/config

# 修改redis.conf,使之后台运行
vim redis.conf
# daemonize改为yes
daemonize yes

启动Redis服务
# 通过指定的配置文件启动服务
redis-server config/redis.conf

# 使用redis客户端连接
redis-cli -p 6379
# 测试是否连通
ping
PONG
# 查看redis进程
ps -ef | grep redis

# 关闭redis服务
shutdown
# 退出redis-cli
exit
性能测试
redis-benchmark

# 100个并发,100000个请求(如果显示NO AUTH则需要加上 -a 密码 )
redis-benchmark -h 127.0.0.1 -p 6379 -c 100 -n 100000

测试结果
