[maven-release-plugin] copy for tag 5.4.1.1
[maven-release-plugin] prepare release 5.4.1.1
20 files changed
tree: a203943cbdd264020802f5eda84ebda388946308
  1. .github/
  2. .idea/
  3. .mvn/
  4. features/
  5. infra/
  6. jdbc/
  7. mode/
  8. .asf.yaml
  9. .gitignore
  10. .licenserc.yaml
  11. LICENSE
  12. mvnw
  13. mvnw.cmd
  14. pom.xml
  15. README.md
  16. README_ZH.md
  17. RELEASE-NOTE.md
README.md

Table of Contents

Overview

ShardingSphere plugin is designed to provide a plugin implementation for ShardingSphere pluggable architecture. You can refer to ShardingSphere Dev Manual to extend the SPI. Developers are welcome to contribute to the implementation of plugins and build a distributed database ecosystem of ShardingSphere.

EN doc CN doc

Instruction

These plugins can be found in ShardingSphere plugin repository. Plugins in ShardingSphere plugin repository would remain the same release plan with ShardingSphere, they can be retrieved at https://central.sonatype.com/, and install into ShardingSphere. When using ShardingSphere-JDBC, users only need to add maven dependencies to the project to complete the plugin installation. When using ShardingSphere-Proxy, they need to download the plugin jar package and the jar packages that the plugin may depend on, and then copy them to ShardingSphere-Proxy ext-lib directory.

When developers contribute new plugins, they need to refer to Contributor Guide and first execute ./mvnw clean install -DskipITs -DskipTests -Prelease to package ShardingSphere basic SPI and test components, and then create a new module for plugin development. Newly developed plugin code needs to follow ShardingSphere Code of Conduct.

Plugin Implementation

Feature Plugin

Encrypt Feature Plugin

Like Encrypt Algorithm

  • CharDigestLike Encrypt Algorithm

Type:CHAR_DIGEST_LIKE

Attributes:

NameDataTypeDescription
deltaintCharacter Unicode offset(decimal number)
maskintCharacter encryption mask(decimal number)
startintCiphertext Unicode initial code(decimal number)
dictStringCommon words

Maven dependency:

<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-plugin-features-encrypt-like</artifactId>
    <version>${RELEASE.VERSION}</version>
</dependency>

Standard Encrypt Algorithm

  • RC4 Encrypt Algorithm

Type: RC4

Attributes:

NameDataTypeDescription
rc4-key-valueStringRC4 KEY

Maven dependency:

<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-plugin-features-encrypt-rc4</artifactId>
    <version>${RELEASE.VERSION}</version>
</dependency>
  • SM3 Encrypt Algorithm

Type: SM3

Attributes:

NameDataTypeDescription
sm3-saltStringSM3 SALT (should be blank or 8 bytes long)

Maven dependency:

<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-plugin-features-encrypt-sm</artifactId>
    <version>${RELEASE.VERSION}</version>
</dependency>
  • SM4 Encrypt Algorithm

Type: SM4

Attributes:

NameDataTypeDescription
sm4-keyStringSM4 KEY (should be 16 bytes)
sm4-modeStringSM4 MODE (should be CBC or ECB)
sm4-ivStringSM4 IV (should be specified on CBC, 16 bytes long)
sm4-paddingStringSM4 PADDING (should be PKCS5Padding or PKCS7Padding, NoPadding excepted)

Maven dependency:

<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-plugin-features-encrypt-sm</artifactId>
    <version>${RELEASE.VERSION}</version>
</dependency>

Sharding Feature Plugin

Distributed Key Generator

  • Nano ID

Type:NANOID

Configurable Property:none

Maven dependency:

<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-plugin-features-sharding-nanoid</artifactId>
    <version>${RELEASE.VERSION}</version>
</dependency>
  • CosId

Type: COSID

Attributes:

NameDataTypeDescriptionDefault Value
id-nameStringID generator name__share__
as-stringboolWhether to generate a string type ID: Convert long type ID to Base-62 String type (Long.MAX_VALUE maximum string length is 11 digits), and ensure the ordering of string IDsfalse

Maven dependency:

<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-plugin-features-sharding-cosid</artifactId>
    <version>${RELEASE.VERSION}</version>
</dependency>
  • CosId-Snowflake

Type: COSID_SNOWFLAKE

Attributes:

NameDataTypeDescriptionDefault Value
epochStringEPOCH of Snowflake ID Algorithm1477929600000
as-stringboolWhether to generate a string type ID: Convert long type ID to Base-62 String type (Long.MAX_VALUE maximum string length is 11 digits), and ensure the ordering of string IDsfalse

Maven dependency:

<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-plugin-features-sharding-cosid</artifactId>
    <version>${RELEASE.VERSION}</version>
</dependency>

Sharding Algorithm

  • Fixed interval sharding algorithm provided by CosId

A fixed time range sharding algorithm implemented by the tool class based on me.ahoo.cosid:cosid-core. When the sharding key is a JSR-310 containing class or a time-related class, it will be converted to java.time.LocalDateTime before the next sharding. See the discussion at https://github.com/apache/shardingsphere/issues/14047.

Type:COSID_INTERVAL

