NewCode CLOUD — 20% off your first month on all cloud VPSClaim

Redis Cluster on Hong Kong VPS: Horizontal Scaling for Asia-Pacific (2026)

· 3 min read

Redis Cluster distributes data across multiple nodes automatically — each shard holds a portion of the keyspace, with replicas for fault tolerance. Deployed across three or more Hong Kong VPS instances, Redis Cluster provides both horizontal scaling beyond single-node RAM limits and automatic failover for cache and session data.


When You Need Redis Cluster

  • Dataset exceeds single VPS RAM (e.g., 50 GB session data across 3× 32 GB nodes)
  • Write throughput exceeds single Redis node capacity (~1M ops/sec)
  • Redis availability is business-critical (automatic failover needed)
  • Multiple apps need isolated namespaces with dedicated performance

Step 1: Install Redis on All Nodes

<code"># Run on ALL 6 VPS nodes (3 primary + 3 replica — minimum for Redis Cluster)
apt update && apt install -y redis-server

# For a minimal 3-primary cluster (no replicas — not recommended for production):
# Use 3 nodes minimum

# Configure each node (adjust bind IP and port per node)
cat > /etc/redis/redis-cluster.conf << 'EOF'
# Bind to private/internal IP
bind 0.0.0.0
port 7001   # Change to 7002, 7003 on other primary nodes
             # Replicas: 7004, 7005, 7006

# Cluster settings
cluster-enabled yes
cluster-config-file /var/lib/redis/nodes-7001.conf
cluster-node-timeout 5000

# Persistence
appendonly yes
appendfilename "appendonly-7001.aof"

# Security
requirepass "ClusterPass!"
masterauth "ClusterPass!"

# Disable dangerous commands
rename-command FLUSHALL ""
rename-command FLUSHDB ""
rename-command CONFIG ""
rename-command DEBUG ""

# Performance
maxmemory 1gb
maxmemory-policy allkeys-lru
tcp-keepalive 300
EOF

mkdir -p /var/lib/redis
chown redis:redis /var/lib/redis
systemctl restart redis-server

Step 2: Create the Cluster

<code"># Run from any one node — provide all 6 node IPs:ports
redis-cli --cluster create \
  VPS1_IP:7001 VPS2_IP:7002 VPS3_IP:7003 \
  VPS4_IP:7004 VPS5_IP:7005 VPS6_IP:7006 \
  --cluster-replicas 1 \    # 1 replica per primary
  -a ClusterPass!

# Redis will auto-assign shards and replicas
# Type 'yes' to confirm

# Verify cluster status
redis-cli -h VPS1_IP -p 7001 -a ClusterPass! cluster info
redis-cli -h VPS1_IP -p 7001 -a ClusterPass! cluster nodes

Step 3: Connect Application to Redis Cluster

<code"># Node.js — ioredis cluster mode
import Redis from 'ioredis'

const cluster = new Redis.Cluster(
  [
    { host: 'VPS1_IP', port: 7001 },
    { host: 'VPS2_IP', port: 7002 },
    { host: 'VPS3_IP', port: 7003 },
  ],
  {
    redisOptions: {
      password: 'ClusterPass!',
      connectTimeout: 3000,
      commandTimeout: 3000,
    },
    clusterRetryStrategy: (times) => Math.min(times * 100, 3000),
    enableReadyCheck: true,
    scaleReads: 'slave',  // Send reads to replicas to distribute load
  }
)

cluster.on('error', (err) => console.error('Redis Cluster error:', err))
cluster.on('connect', () => console.log('Redis Cluster connected'))

# LIMITATION: Multi-key operations require keys in same slot
# Use hash tags to force co-location:
await cluster.set('{user:123}:session', sessionData)
await cluster.set('{user:123}:profile', profileData)
# Both keys go to the same slot because {user:123} is the hash tag

# Python — redis-py cluster:
from redis.cluster import RedisCluster, ClusterNode
nodes = [ClusterNode('VPS1_IP', 7001)]
r = RedisCluster(startup_nodes=nodes, password='ClusterPass!', decode_responses=True)

Step 4: Cluster Management

<code"># Check cluster health
redis-cli -h VPS1_IP -p 7001 -a ClusterPass! cluster info | grep cluster_state
# cluster_state:ok

# Check slot distribution
redis-cli -h VPS1_IP -p 7001 -a ClusterPass! cluster shards

# Add a new node (scale out):
redis-cli --cluster add-node NEW_VPS_IP:7007 VPS1_IP:7001 -a ClusterPass!
# Rebalance slots to include new node:
redis-cli --cluster rebalance VPS1_IP:7001 -a ClusterPass!

# Simulate failover test
redis-cli -h VPS1_IP -p 7001 -a ClusterPass! debug sleep 10  # Pause primary
# Replica should promote automatically within cluster-node-timeout (5s)

Redis Cluster vs Sentinel vs Standalone

Mode Horizontal scale HA failover Complexity Min nodes
Standalone No No Trivial 1
Sentinel No (reads only) Yes (~30s) Medium 3
Cluster Yes Yes (~5s) High 6

Conclusion

Redis Cluster across multiple Hong Kong VPS instances provides both horizontal scaling (distribute data across nodes) and automatic failover (replica promoted within 5 seconds). The minimum production setup — 3 primaries and 3 replicas across 6 VPS nodes — tolerates the failure of any single node without data loss. Client libraries like ioredis handle cluster routing transparently; the main application change is using hash tags for multi-key operations that must land on the same shard.

Scale your cache: Browse Server.HK Hong Kong VPS plans — deploy multiple 2–4 GB VPS instances for a Redis Cluster that scales with your Asia-Pacific application’s data volume.

Related articles

More in VPS & ServersServer setup guides