Seata Transaction

Startup Seata Server

Download seata server according to seata-work-shop.

Create Undo Log Table

Create undo_log table in each physical database (sample for MySQL).

  1. CREATE TABLE IF NOT EXISTS `undo_log`
  2. (
  3. `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'increment id',
  4. `branch_id` BIGINT(20) NOT NULL COMMENT 'branch transaction id',
  5. `xid` VARCHAR(100) NOT NULL COMMENT 'global transaction id',
  6. `context` VARCHAR(128) NOT NULL COMMENT 'undo_log context,such as serialization',
  7. `rollback_info` LONGBLOB NOT NULL COMMENT 'rollback info',
  8. `log_status` INT(11) NOT NULL COMMENT '0:normal status,1:defense status',
  9. `log_created` DATETIME NOT NULL COMMENT 'create datetime',
  10. `log_modified` DATETIME NOT NULL COMMENT 'modify datetime',
  11. PRIMARY KEY (`id`),
  12. UNIQUE KEY `ux_undo_log` (`xid`, `branch_id`)
  13. ) ENGINE = InnoDB
  14. AUTO_INCREMENT = 1
  15. DEFAULT CHARSET = utf8 COMMENT ='AT transaction mode undo table';

Update Configuration

Configure seata.conf file in classpath.

  1. client {
  2. application.id = example ## application unique ID
  3. transaction.service.group = my_test_tx_group ## transaction group
  4. }

Modify file.conf and registry.conf if needed.