当前位置:网站首页>Redis overview
Redis overview
2022-06-26 16:42:00 【JAVA·D·WangJing】
One 、 summary
- Redis Full name Remote Dictionary Server, Remote dictionary service , Is an open source use ANSI C Language writing 、 Support network 、 Log type that can be memory based or persistent 、Key-Value database , And provide multilingual API.
Two 、 Definition
- Redis It's a key-value The storage system . 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 Is a high-performance key-value database . Redis Appearance , A lot of compensation memcached This kind of key/value Insufficient storage , In the department The situation can be a good complement to the relational database . It provides Java,C/C++,C#,PHP,JavaScript,Perl,Object-C,Python,Ruby,Erlang Such as the client , Easy to use .
- Redis Support master-slave synchronization . Data can be synchronized from the master server to any number of slaves , A slave server can be the master server associated with other slaves . This makes Redis Single-layer tree replication can be performed . The disk can write to the data intentionally or unintentionally . Due to the full implementation of the release / Subscribe mechanism , Enables trees to be synchronized anywhere from the database , Subscribe to a channel and receive a complete record of message publication from the master server . Synchronization helps with scalability and data redundancy for read operations .
- Redis Official website :redis.io.( The domain name suffix io It's a country domain , yes british Indian Ocean territory, The British Indian Ocean territory ),Vmware In the fund redis Project development and maintenance .
3、 ... and 、 Data model
- Redis The periphery of the is made up of a key 、 Dictionary composition of value mapping . The main difference from other non relational databases is :Redis The type of median is not limited to strings , The following abstract data types are also supported :
- String list
- An unordered collection of unrepeated strings
- An ordered set of non repeating strings
- key 、 Hash table with string values
- The type of value determines the operation that the value itself supports .Redis Support different kinds of disorder 、 An orderly list , disorder 、 The intersection of ordered sets 、 Union and other advanced server-side atomic operations .
Four 、 data structure
Redis There are five types of data :string,hash,list,set And zset(sorted set).
- string( character string ) Is the simplest type , You can understand that Memcached As like as two peas , One key Corresponding to one value, Supported operations and Memcached Similar to . But it's more functional .Redis Using structure sdshdr and sds Encapsulates the string , String related operations are implemented in the source file sds.h/sds.c in .
- list( Double linked list ) Is a linked list structure , The main functions are push、pop、 Get all the values of a range and so on . In operation key The name of the list . Yes list The definition and implementation of is in the source file adlist.h/adlist.c
- dict(hash surface ) set Is a collection , Similar to the concept of set in our mathematics , Operations on collections include adding and deleting elements , There are operations such as intersection and difference of multiple sets . In operation key The name of a collection . In the source file dict.h/dict.c Implemented in the hashtable The operation of .dict in table by dictEntry An array of pointers , Each member in the array is hash One way linked list of elements with the same value .set Is in dict On the basis of implementation , It specifies key The comparison function of is dictEncObjKeyCompare, if key If it is equal, it will not be inserted .
- zset( Sort set) yes set An updated version of , He was in set Add a sequence attribute based on the , This attribute can be specified when adding modification elements , After each assignment ,zset Automatically reorder to the new value . Understandably, there are two columns of mysql surface , List store value, One column storage order . In operation key Understood as a zset Name .zset utilize dict maintain key -> value The mapping relation of , use zsl(zskiplist) preservation value Ordered relation of .zsl It's actually a cross . Unstable multitree , The elements on each chain are sorted in ascending order from the root node to the leaf node .
5、 ... and 、 Store
Redis Two file formats are used : Full data and incremental requests .
- Full data format is to write data in memory to disk , It is convenient to read the file for loading next time ;
- Incremental request file is to serialize the data in memory into operation request , Used to read files for replay Get data , Serialization operations include SET、RPUSH、SADD、ZADD.
Redis The storage of is divided into memory storage 、 Disk storage and log Three parts of the document , There are three parameters in the configuration file to configure it .
- save seconds updates,save To configure , Indicate how long , How many update operations are there , Synchronize the data to the data file . This can be combined with multiple conditions , Such as the Settings in the default configuration file , There are three conditions .
- appendonly yes/no ,appendonly To configure , Indicates whether to log after each update operation , If you don't turn it on , Data may be lost for a period of time during a power outage . because redis To synchronize the data file itself, press the above save Condition to synchronize , So some data will only exist in memory for a while .
- appendfsync no/always/everysec ,appendfsync To configure ,no Means that the operating system synchronizes the data cache to disk ,always Represents a manual call after each update operation fsync() Write data to disk ,everysec That means once per second .
6、 ... and 、 install And To configure
- Windows Next Redis install :win10 Install redis_JAVA·D·WangJing The blog of -CSDN Blog _redis win10 Installation package
- Linux Next Reids install :Linux Next Redis Installation and configuration (yum Software source download and installation )_JAVA·D·WangJing The blog of -CSDN Blog _redis yum Source
- Docker Next Redis install :Docker Next Redis install _JAVA·D·WangJing The blog of -CSDN Blog
- Redis Service configuration redis.conf Configuration file details :Redis Service configuration redis.conf Configuration file details _JAVA·D·WangJing The blog of -CSDN Blog _redisconf Storage location
- Redis Ban Dangerous orders :Redis Ban Dangerous orders _JAVA·D·WangJing The blog of -CSDN Blog _redis To disable the command
notes : The above contents are only for reference and exchange , Do not use for commercial purposes , If there is infringement, please contact me to delete !
边栏推荐
- [Li Kou brush question] monotone stack: 84 The largest rectangle in the histogram
- In a bad mood, I just write code like this
- 当一个程序员一天被打扰 10 次,后果很惊人!
- Greenplum数据库故障分析——semop(id=2000421076,num=11) failed: invalid argument
- 构造函数和析构函数
- QT 5.9.8 installation tutorial
- MHA switching (recommended operation process)
- 【毕业季】致毕业生的一句话:天高任鸟飞,海阔凭鱼跃
- How to implement interface current limiting?
- 5g is not flat and 6G is restarted. China leads wireless communication. What is the biggest advantage of 6G?
猜你喜欢

内存分区模型

C语言 头哥习题答案截图
![[from database deletion to running] JDBC conclusion (finish the series in one day!! run as soon as you finish learning!)](/img/75/2fb1a4e6215e404df34849e9e4f21a.png)
[from database deletion to running] JDBC conclusion (finish the series in one day!! run as soon as you finish learning!)

Make up the weakness - Open Source im project openim about initialization / login / friend interface document introduction

Research on natural transition dubbing processing scheme based on MATLAB

Natural language inference with attention and fine tuning Bert pytorch

JUnit unit test

Kubecon China 2021 Alibaba cloud special session is coming! These first day highlights should not be missed

This year, the AI score of college entrance examination English is 134. The research of Fudan Wuda alumni is interesting

What does the inner structure of the neural network "alchemy furnace" look like? An interpretation of the thesis by the doctor of Oxford University
随机推荐
Make up the weakness - Open Source im project openim about initialization / login / friend interface document introduction
SAP OData development tutorial - from getting started to improving (including segw, rap and CDP)
电路中缓存的几种形式
"C language" question set of ⑩
Greenplum数据库故障分析——semop(id=2000421076,num=11) failed: invalid argument
5G未平6G再启,中国引领无线通信,6G的最大优势在哪里?
【毕业季】致毕业生的一句话:天高任鸟飞,海阔凭鱼跃
Which position does Anxin securities rank? Is it safe to open an account?
Knowing these commands allows you to master shell's own tools
JS tutorial using electron JS build native desktop application ping pong game
Junit单元测试
【小5聊】毕业8年,一直在追梦的路上
Day10 daily 3 questions (2): count the number of the largest groups
What is flush software? Is it safe to open an account online?
最小二乘系统辨识课 中篇:递归最小二乘
108. simple chat room 11: realize client group chat
Qt 5.9.8 安装教程
Summary of all knowledge points of C language
Tsinghua's "magic potion" is published in nature: reversing stem cell differentiation, and the achievements of the Nobel Prize go further. Netizen: life can be created without sperm and eggs
MS | Xie Liwei group found that mixed probiotics and their metabolites could alleviate colitis