当前位置:网站首页>Redis cluster
Redis cluster
2022-07-06 09:14:00 【~Pompeii】
Catalog
Redis And cluster colony
1. Cluster introduction
Cluster is to use the network to connect several computers , And provide a unified way of Management , Make it present the service effect of single machine
2. Cluster function
1. Disperse the access pressure of a single server , Load balancing
2. Disperse the storage pressure of a single server , Achieve scalability
3. Reduce the business disaster caused by single server downtime
3. Cluster data storage design
%16384 It's modular operation
If you add another server , Or a server suddenly goes down , What do I do ?
37 The small box is called ” Slot “
If you add another server now , Or a server suddenly goes down , What do I do ?
The following example is 3 Servers , Another server has been added , Turned into 4 individual , Then each of the other three servers takes out a part key To the new server , To optimize .
The so-called adding nodes and removing nodes actually change the location of the slot
4. The design of communication within the cluster
1. Now there are clients to access the database , Conduct key Lookup ,key After being calculated by two algorithms , obtain key Location of the corresponding storage slot , Suppose the result of the calculation is A Inside 35 Slot No , If one hit, it will return directly , If you miss ,35 Slot number will be based on this key Search for , Tell the client that it is B In that slot , The client will go again B Find the slot inside ( Be careful : No A Go find , Is the client to find , Avoid clients from going to other places for many times and looking for them one by one )
2. You can hit it twice at most
Be careful : The number of slots in each database is not necessarily continuous , It's scattered
5. Cluster building method
1. Native installation ( Single command )
1) Configure server (3 Lord 3 from )
2) Establish communication (Meet)
3) Slotting (Slot)
4) Build master slave (master-slave)
2. Tool installation ( The batch )
6.cluster To configure
1.cluster-enabled yes|no
Add the server as a node
2.cluster-config-file
cluster Profile name , This file is automatically generated .
If we give you a name , Will automatically generate the specified name cluster-config-file ;
If we don't give you a name , A default name will be automatically generated cluster-config-file ;
give an example :cluster-config-file nodes-6379.conf
And it's only used to quickly find files .
( notes : We try to assign a name , Because it is generated by default in the case of a large number of nodes cluster-config-file The file names are the same , Easy to confuse )
3.cluster-node-timeout
Node service response timeout , Used to determine whether the node is offline or switched to a slave node
4.cluster-migration-barrier
master Connected slave Minimum quantity
7.cluster Node operation command
1. View the cluster node information
cluster nodes
2. Enter a slave node redis, Switch its master node
cluster replicate <master-id>
3. Find a new node , Add master node
cluster meet ip:port
4. Ignore one without solt The node of
cluster forget <id>
5. Manual failover
cluster failover
8.redis-trib command
redis-trib Equivalent to a script , hold cluster Some of the commands are optimized , In practice cluster Own command or redis-trib Everything can be ordered
1. Add a node
redis-trib.rb add-node
2. Delete node
redis-trib.rb del-node
3. The shard
redis-trib.rb reshard
边栏推荐
- Blue Bridge Cup_ Single chip microcomputer_ Measure the frequency of 555
- BN folding and its quantification
- Once you change the test steps, write all the code. Why not try yaml to realize data-driven?
- What is an R-value reference and what is the difference between it and an l-value?
- LeetCode:221. Largest Square
- An article takes you to understand the working principle of selenium in detail
- Detailed explanation of dynamic planning
- Advanced Computer Network Review(3)——BBR
- The carousel component of ant design calls prev and next methods in TS (typescript) environment
- Intel distiller Toolkit - Quantitative implementation 2
猜你喜欢
随机推荐
Redis之性能指标、监控方式
BN folding and its quantification
Intel distiller Toolkit - Quantitative implementation 2
Mathematical modeling 2004b question (transmission problem)
Advanced Computer Network Review(5)——COPE
LeetCode41——First Missing Positive——hashing in place & swap
[oc]- < getting started with UI> -- common controls - prompt dialog box and wait for the prompt (circle)
Mongodb installation and basic operation
如何正确截取字符串(例:应用报错信息截取入库操作)
Advance Computer Network Review(1)——FatTree
LeetCode:236. The nearest common ancestor of binary tree
Export IEEE document format using latex
Redis之哨兵模式
Improved deep embedded clustering with local structure preservation (Idec)
LeetCode:673. Number of longest increasing subsequences
[MySQL] limit implements paging
Leetcode: Jianzhi offer 03 Duplicate numbers in array
[Hacker News Weekly] data visualization artifact; Top 10 Web hacker technologies; Postman supports grpc
Leetcode problem solving 2.1.1
xargs命令的基本用法