Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between redis cluster and redis distributed?

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

What is the difference between redis clusters and redis distributed? Perhaps many people do not understand, in order to let you understand better, the editor summed up the following content, I hope you can gain something according to this article.

Distributed refers to the split of the business system, that is, each distributed node is to achieve different functions.

A cluster is a group of service entities that work together to provide a service platform with more scalability and availability than a single service entity.

To put it simply, distribution improves efficiency by shortening the execution time of a single task, while clustering improves efficiency by increasing the number of tasks executed per unit time.

Redis Cluster cluster mode usually has the characteristics of high availability, scalability, distribution, fault tolerance and so on. There are generally two kinds of Redis distributed schemes:

Client partition scheme

The client has decided which redis node the data will be stored on or which redis node to read the data from. The main idea is to use the hash algorithm to hash the key of Redis data. Through the hash function, a specific key will be mapped to a specific Redis node.

The representative of the client partition scheme is Redis Sharding,Redis Sharding, which is the Redis multi-instance cluster method commonly used in the industry before Redis Cluster came out. Java's Redis client driver library Jedis supports the Redis Sharding function, namely ShardedJedis and ShardedJedisPool combined with cache pools.

Advantages

Without the use of third-party middleware, the partition logic is controllable, the configuration is simple, there is no association between nodes, it is easy to expand linearly and has strong flexibility.

Shortcoming

The client cannot dynamically add or delete service nodes, and the client needs to maintain the distribution logic on its own. There is no connection sharing between the clients, which will result in a waste of connections.

Agent partition scheme

The client sends a request to an agent component, which parses the client's data, forwards the request to the correct node, and finally replies the result to the client.

Advantages: simplifying the distributed logic of the client, transparent access of the client, low switching cost, forwarding and storage separation of the agent. Disadvantages: there is an additional proxy layer, which increases the complexity of architecture deployment and performance loss.

The mainstream implementations of proxy partition are Twemproxy and Codis.

Twemproxy

Twemproxy, also known as nutcraker, is an open source redis and memcache proxy server program for twitter. As a proxy, Twemproxy can accept access from multiple programs, forward it to each Redis server in the background according to the routing rules, and then return the same way. Twemproxy has a single point of failure, so it is necessary to combine Lvs and Keepalived to make a highly available solution.

Advantages: wide range of application, high stability, high availability of intermediate agent layer. Disadvantages: no smooth horizontal capacity expansion / reduction, no visual management interface, unfriendly operation and maintenance, failure, can not be transferred automatically.

Codis

Codis is a distributed Redis solution, and for upper-level applications, there is no difference between connecting Codis-Proxy and directly connecting to native Redis-Server. The underlying layer of Codis will handle the forwarding of requests and carry out data migration without downtime. Codis uses a stateless proxy layer, and everything is transparent to the client.

Advantages

It realizes the high availability of upper Proxy and bottom Redis, data fragmentation and automatic balance, provides command line interface and RESTful API, provides monitoring and management interface, and can add and delete Redis nodes dynamically.

Shortcoming

The deployment architecture and configuration are complex, cross-server rooms and multi-tenancy are not supported, and authentication management is not supported.

After reading the above, do you have any further understanding of the difference between redis clustering and redis distribution? If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report