In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. About Redis
Redis is a Key-Value storage system. Similar to Memcached, it supports storing a relatively large number of value types, including string, list, set, and zset. These data types all support push/pop, add/remove, and take intersection union and subtraction, as well as richer operations, all of which are atomic. On this basis, Redis supports a variety of different ways of sorting. As with memcached, data is cached in memory for efficiency. The difference is that Redis periodically writes updated data to disk or changes to additional log files, and on this basis achieves master-slave synchronization.
1.1 Key-Value Storage System Introduction
Key-Value Store is a popular topic at present, especially when building large-scale Internet applications such as search engines, IM, P2P, game servers, SNS and providing cloud computing services. How to ensure high performance, high reliability, high scalability, high availability and low cost of the system in a massive data environment has become the focus of all system architectures, and how to solve the performance bottleneck of database servers is the biggest challenge. According to the CAP theory of distributed domain (Consistency, Availability, Tolerance to network Partitions), the ACID of traditional relational database only satisfies Consistency and Availability, so it is difficult to do well in Partition tolerance. In addition, traditional relational database has great limitations in Performance Scalability and Availability when dealing with massive data and distributed architecture. Key-Value Store pays more attention to the performance, distribution and scalability support of mass data access, and does not need some characteristics of traditional relational databases, such as Schema, transaction, complete SQL query support, etc., so the performance in distributed environment is greatly improved compared to traditional relational databases.
Redis is an open source, web-enabled, memory-based and persistent log, Key-Value database written in ANSI C and available in multiple languages. Since March 15, 2010, Redis development has been hosted by VMware.
1.2 Redis application scenarios
1.2.1 Getting the Latest N Data
1.2.2 Leaderboard application, select TOP N operation
The difference between this requirement and the above requirement is that the previous operation takes time as the weight, this is based on a certain condition as the weight, such as sorting by the number of times of the top, this time we need our sorted set to go out, set the value you want to sort to the score of the sorted set, set the specific data to the corresponding value, and only need to execute one ZADD command at a time.
1.2.3 Applications that require precise expiration time settings
For example, you can set the score value of the sorted set mentioned above to the timestamp of the expiration time, then you can simply sort through the expiration time, regularly clear the expired data, not only to clear the expired data in Redis, you can completely regard the expiration time in Redis as an index to the data in the database, use Redis to find out which data needs to be deleted, and then accurately delete the corresponding records from the database.
1.3 Redis data type
As a Key-value database, Redis also provides a mapping relationship between keys and values. However, in addition to regular numeric values or strings, Redis keys can also take one of the following forms:
Lists
Sets
Sorted sets
Hashes
The data type of a key determines the operations supported by that key. Redis supports high-level atomic operations such as intersection, union, lookup of lists, sets, or ordered sets, and atomic operations such as self-increment if the key type is a normal number.
The above content comes from Red Pill.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.