redis Generally, distributed caching is used in the enterprise , Can greatly reduce the cost of high concurrency

Enterprise must not be a stand-alone version Because if it is a stand-alone version, it may cause downtime

redis colony : Two in a group , One host and one standby , The main engine works normally , Standby machine does not work , The standby machine sends one to the host every few seconds ping , The host will send a peng
Spare machine , If you don't return pang, It may be continuous ping Three times , If you don't return, the standby will be on , The standby machine contains all the contents of the host computer , This is called the heartbeat detection mechanism ( The role of high availability ), Master slave hot standby

redis Medium slot The range of slot values is 0-16383, All in all 16384 Slot values , These slot values can be assigned to each group of machines ( At present, there is no such large cluster in China )

We're depositing redis When it comes to data , use key,value The key value of the , Before storage, the key use crc16 Algorithm , You get a pure numeric value , Divide this number by 16384 Take remainder , Where does the remainder fall slot In the range of slot value, this will be key,value Save to the corresponding machine , It's also true when you get data . It plays a role of load balancing , The more clusters, the more uniform , The overall capacity is larger than that of the stand-alone version , That is, expansion .

notes : Downtime is redis Node down

redis Why don't you set a password when deploying online :

It can be seen from the figure that the customer enters the domain name parser first when visiting the website , The domain name resolver resolves the web address into static ip, This static one ip It's a load balancer ( notes : Load balancer can access intranet or extranet ), The load balancer will find the corresponding project module server according to the requirements , The server of the project module finds the corresponding mysql Clusters or redis colony ,tomcat And clusters are generally in the intranet , So you don't have to redis Set password .

Technology