Monitoring tool: Prometheus monitoring middleware (Nginx, Redis, MySql, etc.)

Our products currently use middleware such as Nginx, Redis, RabbitMQ, MySql, etc. This article introduces how to use Promtheus to monitor these middleware. There is a picture in “Monitoring Tool: Introduction and Installation of Prometheus” that shows the data trend of Prometheus, as follows: As can be seen from the figure, the first step in […]

MyBatis Plus integrates Redis to implement distributed second-level cache

MyBatis cache description MyBatis provides two levels of cache, namely first-level cache and second-level cache. The first-level cache is a SqlSession-level cache. It only stores cached data inside the SqlSession object. If the SqlSession objects are different, the cache cannot be hit. The second-level cache is a mapper-level cache. As long as the Mapper class […]

A redis3 master-3-slave cluster built based on hash slots using docker containers

1. Construction background Cluster mode-docker version, hash slot partition for billion-level data storage 1. 100-200 million pieces of data need to be cached. How to design it? Answer: Using distributed storage, there are generally three solutions in the industry The first type: hash remainder partition (generally used by small factories) Disadvantages: The biggest disadvantage of […]

Implementing distributed locks based on redis

Article directory Implementing distributed locks based on redis Basic implementation Anti-deadlock Prevent accidental deletion Atomicity cannot be guaranteed in high concurrency scenarios. Use Lua to ensure deletion atomicity Encapsulate the redis lock into a method Implementing distributed locks based on redis Basic implementation With the help of the command setnx(key, value) in redis, if the […]

Technical breakdown | Why does Redis use different encodings internally?

One weekend night, I suddenly received a wave of alarms about increased time consumption. After a closer look at the alarm message, it turned out that a slow check request occurred, which caused a significant increase in cluster time consumption. At this time, business students also received alarms that upstream services were affected. During the […]

Distributed lock 2 in redisson

Fair Lock The Redisson distributed reentrant fair lock based on Redis is also a RLock object that implements the java.util.concurrent.locks.Lock interface. It also provides asynchronous (Async), reflective (Reactive) and RxJava2 standard interfaces. It ensures that when multiple Redisson client threads request locks at the same time, priority will be given to the thread that made […]

Use redis current limiting — redisson implementation

springboot integrates redisson Please click here Application scenarios Able to accurately limit current flow for specified interfaces Description Redisson uses the leaky bucket algorithm implemented by redis + lua script to limit current Distributed current limiting and stand-alone current limiting can be carried out Use RRateLimiter for current limiting @GetMapping(“/rateLimit”) public String rateLimit(HttpServletRequest request) { […]

springboot integrates redis — spring-boot-starter-data-redis

springboot integrates redis Add dependencies yml configuration file RedisTemplate configuration Serialization redis tool class Current environment springboot version 2.7.17 Add dependencies <!– redis –> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <!– redis depends on commons-pool. This dependency must be added –> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-pool2</artifactId> </dependency> <!– Alibaba JSON parser –> <dependency> <groupId>com.alibaba.fastjson2</groupId> <artifactId>fastjson2</artifactId> <version>2.0.14</version> </dependency> yml configuration […]

Redis cluster configuration

Cluster configuration: Redis minimum cluster planning needs to contain at least three master nodes. Here, the test deployment is a six-node cluster with three master servers and three slave servers. Prerequisite: Prepare the master-slave synchronization server in advance Redis’s master-slave synchronization configuration and sentry mode-CSDN Bloghttps://blog.csdn.net/Cloud_skyen/article/details/134275033?csdn_share_tail={” type”:”blog”,”rType”:”article”,”rId”:”134275033″,”source”:”Cloud_skyen”} Host name ip address Port Relationship redis_1 192.168.50.137 […]

shiro-redis-jwt integration

1. Integrated process logic 2. Integration steps 1. Import the starter package of shiro-redis: There is also the jwt tool package toolkit, and to simplify development, I introduced the hutool toolkit. <!–shiro-redis integration–> <dependency> <groupId>org.crazycake</groupId> <artifactId>shiro-redis-spring-boot-starter</artifactId> <version>3.2.1</version> </dependency> <!–hutool tool class–> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-all</artifactId> <version>5.3.3</version> </dependency> <!– jwt –> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> <version>0.9.1</version> </dependency> 2. […]