# redis **Repository Path**: dou_jun_xian/redis ## Basic Information - **Project Name**: redis - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-27 - **Last Updated**: 2026-02-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Redis-Canal A Java sample project that implements real-time synchronization of MySQL data to Redis using Canal. ## Project Overview Redis-Canal is a Spring Boot application that demonstrates how to use Alibaba's open-source Canal middleware to monitor MySQL database changes and synchronize them in real time to Redis. This project supports real-time synchronization of INSERT, DELETE, and UPDATE operations with Redis. ## Technology Stack - **Java** - Programming language - **Spring Boot** - Application framework - **Canal** - MySQL binlog incremental subscription and consumption component - **Redis** - In-memory database - **Jedis** - Redis Java client ## Core Features - **Change Data Capture**: Subscribe to MySQL binlog via Canal to capture data change events in real time - **INSERT Synchronization**: Automatically write new data to Redis - **DELETE Synchronization**: Automatically remove data from Redis upon deletion - **UPDATE Synchronization**: Automatically update corresponding records in Redis upon modification ## Project Structure ``` src/main/java/com/study/redis/ ├── Main.java # Spring Boot main class ├── example/ │ └── RedisCanalClientExample.java # Canal client example (core synchronization logic) └── util/ └── RedisUtils.java # Redis utility class (connection pool management) ``` ## Quick Start ### Prerequisites - JDK 1.8+ - Maven 3.x - Redis 3.x+ - MySQL 5.7+ (with binlog enabled) - Canal Server ### Configuration Configure the following in `src/main/resources/application.properties`: ```properties # Redis connection settings redis.ip=your_redis_ip redis.port=6379 redis.password=your_password # Canal settings canal.server=your_canal_server_ip ``` ### Startup Steps 1. Clone the project to your local machine 2. Update the Redis and Canal connection details in the configuration file 3. Run `mvn spring-boot:run` to start the application 4. Perform data operations in MySQL and observe the corresponding changes in Redis ## Usage Example ```java // Handle INSERT operation redisInsert(columns); // Handle DELETE operation redisDelete(columns); // Handle UPDATE operation redisUpdate(columns); ``` ## Dependencies Key project dependencies include: - spring-boot-starter - canal-client - jedis For detailed dependency information, refer to the `pom.xml` file. ## License This project is for learning and reference purposes only.