ShardingSphere / ShardingJDBC
Sharding, read-write splitting, data encryption, and custom encryption strategies.
4 posts · In reading order
Using ShardingSphere–ShardingJDBC (Part 1): Data Sharding
An introduction to data sharding in ShardingSphere–ShardingJDBC, with database and table sharding demonstrated across two MySQL instances. An example selects databases by id and tables by age to observe write and query routing, and explains how sharding keys relate to full routing.
Using ShardingSphere Database Middleware: ShardingJDBC (Part 2), Read/Write Splitting
Builds on a data-sharding example to configure ShardingJDBC read/write splitting for a MySQL primary-replica setup. It introduces primary and replica data sources and replica load-balancing strategies, observes queries alternating between replicas, and records the unresolved issue of a slow first query.
Using ShardingSphere–ShardingJDBC (Part 3): Data Masking
Building on data sharding and read/write splitting, this article uses ShardingJDBC’s built-in algorithms to encrypt stored fields and decrypt query results. It verifies the configuration through inserts and queries and discusses full routing without a sharding key, including the number of tables queried and the maintainers’ explanation.
ShardingSphere (Part 4): Custom Encryption Strategies for Data Masking
Using ShardingSphere 4.1.1, this article implements and configures custom encryption strategies and traces SPI-based encryptor registration through the source code. It demonstrates Encryptor and QueryAssistedEncryptor separately, then verifies how an assisted-query column supports queries over differing ciphertext values.