1. Overview

Sharding-Proxy is one of the core products in the Apache ShardingSphere ecosystem, using a transparent database proxy architecture.

Core Features:

  1. Protocol Compatibility: Supports MySQL/PostgreSQL and other mainstream database protocols
  2. Transparent Proxy: Mimics as a real database instance
  3. Independent Deployment: Runs as an independent database proxy service
  4. Rich Features: Provides enterprise-level features like read-write separation, distributed transactions, data encryption, etc.

2. Core Features

1. Protocol Compatibility

  • Supports MySQL 5.1/5.5/5.6/5.7/8.0 versions
  • Fully compatible with MySQL’s binary and text protocols

2. Client Support

  • Command-line tools: mysql client
  • GUI tools: MySQL Workbench, Navicat, DBeaver
  • Programming language drivers: JDBC, Python MySQL Connector, PHP PDO, etc.

3. Transparent Design

  • SQL parsing, routing, execution, result merging processes are completely transparent to applications
  • Supports all MySQL syntax

3. Typical Use Cases

  1. Database Sharding Management: Horizontal sharding for existing MySQL clusters
  2. Multi-Tenant Systems: Implement tenant isolation through logical databases/logical tables
  3. Database Middleware Upgrade: Replace traditional application-layer sharding solutions
  4. Heterogeneous Language Support: Provide sharding capabilities for PHP, Python, Go and other non-Java languages

4. Comparison

FeatureSharding-ProxyTraditional MiddlewareApplication-Layer Sharding
Protocol Transparency
Multi-Language Support
Zero Code Invasion
O&M ComplexityLowMediumHigh

5. Usage Guide

1. Configuration File Modification

Example configuration (server.yaml):

authentication:
  users:
    root:
      password: root
props:
  max.connections.size.per.query: 5
  proxy.transaction.type: LOCAL
  proxy.hint.enable: true

2. Start Service

  • Linux system: bin/start.sh
  • Windows system: bin\start.bat
  • Default port: 3307

3. Client Connection

mysql -h 127.0.0.1 -P 3307 -u root -p

6. Notes

  1. Hint Function: Disabled by default, need to modify conf/server.yaml
  2. Port Configuration: Default port 3307, can be modified via startup parameters
  3. Multiple Logical Data Sources: Configuration files must be named starting with “config-”