Distributed Transaction #
Scenarios
The DBPlusEngine distributed database solution provides support for distributed transactions, with commonly used modes being XA and BASE. Distributed transactions provide the semantics of final consistency. In XA mode, if the isolation level of storage DB is serializable, it can achieve strong consistency semantics. Here is how to use XA.
Prerequisites
Taking DBPlusEngine-Proxy as an example, start by downloading and unzipping
the proxy. Refer to the following configuration, configure the corresponding configuration file in the conf
directory and start the proxy.
Configuration Example
- Configuring with Atomikos
server.yaml
rules:
- !TRANSACTION
defaultType: XA
providerType: Atomikos
- Configuring with Narayana
Because the Narayana configuration is complicated, DBPlusEngine-Proxy provides automatic configuration. Now users do not need to manually configure jbossts-properties.xml configuration file.
DBPlusEngine will automatically configure Narayana specified in server.yaml, and generate the corresponding jbossts-properties.xml configuration file.
server.yaml
rules:
- !TRANSACTION
defaultType: XA
providerType: Narayana
When Narayana is used as the XA transaction manager and the DB mode is configured to store XA recovery information, the DBPlusEngine-Proxy supports transferring the unrecovered transactions on the failed proxy instance to other proxies for recovery.
The configuration is as follows:
- !TRANSACTION
defaultType: XA
providerType: Narayana
props:
recoveryStoreUrl: jdbc:mysql://127.0.0.1:3306/jbossts?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true
# mysql8 using com.mysql.cj.jdbc.MysqlDataSource
recoveryStoreDataSource: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
recoveryStoreUser: databaseUser
recoveryStorePassword: databasePwd