current location:Home > Technical Articles > Database > Redis

  • How to implement Redis distributed lock and what are its application scenarios
    How to implement Redis distributed lock and what are its application scenarios
    Introduction Lock is a very common tool in the development process. You must be familiar with it, such as pessimistic lock, optimistic lock, exclusive lock, fair lock, unfair lock, etc. There are many concepts. If you don’t understand locks in Java, you can Refer to this article: Java "locks" that must be mentioned. This article is very comprehensive. However, for beginners who know the concepts of these locks, due to lack of practical work experience, they may not understand the actual usage scenarios of unlocking. In Java, thread safety can be achieved through three keywords: Volatile, Synchronized, and ReentrantLock. This part of knowledge will definitely be asked in the first round of basic interviews (you must be proficient in it). In a distributed system, these Java lock technologies cannot lock at the same time.
    Redis 1642 2023-05-30 17:55:51
  • How to implement Redis tens of billions of key storage solutions
    How to implement Redis tens of billions of key storage solutions
    1. Demand background This application scenario is a DMP cache storage requirement. DMP needs to manage a lot of third-party ID data, including the mapping relationship between each media cookie and its own cookie (hereinafter collectively referred to as superid), as well as the superid’s population tag, mobile Population tags of terminal IDs (mainly IDFA and imei), as well as some blacklist IDs, IPs and other data. It is not difficult to store hundreds of billions of records offline with the help of HDFS. However, DMP also needs to provide millisecond-level real-time queries. Since the cookie ID itself is unstable, the browsing behavior of many real users will result in the generation of a large number of new cookies. Only mappi can be synchronized in a timely manner.
    Redis 1133 2023-05-30 17:44:44
  • How to install and configure redis in Ubuntu
    How to install and configure redis in Ubuntu
    Use the command line to update all software packages sudoapt-getupdate######Install the Redis database in LinuxUbuntu```LINUX#Install the Redis server~sudoapt-getinstallredis-serverAfter the installation is completed, the Redis server will automatically start, we check Redis server program#Check the Redis server system process~ps-aux|grepredisredis41620.10.0106761420?Ss23:240:00/usr/bin/redis-server/etc/redis/redis.
    Redis 1592 2023-05-30 17:31:06
  • How to connect php to redis
    How to connect php to redis
    PHP connection redis$redis=newRedis();$redis->connect('127.0.0.1',6379);echo "Connectiontoserversuccessfully";//Check whether the service is running echo "Serverisrunning:".$redis->ping(); 1. Set key/value, check whether key exists, delete key, modify key$redis->set('db&am
    Redis 1842 2023-05-30 17:29:21
  • What are the visualization tools for Redis?
    What are the visualization tools for Redis?
    1. Command line 1.1, iredis Use iredis, use | to pass redis through the pipe and use other shell tools, such as jq/fx/rg/sort/uniq/cut/sed/awk, etc. to process. It can also auto-complete, highlight, and have many functions. Official website address: https://iredis.io/2, Visualization Tool 2.1, Desktop Client Version 2.1.1, RedisDesktopManager This tool should be the most widely used visualization tool now. It has been around for a long time. It went through several iterations. Cross-platform support. It used to be free, but now it's a paid tool. The trial can last for half a month. [Related recommendations: Redis view
    Redis 3187 2023-05-30 17:15:09
  • How Docker-Compose builds a Redis cluster
    How Docker-Compose builds a Redis cluster
    1. The cluster configuration of 3 masters + 3 slaves is only for testing, so I only use one server to simulate the redis list. 2. Write redis.conf and create a directory on the server to store the redis cluster deployment files. The path I put here is /root/redis-cluster. Create redis-1, redis-2, redis-3, redis-4, redis-5, redis-6 folder mkdir in the /opt/docker/redis-cluster directory. -p/opt/docker/redis-cluster/{redis-1,redis-2,redis-3
    Redis 1773 2023-05-30 16:46:22
  • What are the persistence methods of Redis?
    What are the persistence methods of Redis?
    Redis is single-threaded, why is it so fast? Based on memory, most requests are pure memory operations, and the CPU is not the bottleneck of Redis. Avoid unnecessary CPU context switching and other race conditions, such as lock operations, etc. The bottom layer uses a multi-channel I/O multiplexing model and non-blocking IO. Redis supports multi-threading after 6, but it is not enabled by default. What are the persistence methods of redis? Let’s talk about their differences. Supports AOF and RDB persistence. AOF records every write and delete operation processed by the server in the form of a log. Query operations are not recorded and are recorded in text form. It supports second-level persistence and has good compatibility. For the same number of data sets, AOF files are usually larger than RDB files, so
    Redis 1323 2023-05-30 16:25:12
  • How to deploy redis on linux
    How to deploy redis on linux
    1. Download the Linux version of redis from the official website 2. Copy it to the linux server and unzip it to the specified directory 3. After unzipping, get the redis folder ----- move it to a file location you know 4. Note: redis is written in C language and needs Relying on the c language environment yuminstallgcc-c++tcl, enter the redis installation directory and execute make---------------Compile redis Note: Make compilation of redis6 or above may report an error, and you need to upgrade the gcc version# One step sudoyuminstallcentos-release-scl#The second step sudoyuminstalldevto
    Redis 1155 2023-05-30 16:08:13
  • Redis command usage example analysis
    Redis command usage example analysis
    The cause of the problem is that the application the editor is responsible for is a management background application. Shiro framework is used for permission management. Since there are multiple nodes, distributed Session needs to be used, so Redis is used to store Session information. Since Shiro does not directly provide the Redis storage Session component, Afan had to use shiro-redis, an open source component from Github. Since the Shiro framework needs to regularly verify whether the Session is valid, the bottom layer of Shiro will call SessionDAO#getActiveSessions to obtain all Session information. And shiro-redis just inherits Session
    Redis 695 2023-05-30 15:46:52
  • How to set a password for redis in Windows
    How to set a password for redis in Windows
    There are two ways to set a password. 1. Set the password on the command line. Run cmd to switch to the redis root directory. First start the server>redis-server.exe. Open another cmd to switch to the redis root directory. Start the client>redis-cli.exe-h127.0.0.1-p6379. Use the configgetrequirepass command on the client. View password>configgetrequirepass1)"requirepass"2)""//The default empty client uses configsetrequirepassyourp
    Redis 8475 2023-05-30 14:40:23
  • How to implement Redis BloomFilter Bloom filter
    How to implement Redis BloomFilter Bloom filter
    BloomFilter concept Bloom filter (English: BloomFilter) was proposed in 1970 by a young man named Bloom. It's actually a long binary vector and a series of random mapping functions. Bloom filters can be used to retrieve whether an element is in a collection. Its advantage is that space efficiency and query time are far higher than those of ordinary algorithms. Its disadvantage is that it has a certain misrecognition rate and difficulty in deletion. BloomFilter Principle The principle of the Bloom filter is that when an element is added to the set, the element is mapped into K points in a bit array through K hash functions and set to 1. When retrieving, we only need to see if these points are all 1 to (approximately) know whether it is in the set:
    Redis 1533 2023-05-30 13:41:09
  • How to implement Redis Zset operation in php
    How to implement Redis Zset operation in php
    Zset operation //Add one or more member elements and their score values ​​to the ordered set. If a member is already a member of the ordered set, update the member's score and re-insert the member element to ensure that the member is in the correct position. Fractional values ​​can be integer values ​​or double-precision floating point numbers. $ret=$redis->zAdd('scores',98,'English',90,'physics');//Return the members in the specified range in the ordered set. Members are sorted in ascending order by score, and those with the same score are sorted in dictionary order.
    Redis 1063 2023-05-30 13:28:14
  • What is the method for redis to implement session sharing?
    What is the method for redis to implement session sharing?
    Introduction Many projects in big factories are deployed on multiple servers. These servers exist in various regions. When we access the service, although the same service is executed, it may be run by different servers; when I was studying the project, I encountered In such a login scenario, assuming there are the following three servers (as shown in the figure), the session is used to store the user's login information. This information can be used to determine whether the user is logged in: Assuming that this login is performed through server 01, then this login The session information is stored in memory 01; but when I visit again, server 02 performs the operation, but the login session information is in memory 01, and server 02 cannot obtain it, so it will judge that I am not logged in and return an error.
    Redis 2115 2023-05-30 13:28:06
  • Springboot cache redis integration method
    Springboot cache redis integration method
    By default, ConcurrentMapCache of ConcurrentMapCacheManager is used as the cache component. When using ConcurrentMap, the data is saved in ConcurrentMap. In fact, during the development process, we often use some caching middleware. For example, we often use redis, memcache, including the ehcache we use, etc. We all use some caching middleware. When we explained the principle before, we also discovered that springboot supports many cache configurations: as shown in the figure below: the default starting configuration is: SimpleCache
    Redis 774 2023-05-30 13:22:12
  • Example analysis of redis deployment and commands used for various data types
    Example analysis of redis deployment and commands used for various data types
    Compile and install redis and start deployment [root@mcw01~]$lsanaconda-ks.cfgmongodb-linux-x86_64-3.2.8.tgz[root@mcw01~]$wgethttp://download.redis.io/releases/redis-4.0. 10.tar.gz--2022-03-0518:27:02--http://download.redis.io/releases/redis-4.0.10.tar.gzResolvingdownload.redis.io(dow
    Redis 705 2023-05-30 13:09:34

