咱们看看wiki的定义:Redis是一款开源内存数据库项目,实现了分布式内存 键值存储和可选持久性。Redis支持不一样类型的抽象数据结构,例如字符串,列表,映射,集合,排序集合,超级日志记录,位图和空间索引。该项目主要由Salvatore Sanfilippo开发,目前由Redis实验室赞助。c++
如今不少项目都在使用redis,因此咱们有必要研究一下。redis
redis官网:https://redis.io/数据库
截止到2018年6月26日 16:58:58,是这样的。centos
任何一个东西的学习,对于环境的搭建而言都是最重要的,也是最基础的,必定要搞好。bash
环境准备:服务器
更新yum数据结构
yum update
添加epel并更新yum分布式
install epel-release yum update
下载redis学习
yum install redis
启动rediscentos7
sytemctl start redis
配置开机启动
systemctrl enable redis
验证
redis-cli ping
若是redis安装并运行成功将会看到:
PONG
版本查看
redis-cli -v
好比如今查看到的版本为:redis-cli 3.2.10
首先上传压缩文件,或者经过wget下载
yum -y install wget
wget http://download.redis.io/releases/redis-4.0.9.tar.gz
tar -zxvf redis-4.0.9.tar.gz
cd redis-4.0.9/ make
安装gcc ,经过yum安装,也能够下载安装
yum install gcc gcc-c++ # 查看gcc版本 gcc -v
cd redis-4.0.9
# 加入参数进行make make MALLOC=libc
说明:说关于分配器allocator, 若是有MALLOC 这个 环境变量, 会有用这个环境变量的 去创建Redis。
并且libc 并非默认的 分配器, 默认的是 jemalloc, 由于 jemalloc 被证实 有更少的 fragmentation problems 比libc。
可是若是你又没有jemalloc 而只有 libc 固然 make 出错。 因此加这么一个参数。
make命令执行完成编译后,会在src目录下生成6个可执行文件,
分别是redis-server、redis-cli、redis-benchmark、redis-check-aof、redis-check-rdb、redis-sentinel。
cd src cp {redis-server,redis-cli,redis-benchmark,redis-check-aof,redis-check-rdb,redis-sentinel} /usr/local/bin
cd .. make install
./utils/install_server.sh
若是看到:Welcome to the redis service installer This script will help you easily set up a running redis server,表明就成功了。
默认是在6379端口提供服务。
而后后面一路回车就能够了。
redis-cli
在任意目录下生效能够重启也行。