Attributes:

NameDataTypeDescriptionDefault Value
zone-idStringTime zone, which must follow the contained value of java.time.ZoneId. For example: Asia/Shanghai
logic-name-prefixStringPrefix pattern of sharding data sources or tables
datetime-lowerStringDatetime sharding lower boundary, pattern is consistent with the timestamp format of yyyy-MM-dd HH:mm:ss
datetime-upperStringDatetime sharding upper boundary, pattern is consistent with the timestamp format of yyyy-MM-dd HH:mm:ss
sharding-suffix-patternStringSuffix pattern of sharding data sources or tables, must can be transformed to Java LocalDateTime, must be consistent with datetime-interval-unit. For example: yyyyMM
datetime-interval-unitStringUnit of sharding value interval, must can be transformed to Java ChronoUnit's Enum value. For example: MONTHS
datetime-interval-amountintInterval of sharding value, after which the next shard will be entered

Maven dependency:

<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-plugin-features-sharding-cosid</artifactId>
    <version>${RELEASE.VERSION}</version>
</dependency>
  • Snowflake key-based fixed interval sharding algorithm provided by CosId

Snowflake ID sharding algorithm with fixed time range implemented by tool class based on me.ahoo.cosid:cosid-core. When the sharding key is a JSR-310 containing class or a time-related class, it will be converted to java.time.LocalDateTime before the next sharding. See the discussion at https://github.com/apache/shardingsphere/issues/14047.

Type:COSID_INTERVAL_SNOWFLAKE

Attributes:

NameDataTypeDescriptionDefault Value
zone-idStringTime zone, which must follow the contained value of java.time.ZoneId. For example: Asia/Shanghai
logic-name-prefixStringPrefix pattern of sharding data sources or tables
datetime-lowerStringDatetime sharding lower boundary, pattern is consistent with the timestamp format of yyyy-MM-dd HH:mm:ss
datetime-upperStringDatetime sharding upper boundary, pattern is consistent with the timestamp format of yyyy-MM-dd HH:mm:ss
sharding-suffix-patternStringSuffix pattern of sharding data sources or tables, must can be transformed to Java LocalDateTime, must be consistent with datetime-interval-unit. For example: yyyyMM
datetime-interval-unitStringUnit of sharding value interval, must can be transformed to Java ChronoUnit's Enum value. For example: MONTHS
datetime-interval-amountintInterval of sharding value, after which the next shard will be entered

Maven dependency:

<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-plugin-features-sharding-cosid</artifactId>
    <version>${RELEASE.VERSION}</version>
</dependency>
  • Modulo sharding algorithm provided by CosId

Modulo sharding algorithm implemented by the tool class based on me.ahoo.cosid:cosid-core. See the discussion at https://github.com/apache/shardingsphere/issues/14047 .

Type: COSID_MOD

Attributes:

NameDataTypeDescription
modintSharding count
logic-name-prefixStringPrefix pattern of sharding data sources or tables

Maven dependency:

<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-plugin-features-sharding-cosid</artifactId>
    <version>${RELEASE.VERSION}</version>
</dependency>

Infra Plugin

Connection Pool Plugin

ShardingSphere-Proxy supports common data source connection pools: HikariCP, C3P0, DBCP.

The connection pool can be specified through the parameter dataSourceClassName. When not specified, the default data source connection pool is HikariCP.

  • C3P0 Connection Pool

Sample:

dataSources:
  ds_0:
    dataSourceClassName: com.mchange.v2.c3p0.ComboPooledDataSource
    url: jdbc:mysql://localhost:3306/ds_2
    username: root
    password:

Maven dependency:

<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-plugin-infra-data-source-pool-c3p0</artifactId>
    <version>${RELEASE.VERSION}</version>
</dependency>
  • DBCP Connection Pool

Sample:

dataSources:
  ds_0:
    dataSourceClassName: org.apache.commons.dbcp2.BasicDataSource
    url: jdbc:mysql://localhost:3306/ds_3
    username: root
    password:
<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-plugin-infra-data-source-pool-dbcp</artifactId>
    <version>${RELEASE.VERSION}</version>
</dependency>

JDBC Adaptor Plugin

JDBC Driver Config Plugin

ShardingSphere-JDBC provides a JDBC Driver, which can be used only through configuration changes without rewriting the code.

  • Apollo Driver Config

Load JDBC URL of the yaml configuration file in the specified namespace of apollo:

jdbc:shardingsphere:apollo:TEST.test_namespace

Maven dependency:

<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-plugin-jdbc-driver-apollo</artifactId>
    <version>${RELEASE.VERSION}</version>
</dependency>

Mode Plugin

Mode Cluster Repository Plugin

  • Nacos Repository

Type: Nacos

Mode: Cluster

Attributes:

NameTypeDescriptionDefault Value
clusterIpStringUnique identifier in clusterHost IP
retryIntervalMillisecondslongMilliseconds of retry interval500
maxRetriesintMax retries for client to check data availability3
timeToLiveSecondsintSeconds of ephemeral instance live30

Maven dependency:

<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-plugin-mode-cluster-repository-nacos</artifactId>
    <version>${RELEASE.VERSION}</version>
</dependency>