current location:Home > Technical Articles > Database > Redis
- Direction:
- All web3.0 Backend Development Web Front-end Database Operation and Maintenance Development Tools PHP Framework Daily Programming WeChat Applet Common Problem Other Tech CMS Tutorial Java System Tutorial Computer Tutorials Hardware Tutorial Mobile Tutorial Software Tutorial Mobile Game Tutorial
- Classify:
-
- What is the principle of Sentinel failover in Redis?
- What is Sentinel? Sentinel is a high-availability solution for redis. The master-slave replication we talked about earlier is the basis of high availability. However, pure master-slave replication requires manual intervention to complete failover. Sentinel can solve this problem. In the case of master-slave replication, when the master node fails, Sentinel can automatically detect the failure and complete the failover to achieve true redis high availability. In the Sentinel cluster, Sentinel will monitor the status of all redis servers and other sentinel nodes, detect failures in time and complete transfer, thereby ensuring the high availability of redis. Sentinel Cluster Construction Sentinel is essentially a redis service, but it provides different functions than ordinary redis services.
- Redis 1282 2023-05-27 10:55:17
-
- How Django uses Redis for caching
- 1. Background and significance Server data is updated very frequently. If data is read from the hard disk every time, server resources are wasted and response speed is slowed down. Moreover, the data update frequency is relatively high, which puts a heavy burden on the server. If you save it to the database, you need to create an additional corresponding table to store the data. The usual way to create a table in Django is to create a model. It seems simple, but it is troublesome to debug and takes a long time to develop. In order to accelerate the server, Redis is used for caching. 2. The configuration steps are as follows 1. Install redis on the server side (1) Install redis on Windows to facilitate testing that Redis does not support Windows! It’s clearly written on its official website. But the development environment is generally a Windows system. To facilitate development
- Redis 1080 2023-05-27 10:52:16
-
- What is the use of turning off SWAP in Redis?
- Turn off SWAPSWAP is a memory swapping technology. Copy the memory to the preset disk space in pages. Memory is fast and expensive. Disks are slow and cheap. Generally, the more SWAP is used, the lower the system performance will be. Redis is an in-memory database, and using SWAP will cause rapid performance degradation. It is recommended to leave enough memory and turn off SWAP.
- Redis 1070 2023-05-27 10:30:42
-
- When to choose Redis
- 1. For complex data structures, it is more appropriate to choose redis. When the value is a complex data structure such as a hash, list, set, or ordered set, redis will be chosen because mc cannot meet these needs. The most typical scenarios include user order lists, user messages, post comment lists, etc. 2. Persistence, redis is more suitable. MC cannot meet the persistence needs, so it has to choose redis. However, what I want to remind you here is, are you really using the persistence function of redis correctly? Never use redis as a database: redis's regular snapshots cannot guarantee that data will not be lost; redis's AOF will reduce efficiency and cannot be supported. The amount of data is too large; don’t expect that redis will perform better than my for solidified storage.
- Redis 1800 2023-05-27 10:28:16
-
- How redis implements online encryption
- 1. Change the password of redis: Note that both must be modified>>configsetrequirepasspassword>>authpassword>>configgetmasterauth2. Change the password of redis sentinel>>info>>sentinelsetmaster-nameauth-passpassword. Check whether the password of the sentinel configuration information is written in echo "masterauthpassword">> redis.conf4, check redis
- Redis 1017 2023-05-27 10:17:07
-
- How to use caffeine_redis to customize the second level cache
- The question is based on the requirements raised. I think there are two main issues: how to ensure data consistency because of the local cache. When the data of one node changes, how does the data of other nodes become invalid? The data is incorrect and needs to be resynchronized. How to invalidate the cache? Flowchart The next step is to cooperate with the product and other developers to draw a flowchart, as follows: Use a configuration table to record whether caching is needed and whether caching is enabled to achieve cache invalidation when notified. Because the project requirements are general, even if the message is lost, there will not be much impact, so we finally chose the subscription and publishing functions in redis to notify other nodes of invalid local cache. The development issues are clear, and the flow chart is also clear. Then get ready to start writing bugs. The overall idea is to
- Redis 1237 2023-05-27 10:08:24
-
- How to build a redis cluster under centos
- Necessary tools: redis-3.0.0.tarredis-3.0.0.gem (ruby and redis interface) Analysis: First, the number of clusters requires a base. Here is a simple redis cluster (6 redis instances for clustering). Operates on one server, so only 6 different port numbers are required. They are: 7001, 7002, 7003, 7004, 7005, 7006. Steps: 1. Upload redis-3.0.0.tar to the server (specify your own software directory) and decompress redis-3.0.0.tar. 2. Install the c language environment (after installing centos, it comes with the c language environment) yuminst
- Redis 1542 2023-05-27 10:04:28
-
- How to synchronize MySQL data to Redis cache
- 1Mysql checks the data and then writes it to Redis synchronously. Disadvantage 1: It will cause delay to the interface, because synchronous writing to redis itself has delays and requires retrying. If redis writing fails, it needs to be retried. Then It's even more time consuming. Disadvantage 2: No decoupling. If redis crashes, the thread will be blocked directly. Disadvantage 3: If someone is the database, it cannot be synchronized unless the corresponding Redis is manually deleted, but there is also a time difference in the process of deleting Redis. 2Mysql check After completing the data, send MQ to synchronize Redis in the consumer thread. Disadvantage 1: There are more layers of MQ, which means there is a high probability of causing synchronization delay problems. Disadvantage 2: Prevent the availability of MQ. Disadvantage 3: If
- Redis 1394 2023-05-27 09:08:10
-
- How SpringBoot integrates Spring Cache to implement Redis caching
- 1. Introduction SpringCache is a framework that implements annotation-based caching functions. You only need to simply add an annotation to implement the caching function. SpringCache provides a layer of abstraction, and the bottom layer can switch different cache implementations. Specifically, different caching technologies are unified through the CacheManager interface. CacheManager is an abstract interface for various caching technologies provided by Spring. This is the default caching technology and is cached in Map. This also means that when the service hangs up, the cached data will be gone. Different caching technologies need to implement different CacheManagerCacheManager description EhCacheCach
- Redis 1272 2023-05-27 08:47:11
-
- How to implement a universal Redis addition, deletion, modification and query script
- 1. Think about what duplicate codes there are?If it is just for simple addition, deletion, modification and query, then you only need to tell me which class needs to be serialized and deserialized, and tell me what the prefix of the key is, isn't that enough? As for the expiration time, we can ignore it this time. If we need to add the expiration time, it is not a difficult thing. Then we think about it for a while and use generics in Java to get the following basic class: 2 .Basic service class publicclassBasicDataRedisService{/***RediskeyprefixString*key prefix in Redis*/privateStringprefixString;p
- Redis 1382 2023-05-27 08:28:35
-
- How to use redis to create a flash sale support demo
- Use redis to deduct inventory for flash sales, limiting each account to only one snap-up. This simple demo uses three basic types: string, hash, and list. Use int values of string type to store the remaining inventory, and reduce it after the snap-up is successful. 1. Use hash to store the ID of the member who has been "sold out" (to ensure the uniqueness of the user ID as a field). Note: The uid corresponding to the hash field may not necessarily be a successful snap up. Use a list to save the ID of a member who has actually been snapped up successfully. When I first wrote the list as a queue for subsequent processing of orders, I tried to use the bitmap of string to save whether the member had successfully purchased, but
- Redis 1496 2023-05-27 08:22:48
-
- What are the persistence solutions in redis?
- What are the persistence methods? What's the difference? Redis persistence solutions are divided into two types: RDB and AOF. RDBRDB persistence can be executed manually or periodically according to the configuration. Its function is to save the database status at a certain point in time to an RDB file. The RDB file is a compressed binary file through which the database status at a certain moment can be restored. state. Since the RDB file is saved on the hard disk, even if redis crashes or exits, as long as the RDB file exists, it can be used to restore the database state. RDB files can be generated through SAVE or BGSAVE. The SAVE command will block the redis process until the RDB file is generated. During the process blocking, re
- Redis 765 2023-05-27 08:08:02
-
- How to quickly deploy Redis with Docker
- 1 Find the redis image on DockerHub [root@wugenqiangredis] #dockersearchredis2pull image [root@wugenqiang~] #dockerpullredis:3.2 Here we pull the official image, labeled 3.23 Run image [root@wugenqiangredis] #dockerrun-d--nameredis -server-p6379:6379-v$PWD/data:/data-dredis:3.2--requirepass"123456"
- Redis 790 2023-05-27 08:07:56
-
- What are the persistence methods of Redis?
- Why is persistence needed? Normally, all redis data is stored in memory. Once the database fails and is restarted, all data will be lost. Even in rediscluster or redissentinel mode, the recovery of master-slave synchronization data still takes some time. The persistence function can effectively avoid data loss caused by process exit. Data can be restored by using the previously persisted files during the next restart. After Redis persistence is turned on, the data will be stored on the disk, and the time it takes for the database to perform incremental synchronization is much less than full synchronization. Data recovery from failures plays a very important role in a production environment! There are two options for Redis data persistence. There are two options for Redis persistence.
- Redis 2735 2023-05-27 08:02:59
-
- How to use docker to start redis and access it remotely on Linux
- 1. Install docker on centos71. Install some necessary system tools yuminstall-yyum-utilsdevice-mapper-persistent-datalvm22. Install docker’s yum source yum-config-manager--add-repohttp://download.docker.com/linux /centos/docker-ce.repo#Central warehouse yum-config-manager--add-repohttp://mirrors.aliyun.com/docker-ce
- Redis 2874 2023-05-27 08:01:10