In 2018, live quiz shows like Wang Sicong's "Chongding Dahui," Xigua Video's "Million Heroes," and Inke's "Cheese Superman" became wildly popular. An e-commerce company I worked for joined this trend, and the tech team developed a live quiz feature. After a quiz ended,...
Establishing a Redis Connection Pool To efficiently manage connections to a Redis server, it's best practice to use a connection pool. This avoids the overhead of establishing a new connection for every request. import redis # Define the Redis connection pool configuration redis_pool = redis.Connect...
Redis Deployment Options When deploying Redis, several common approaches are available: This article presents a mutual master-slave approach using only two servers, similar to MySQL's replication, without requiring keepalived by using crontab and iptables for automation. System Requirements Server C...
Redis Cleints in Java In Java applications, interacting with Redis requires a Redis client library, similar to using JDBC for MySQL operations. Several reliable Java clients are available: Jedis Lettuce Spring Data Redis Spring provides comprehensive integration through Spring Data Redis, and Spring...
Prepare all nodes in the cluster by installing build dependencies and extracting the Redis source distribution: yum install -y gcc make tcl curl -fsSL https://download.redis.io/releases/redis-7.0.12.tar.gz -o /usr/src/redis.tar.gz tar -xzf /usr/src/redis.tar.gz -C /usr/src/ cd /usr/src/redis-7.0.12...
Redis achieves exceptional speed by keeping the entire dataset in memory. To prevent data loss during restarts, crashes, or power failures, it provides two persistence strategies: RDB (Redis Database) snapshots and AOF (Append Only File) logs. RDB Persistence RDB acts as the default persistence mech...
Overview Manual master-slave failover requires human entervention—stop the application, reconfigure a slave, update configuration files, and restart. This process is time-consuming and introduces service downtime. Redis Sentinel, introduced in version 2.8, provides an automated solution for this pro...
Distributed Database Fundamentals Distributed databases address three critical requirements: Scalability: When data volume or read/write load exceeds a single machine's capacity, load must be distributed across multiple nodes. This horizontal scaling approach handles increased demand by adding more...
Fundamantal Redis Commands Redis provides essential commands for key-value operations. The most basic are: SET key value: Assigns a value to a key. GET key: Retrieves the value of a key. Returns nil if the key doesn’t exist. To handle binary-safe strings correctly in the CLI, use redis-cli --raw. Gl...
System Environment and Prerequisites This guide outlines the procedure for establishing a Redis Cluster with six nodes (three masters and three slaves) on a sinngle CentOS 7 server. In a production setting, these instances should be distributed across multiple physical servers to ensure true fault t...