Redis overview and installation

Redis overview

Redis is an open source (BSD licensed) in-memory data structure storage used as a database, cache, and message broker. Redis provides data structures such as strings, hashes, lists, collections, sorted collections with range queries, bitmaps, hyperlogs, geospatial indexes, and streams. Redis has built-in replication, Lua scripts, LRU eviction, transactions and different levels of disk persistence, and provides high availability through automatic partitioning of Redis Sentinel and Redis Cluster

数据类型丰富    								(笔试、面试)*****
支持持久化      								 (笔试、面试)*****
多种内存分配及回收策略
支持事务            						(面试) ****
消息队列、消息订阅 
支持高可用                             ****
支持分布式分片集群 							(面试)*****
缓存穿透\雪崩(笔试、面试)   					  *****
Redis API                  					 **

Introduction to Redis usage scenarios

Memcached: Multi-core caching service, more suitable for application scenarios where multiple users have fewer concurrent accesses.
Redis: Single-core caching service. In the case of a single node, it is more suitable for a small number of users and multiple access application scenarios. Redis is generally a single-machine multi-instance architecture, which appears in conjunction with redis clusters.

Redis installation

Compile and install

# 官方示例
# 安装依赖
yum -y install gcc automake autoconf libtool make
# 安装源码包
wget https://download.redis.io/releases/redis-6.0.10.tar.gz
# 解压
tar xzf redis-6.0.10.tar.gz
# 进入文件
cd redis-6.0.10
# 编译安装
make


# 自定制
# 安装依赖
yum -y install gcc automake autoconf libtool make
# 创建目录
mkdir /database && cd /database
# 下载源码
wget https://download.redis.io/releases/redis-6.0.10.tar.gz
# 解压
tar xzf redis-6.0.10.tar.gz
# 进入目录
cd redis-6.0.10
# 编译安装
make
# 配置环境变量
echo "export PATH=/databases/redis-6.0.10/src:$PATH" >> /etc/profile  && source /etc/profile

The installation is successful, as shown below

# src/redis-server & 
src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"

Tips:

If the compilation fails, please check the gccversion (available gcc -v) to view

Mine is 9.0.1

Package management tool installation

apt-get -y update && apt-get -y upgrade && apt-get -y dist-upgrade 
apt install -y  software-properties-common
sudo add-apt-repository ppa:redislabs/redis
sudo apt-get update
sudo apt-get install redis

Referer

Redis official website

Redis Chinese document

Guess you like

Origin blog.csdn.net/wzp7081/article/details/112598508