Tool Recommendations

jQuery enterprise message form contact code

jQuery enterprise message form contact code is a simple and practical enterprise message form and contact us introduction page code.
form button
2024-02-29

HTML5 MP3 music box playback effects

HTML5 MP3 music box playback special effect is an mp3 music player based on HTML5 css3 to create cute music box emoticons and click the switch button.

HTML5 cool particle animation navigation menu special effects

HTML5 cool particle animation navigation menu special effect is a special effect that changes color when the navigation menu is hovered by the mouse.
Menu navigation
2024-02-29

jQuery visual form drag and drop editing code

jQuery visual form drag and drop editing code is a visual form based on jQuery and bootstrap framework.
form button
2024-02-29

Organic fruit and vegetable supplier web template Bootstrap5

An organic fruit and vegetable supplier web template-Bootstrap5
Bootstrap template
2023-02-03

Bootstrap3 multifunctional data information background management responsive web page template-Novus

Bootstrap3 multifunctional data information background management responsive web page template-Novus
backend template
2023-02-02

Real estate resource service platform web page template Bootstrap5

Real estate resource service platform web page template Bootstrap5
Bootstrap template
2023-02-02

Simple resume information web template Bootstrap4

Simple resume information web template Bootstrap4
Bootstrap template
2023-02-02

