ShardingSphere sub-database and table (2): basic introduction

1 Introduction

Apache ShardingSphere is an ecosystem composed of a set of open source distributed database middleware solutions. It consists of three products, JDBC, Proxy and Sidecar (under planning), which are independent of each other but can be mixed and deployed for use together. They all provide standardized data sharding, distributed transactions and database management functions, and can be applied to various diverse application scenarios such as Java isomorphism, heterogeneous languages, cloud native, etc.

Apache ShardingSphere is positioned as relational database middleware, aiming to fully and reasonably utilize the computing and storage capabilities of relational databases in distributed scenarios, rather than implementing a new relational database. It captures the essence of things by focusing on the unchanging. Relational databases still occupy a huge market today and are the cornerstone of each company's core business. They will be difficult to shake in the future. At this stage, we are more focused on increments based on the original foundation rather than subversion.

​ Apache ShardingSphere 5.x version begins to focus on pluggable architecture, and the functional components of the project can be flexibly expanded in a pluggable manner. Currently, functions such as data sharding, read-write separation, multiple data copies, data encryption, and shadow database stress testing, as well as support for SQL and protocols such as MySQL, PostgreSQL, SQLServer, and Oracle, are all woven into the project through plug-ins. Developers can customize their own unique system just like using building blocks. Apache ShardingSphere currently provides dozens of SPIs as system extension points, and more are still being added.

Sharding-JDBC was first used internally by Dangdang as a sub-database and sub-table framework. It was not open sourced to the outside world until 2017. In the past few years, with the continuous iteration of a large number of community contributors, its functions have gradually improved and it has now been renamed ShardingSphere officially became a top-level project of the Apache Software Foundation on April 16, 2020.

2、ShardingSphere-JDBC

Program code encapsulation

Positioned as a lightweight Java framework, 在 Java 的 JDBC 层提供的额外服务. It uses the client to directly connect to the database 以 jar 包形式提供服务without additional deployment and dependencies. It can be understood as an enhanced version of the JDBC driver and is fully compatible with JDBC and various ORM frameworks.
Insert image description here

  • Applicable to any JDBC-based ORM framework, such as: JPA, Hibernate, Mybatis, Spring JDBC Template or use JDBC directly.
  • Supports any third-party database connection pool, such as: DBCP, C3P0, BoneCP, Druid, HikariCP, etc.
  • Supports any database that implements the JDBC specification. Currently supports MySQL, Oracle, SQLServer, PostgreSQL and any database that follows the SQL92 standard.

3、ShardingSphere-Proxy

Middleware encapsulation

Positioned as transparent 数据库代理端, it provides a server version that encapsulates the database binary protocol to support heterogeneous languages. Currently MySQL and PostgreSQL versions are available. It can use any access client compatible with the MySQL/PostgreSQL protocol (such as MySQL Command Client, MySQL Workbench, Navicat, etc.) to operate data, making it more friendly to DBAs.

  • It is completely transparent to the application and can be used directly as MySQL/PostgreSQL.
  • Applicable to any client compatible with MySQL/PostgreSQL protocol.
    Insert image description here

4、sharding-sidecar

Positioned as a cloud-native database proxy for Kubernetes, it proxies all access to the database in the form of Sidecar. Through a centerless, zero-intrusion solution, we provide an engagement layer that interacts with the database, namely Database Mesh, also known as data grid.

Database Mesh focuses on how to organically connect distributed data access applications and databases. It focuses more on interaction and effectively sorting out the interactions between messy applications and databases. Using Database Mesh, applications and databases that access the database will eventually form a huge grid system. Applications and databases only need to be registered in the grid system. They are all objects managed by the meshing layer.

Insert image description here

5. Comparison of three components

Insert image description here

6. Hybrid architecture

​ Sharding-JDBC adopts a decentralized architecture and is suitable for high-performance lightweight OLTP applications developed in Java; Sharding-Proxy provides static entry and heterogeneous language support, and is suitable for OLAP applications and the management and operation of sharded databases. dimensional scene.

ShardingSphere is an ecosystem composed of multiple access terminals. By mixing Sharding-JDBC and Sharding-Proxy, and using the same registration center to uniformly configure sharding strategies, application systems suitable for various scenarios can be flexibly built, and architects can more freely adjust the best system suitable for the current business. architecture.

Insert image description here

Guess you like

Origin blog.csdn.net/weixin_44816664/article/details/133295644