Distributed Transaction

Background

ShardingSphere provides three modes for distributed transactions LOCAL, XA, BASE.

Parameters

  1. transaction:
  2. defaultType: # Transaction mode, optional value LOCAL/XA/BASE
  3. providerType: # Specific implementation of the mode

Procedure

Use LOCAL Mode

The content of the server.yaml configuration file is as follows:

  1. transaction:
  2. defaultType: LOCAL

Use XA Mode

The content of the server.yaml configuration file is as follows:

  1. transaction:
  2. defaultType: XA
  3. providerType: Narayana/Atomikos

To manually add Narayana-related dependencies:

  1. jta-5.12.4.Final.jar
  2. arjuna-5.12.4.Final.jar
  3. common-5.12.4.Final.jar
  4. jboss-connector-api_1.7_spec-1.0.0.Final.jar
  5. jboss-logging-3.2.1.Final.jar
  6. jboss-transaction-api_1.2_spec-1.0.0.Alpha3.jar
  7. jboss-transaction-spi-7.6.0.Final.jar
  8. narayana-jts-integration-5.12.4.Final.jar
  9. shardingsphere-transaction-xa-narayana-x.x.x-SNAPSHOT.jar

Use BASE Mode

The content of the server.yaml configuration file is as follows:

  1. transaction:
  2. defaultType: BASE
  3. providerType: Seata

Build a Seata Server, add relevant configuration files and Seata dependencies, see ShardingSphere Integrates Seata Flexible Transactions