Cute summer elements vector material (EPS PNG)

This is a cute summer element vector material, including the sun, sun hat, coconut tree, bikini, airplane, watermelon, ice cream, ice cream, cold drink, swimming ring, flip-flops, pineapple, conch, shell, starfish, crab, Lemons, sunscreen, sunglasses, etc., the materials are provided in EPS and PNG formats, including JPG previews.
PNG material
2024-05-09

Four red 2023 graduation badges vector material (AI EPS PNG)

This is a red 2023 graduation badge vector material, four in total, available in AI, EPS and PNG formats, including JPG preview.
PNG material
2024-02-29

Singing bird and cart filled with flowers design spring banner vector material (AI EPS)

This is a spring banner vector material designed with singing birds and a cart full of flowers. It is available in AI and EPS formats, including JPG preview.
banner picture
2024-02-29

Golden graduation cap vector material (EPS PNG)

This is a golden graduation cap vector material, available in EPS and PNG formats, including JPG preview.
PNG material
2024-02-27

Home Decor Cleaning and Repair Service Company Website Template

Home Decoration Cleaning and Maintenance Service Company Website Template is a website template download suitable for promotional websites that provide home decoration, cleaning, maintenance and other service organizations. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-05-09

Fresh color personal resume guide page template

Fresh color matching personal job application resume guide page template is a personal job search resume work display guide page web template download suitable for fresh color matching style. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-29

Designer Creative Job Resume Web Template

Designer Creative Job Resume Web Template is a downloadable web template for personal job resume display suitable for various designer positions. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-28

Modern engineering construction company website template

The modern engineering and construction company website template is a downloadable website template suitable for promotion of the engineering and construction service industry. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-28