当前位置:网站首页>Redis of NoSQL database (I): Installation & Introduction
Redis of NoSQL database (I): Installation & Introduction
2022-06-29 07:06:00 【Tina-Deng】
Redis summary
Redis It's an open source key-value The storage system .
Redis It's open source (BSD The license ) Of , Data structure storage system in memory , It can be used as a database 、 Caching and message middleware . It supports multiple types of data structures , Such as character string (strings), hash (hashes), list (lists), aggregate (sets), Ordered set (sorted sets) And scope query , bitmaps, hyperloglogs and Geographical space (geospatial) Index radius query . Redis Built in Copy (replication),LUA Script (Lua scripting), LRU Driving events (LRU eviction), Business (transactions) And different levels of Disk persistence (persistence), And pass Redis sentry (Sentinel) And automatic Partition (Cluster) Provide high availability (high availability).
and Memcached similar , It supports storage value There are more types , Include string( character string )、list( Linked list )、set( aggregate )、zset(sorted set -- Ordered set ) and hash( Hash type ).
These data types support push/pop、add/remove And take intersection, union and difference sets and more abundant operations , And these operations are atomic .
On this basis ,Redis Support various sorts of sorting .
And memcached equally , To ensure efficiency , The data is cached in memory .
The difference is Redis Periodically, updated data is written to disk or changes are written to an appended log file .
And on this basis to achieve master-slave( Master-slave ) Sync .
Redis Application scenarios
Cache with relational database
High frequency , Hot access data , Lower the database IO
Distributed architecture , do session share 
A variety of data structures store persistent data

Redis install
1、 install gcc compiler
# install C The compiling environment of language
yum install centos-release-scl scl-utils-build
yum install -y devtoolset-8-toolchain
scl enable devtoolset-8 bash
# test gcc edition
gcc --version
2、 Download and install Redis
Redis Official website :http://redis.io
Redis Official website in Chinese :http://redis.cn/
1、 Download from the official website redis-6.2.1.tar.gz Rear release /opt Catalog
2、 Unpack the installation redis-6.2.1.tar.gz
# Unpack the command :
tar -zxvf redis-6.2.1.tar.gz
# After decompression, enter the directory :
cd redis-6.2.1
# stay redis-6.2.1 Execute... Again in the directory make command ( Just compile )
make install
If not ready C Language compiling environment ,make Will report a mistake —Jemalloc/jemalloc.h: There is no such document
# Solution : Carry out orders make distclean after , stay redis-6.2.1 Execute... Again in the directory make install command ( Just compile )
3、 The installation directory :/usr/local/bin
View the default installation directory :
redis-benchmark: Performance testing tools , You can run it in your own book , Look at the performance of your book
redis-check-aof: Fix the problem AOF file ,rdb and aof Later on
redis-check-dump: Fix the problem dump.rdb file
redis-sentinel:Redis Cluster use
redis-server:Redis Server start command
redis-cli: client , Operation entrance
4、 start-up / close redis server
The front desk starts :
# The front desk starts ( Not recommended ), The command line window cannot be closed , Otherwise, the server stops redis -serverBackground start :
1、 Backup redis.conf
# A copy of redis.conf Go to other directories cp /opt/redis-3.2.5/redis.conf /myredis2、 modify redis.conf(128 That's ok ): Background startup settings daemonize no Change to yes
3、Redis start-up
# start-up redis redis-server /myredis/redis.conf4、 Test verification
# visit redis redis-cli # Port access redis redis-cli -p6379 [[email protected] bin]# redis-cli 127.0.0.1: 6379> 127.0.0.1: 6379> ping PONG5、Redis close
# Single instance close : redis-cli shutdown # The specified port is closed : redis-cli -p 6379 shutdown # You can also enter the terminal and then close it redis-server /myredis/redis.conf shutdown
Redis A single thread + multiple IO Multiplexing technology
port 6379 To come from :
Default 16 A database , Similar array subscript from 0 Start , Initial default use 0 Signal library
Use command select <dbid> To switch databases . Such as : select 8
Unified password management , All libraries have the same password .
dbsize : Check the... Of the current database key The number of
flushdb : Empty the current library
flushall : Kill all the warehouses
Redis A single thread + multiple IO Multiplexing technology .
Multiplexing It refers to using one thread to check multiple file descriptors (Socket) The ready state of , For example, call select and poll function , Pass in multiple file descriptors , If there is a file descriptor ready , Then return to , Otherwise it blocks until it times out . After getting the ready state, the real operation can be executed in the same thread , You can also start thread execution ( Like using thread pools )
Serial vs Multithreading + lock (memcached) vs Single thread + multiple IO Reuse (Redis):
( And Memcache Three different things : Supports multiple data types , Support persistence , Single thread + multiple IO Reuse )
边栏推荐
- The meaning and calculation method of receptive field
- About DDNS
- Introduction to QT qfileinfo
- What is the difference between software engineer and software development? What is the difference between software engineer and software developer?
- VerilogA - counter
- jetson tx2
- 用机器人教育创造新一代生产和服务工具
- Yyds dry goods inventory meituan's two-sided experience, and finally there was a surprise?
- Qt foreach关键字
- Json对象和Json字符串的区别
猜你喜欢

Mongostat performance analysis

To: Hou Hong: the key to enterprise digital transformation is not technology, but strategy

大型化工企业数字化转型建议

How to fix Error: Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorli

Qt QFrame详解

Labor skills courses integrated into steam Education

百度小程序自动提交搜索

mongostat性能分析

How does schedulerx help users solve distributed task scheduling problems?

Chapter IV introduction to FPGA development platform
随机推荐
Service grid ASM year end summary: how do end users use the service grid?
Exclusive download. Alibaba cloud native brings 10+ technical experts to bring new possibilities of cloud native and cloud future
Introduction to QT qfileinfo
Go basic data types: characters and strings
QT custom bit operation class
百度小程序自动提交搜索
WDCP accesses all paths that do not exist and jumps to the home page without returning 404
数据库-同义词
JDBC connects to the database and socket sends the client.
软件工程师与软件开发区别? Software Engineer和Software Developer区别?
jetson tx2
Why should enterprises do more application activities?
Qt QFrame详解
Output of character pointer to string in C language
Object detection - VIDEO reasoning using yolov6
Illustrate plug-in -- AI plug-in development -- creative plug-in -- astute graphics -- multi axis mirroring function
List collection implements paging
[C language] flexible array
Antd work item memo w3.0
VerilogA - counter