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:
-
- How Redis uses optimistic locking to ensure data consistency
- In Redis, there is often a situation where the value of a certain key is read, some business logic processing is performed, and then a new value is calculated based on the read value and set again. If client A has just read the key value, and then client B modifies the key value, then there will be a concurrency security issue. Problem simulation assumes that RedisServer has a key named test, which stores a json array [1,2,3]. Let us simulate the situation where client A and client B access modifications at the same time. The code is as follows: Client A: classRedisClientA(username:String,password
- Redis 845 2023-06-02 16:52:42
-
- What are the methods of using Redis cache in SpringBoot?
- 1. Import the Redis dependency org.springframework.bootspring-boot-starter-data-redis 2. Configure redis accordingly in application.properties #redis configuration #Redis server address spring.redis.host=127.0.0.1#Redis server Connection port spring.redis.port=6379#Redis database index (default is 0) spring.redis.database=0#Maximum number of connections in the connection pool (use negative values to indicate no limit) spr
- Redis 1084 2023-06-02 16:52:28
-
- How to use lua for nginx redis access control
- 1. Requirements analysis\1. There are many ways for Nginx to handle access control, and there are many implementation effects, such as access IP segments, access content restrictions, access frequency restrictions, etc. \2. Using Nginx+Lua+Redis for access restriction is mainly to consider the need for fast access control in high concurrency environments. \3. The process of Nginx processing requests is divided into 11 stages, namely: post-read, server-rewrite, find-config, rewrite, post-rewrite, preaccess, access, post-access, try-files, content, log.in open
- Redis 1052 2023-06-02 16:31:15
-
- What is the default serialization method for modifying Springsession redis?
- 1. The key configurations for configuring Spring-session-redis are as follows: 2. View the RedisHttpSessionConfiguration source code as follows: @BeanpublicRedisTemplatesessionRedisTemplate(RedisConnectionFactoryconnectionFactory){RedisTemplatetemplate=newRedisTemplate();template.setKeySerializer(newStringRedisSerializer()
- Redis 1528 2023-06-02 15:58:46
-
- How to set redis to start automatically at boot under Linux
- The specific method of setting up redis to start automatically on Linux 1. Set daemonize in redis.conf to yes to ensure that the daemon process is enabled. 2. Write the self-starting script vi/etc/init.d/redis. Look at the directory clearly. You are creating a new redis file under etc/init.d. Why? Because Linux will execute the file writing script in this directory when booting. I don’t know how to write the script. , but there are people on the Internet who know it, just bring it #chkconfig:23451090#description:StartandStopredisPATH=/usr/local/bin:/sbin:/usr/bin:/bin
- Redis 8481 2023-06-02 15:52:06
-
- How to configure the Redis SpringBoot class
- importorg.springframework.context.annotation.Bean;importorg.springframework.context.annotation.Configuration;importorg.springframework.data.redis.connection.RedisConnectionFactory;importorg.springframework.data.redis.core.RedisTemplate;importorg.spri
- Redis 1235 2023-06-02 15:37:11
-
- How to use Redis in SpringBoot
- 1. The maven dependencies are as follows. It should be noted that spring-boot-starter-data-redis uses lettuce as the redis client driver by default, but lettuce is less practical. We often use jedis as the client driver. So lettuce is excluded here and jedis is introduced: org.springframework.bootspring-boot-starter-data-redisio.lettucelettuce-coreredis.clientsjedis2. Dependencies springdatar
- Redis 2242 2023-06-02 14:43:21
-
- How to implement Redis publish and subscribe
- Suppose we have such a business scenario. After placing an order and paying on the website, we need to notify the inventory service for delivery processing. It is not difficult to implement the above business. We only need to provide the inventory service to the relevant outlets, and after placing the order and paying, we only need to call the inventory service. If there is a new business later, such as points service, he needs to obtain the order payment results and then increase the user's points. This is not difficult to implement. The points service also provides an interface. After placing an order and paying, you only need to call the inventory service. If you only need to obtain the order and payment results for two businesses, that's okay, and the program modification will be quick. However, as the business continues to develop, more and more new businesses are said to be the result of placing orders and paying. At this time we will find that there are many problems with the system architecture above: Chapter 1
- Redis 1831 2023-06-02 14:37:56
-
- Three methods of Redis deletion strategy and analysis of eviction algorithm examples
- 1. Preface Before the article begins, let me ask you a question: When we use the command: expirekeysecond to set the expiration time for a key, once the expiration time is up, is the expired data corresponding to this key really deleted immediately by the server? The answer is that it will not be deleted immediately. Knowing this answer, let's take a look at how expired data is handled in Redis. 2. Data characteristics in Redis Redis is a memory-level database. All data is stored in the memory. The data in the memory can obtain its status through TTL instructions. There are three states: Instruction result status XX Time-sensitive data -1 Permanently valid data - 2 Expired data or deleted data or undefined data 3. Timeliness number
- Redis 1673 2023-06-02 13:43:34
-
- How to install PHP7 Redis extension on CentOS7
- Note when installing extensions: The first time you use a non-root user, you fail. If you switch to a root user, you will successfully download the extension package. After finding the matching version, wget downloads it to the server, decompresses it and enters the directory tarzxfredis-4.0.1.tgz, cdredis- 4.0.1; Find phpize and execute. Find php-config and configure make&&makeinstall. After compilation, redis.io is already in the /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/ extension directory. ;Modify php.ini to add
- Redis 1290 2023-06-02 11:46:06
-
- How to implement EMQ X Redis data persistence
- Introduction to EMQX data persistence. The main usage scenarios of data persistence include recording operations such as client online and offline status, subscription topic information, message content, and sending message receipts after message arrival to Redis, MySQL, PostgreSQL, MongoDB, Cassandra, AWS DynamoDB, etc. A class database is used for quick query by external services or retains the current running state when the service is down or the client is abnormally offline, and is restored to the previous state when the connection is restored; persistence can also be used for client agent subscriptions. When the device client comes online, persistence The module loads preset topics directly from the database and completes proxy subscription, reducing system design complexity and client subscription communication overhead. Users can also subscribe by
- Redis 1954 2023-06-02 11:43:37
-
- How Docker deploys SpringBoot projects and integrates Redis images for access counting
- The final effect is as follows: 1. Install DockerCE2. Run the Redis image 3. Java environment preparation 4. Project preparation 5. Write Dockerfile 6. Release the project 7. Test service environment preparation system: Ubuntu17.04x64Docker17.12.0-ceIP:45.32. 31.101 1. Installing DockerCE in China is not recommended: "Script to install", the download and installation will be very slow, use step 1 to install, see the link below: Conventional installation method 1. Conventional installation method Ubuntu17.04x64 installs DockerCE2. Script to install domestically It is not recommended to use scripts for installation: Install DockerCE
- Redis 836 2023-06-02 10:37:14
-
- How to build a redis-sentinel cluster based on docker
- 1. Overview Redis cluster can achieve high availability and sharding among a group of redis nodes. There will be 1 master and multiple slave nodes in the cluster. When the master node fails, a slave node should be elected as the new master. However, redis itself (including many of its clients) does not have the ability to implement automatic fault discovery and perform active-standby switching, and requires an external monitoring solution to achieve automatic fault recovery. redissentinel is the officially recommended high availability solution. It is a monitoring and management tool for redis clusters, which can provide node monitoring, notification, automatic fault recovery and client configuration discovery services. 2. Problems encountered 1. dock
- Redis 1010 2023-06-02 10:19:05
-
- How spring boot integrates redis master-slave sentinel method
- Springboot integrates redis master-slave sentinel one master, two slaves and three sentinel configuration 1, master:127.0.0.1:63792, slave1:127.0.0.1:63803, slave2:127.0.0.1:63814, sentinel1:127.0.0.1:263795, sentinel2:127.0 .0.1:264796, sentinel3:127.0.0.1:265797, monitoring host name: mymaster8, attach the configuration of sentinel1 port26379sentinelmonitorm
- Redis 1885 2023-06-02 09:22:21
-
- How to realize flash sale scenario of inventory reduction through redis
- The main purpose of Redis inventory reduction is to reduce access to the database. The previous inventory reduction directly accessed the database and read the inventory. When high concurrent requests come, a large amount of read data may cause the database to crash. Usage idea: When the system is initialized, the product inventory is loaded into the Redis cache and saved. When receiving the request, first get the inventory value of the product in Redis and pre-reduce the inventory. If the inventory is insufficient after the reduction is completed, a logical Exception will be returned directly and there is no need to access the database to reduce the inventory. If the inventory value is correct, Go to the next step. Enqueue the request and immediately return a value to the front end, indicating that it is being queued, and then perform the flash killing logic. The back end queue performs the flash killing logic, and the front end polls the back end to send the request.
- Redis 902 2023-06-02 09:04:20