IceFireDB-Redis-Proxy

IceFireDB-Redis-Proxy #

IceFireDB-Redis-Proxy is a database proxy that adds decentralization capabilities to traditional Redis databases. It provides a convenient mechanism to build a globally distributed storage system with automatic networking, enabling decentralized data synchronization for Redis databases commonly used in web2 applications.

Overview #

IceFireDB-Redis-Proxy acts as a middleware layer between Redis clients and backend Redis servers, adding P2P networking capabilities to enable decentralized data synchronization across multiple Redis instances.

Key Features #

  • Complete Redis Protocol Support: Full compatibility with Redis clients and commands
  • Multiple Data Source Modes: Support for both standalone and cluster Redis deployments
  • P2P Automatic Networking: Decentralized data synchronization across nodes
  • Traffic Control: Read-write separation and multi-tenant data isolation
  • Cluster Management: Excellent cluster state management and failover capabilities
  • High Availability: Distributed architecture ensures continuous operation

Architecture #

IceFireDB-Redis-Proxy operates as a proxy layer that:

  1. Accepts Redis protocol connections from clients
  2. Routes commands to backend Redis servers (standalone or cluster)
  3. Synchronizes data changes across the P2P network
  4. Provides traffic control and multi-tenant isolation

Getting Started #

Installation #

  1. Clone the Repository

    git clone https://github.com/IceFireDB/IceFireDB.git
    
  2. Build the Project

    cd IceFireDB-Redis-Proxy
    make
    
  3. Run the Service

    ./bin/IceFireDB-Redis-Proxy -c ./config/config.yaml
    

Configuration #

IceFireDB-Redis-Proxy uses a YAML configuration file. Key configuration options include:

  • Proxy Settings: Local port, TLS configuration
  • P2P Networking: Enable/disable decentralized synchronization
  • Redis Backend: Connection details for backend Redis servers
  • Service Discovery: P2P service discovery and topic configuration

Usage Examples #

Connect using any Redis client:

redis-cli -p 16379

Execute Redis commands as you would with any Redis server:

SET mykey "Hello World"
GET mykey
HSET user:1000 name "John Doe" email "[email protected]"
HGETALL user:1000

Supported Commands #

IceFireDB-Redis-Proxy supports a comprehensive set of Redis commands including:

String Operations #

  • SET, GET, MSET, MGET, INCR, DECR, APPEND, GETRANGE, SETRANGE

Hash Operations #

  • HSET, HGET, HMSET, HMGET, HGETALL, HKEYS, HVALS, HDEL, HEXISTS

List Operations #

  • LPUSH, RPUSH, LPOP, RPOP, LRANGE, LINDEX, LLEN, LINSERT

Set Operations #

  • SADD, SREM, SMEMBERS, SISMEMBER, SCARD, SPOP, SRANDMEMBER

Sorted Set Operations #

  • ZADD, ZRANGE, ZREVRANGE, ZRANK, ZREVRANK, ZSCORE, ZCARD

Stream Operations #

  • XADD, XREAD, XRANGE, XREVRANGE, XLEN, XDEL, XGROUP

Administrative Commands #

  • PING, QUIT, COMMAND, INFO, CLIENT, CONFIG

Application Scenarios #

  • Decentralized Caching: Distributed Redis cache with automatic synchronization
  • Session Storage: Distributed session management for web applications
  • Real-time Data: Decentralized real-time data storage and synchronization
  • Web2 to Web3 Migration: Transition traditional Redis-based applications to decentralized infrastructure
  • Multi-region Deployment: Global data distribution with local latency

Technical Details #

  • Protocol: Redis protocol (RESP) compatibility
  • Networking: libp2p for decentralized peer discovery and communication
  • Consistency: Eventual consistency with conflict resolution
  • Performance: Low latency proxy with minimal overhead

Performance Characteristics #

  • High Throughput: Efficient command routing and processing
  • Low Latency: Direct connections to backend Redis servers
  • Scalability: Horizontal scaling through additional proxy nodes
  • Resource Efficiency: Lightweight proxy layer with minimal resource consumption

Security Features #

  • Transport Encryption: TLS support for secure communications
  • Authentication: Redis authentication with configurable credentials
  • Access Control: Multi-tenant isolation and command filtering
  • Network Security: Secure peer authentication and encrypted P2P communications

Support & Community #