springcloud之txlcn分布式事务

这哥们的代码,我拿来跑了一下,他上面没有给全,我这里补一下:哥们地址:https://github.com/shenyuewang/springcloud-lcn

首先他没没有给出eureka注册中心代码

springcloud之txlcn分布式事务_第1张图片

上面就是一个超级超级简单的eureka,

还有就是数据库

tx-manager.sql

/*
Navicat MySQL Data Transfer

Source Server         : localhost_3306
Source Server Version : 50549
Source Host           : localhost:3306
Source Database       : tx-manager

Target Server Type    : MYSQL
Target Server Version : 50549
File Encoding         : 65001

Date: 2019-07-11 17:30:35
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for hibernate_sequence
-- ----------------------------
DROP TABLE IF EXISTS `hibernate_sequence`;
CREATE TABLE `hibernate_sequence` (
  `next_val` bigint(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of hibernate_sequence
-- ----------------------------
INSERT INTO `hibernate_sequence` VALUES ('1');

-- ----------------------------
-- Table structure for t_logger
-- ----------------------------
DROP TABLE IF EXISTS `t_logger`;
CREATE TABLE `t_logger` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `group_id` varchar(64) NOT NULL,
  `unit_id` varchar(32) NOT NULL,
  `tag` varchar(50) NOT NULL,
  `content` varchar(1024) NOT NULL,
  `create_time` varchar(30) NOT NULL,
  `app_name` varchar(128) NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of t_logger
-- ----------------------------

-- ----------------------------
-- Table structure for t_tx_exception
-- ----------------------------
DROP TABLE IF EXISTS `t_tx_exception`;
CREATE TABLE `t_tx_exception` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `group_id` varchar(64) DEFAULT NULL,
  `unit_id` varchar(32) DEFAULT NULL,
  `mod_id` varchar(128) DEFAULT NULL,
  `transaction_state` tinyint(4) DEFAULT NULL,
  `registrar` tinyint(4) DEFAULT NULL,
  `remark` varchar(4096) DEFAULT NULL,
  `ex_state` tinyint(4) DEFAULT NULL COMMENT '0 未解决 1已解决',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of t_tx_exception
-- ----------------------------
 

 

bank-b.sql

/*
Navicat MySQL Data Transfer

Source Server         : localhost_3306
Source Server Version : 50549
Source Host           : localhost:3306
Source Database       : bank-b

Target Server Type    : MYSQL
Target Server Version : 50549
File Encoding         : 65001

Date: 2019-07-11 17:30:18
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for bank_b
-- ----------------------------
DROP TABLE IF EXISTS `bank_b`;
CREATE TABLE `bank_b` (
  `id` int(225) NOT NULL AUTO_INCREMENT,
  `money` int(225) DEFAULT NULL,
  `user` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of bank_b
-- ----------------------------
INSERT INTO `bank_b` VALUES ('1', '1500', 'shen');
 

 

bank-a.sql

/*
Navicat MySQL Data Transfer

Source Server         : localhost_3306
Source Server Version : 50549
Source Host           : localhost:3306
Source Database       : bank-a

Target Server Type    : MYSQL
Target Server Version : 50549
File Encoding         : 65001

Date: 2019-07-11 17:30:00
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for bank_a
-- ----------------------------
DROP TABLE IF EXISTS `bank_a`;
CREATE TABLE `bank_a` (
  `id` int(225) NOT NULL AUTO_INCREMENT,
  `money` int(225) DEFAULT NULL,
  `user` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of bank_a
-- ----------------------------
INSERT INTO `bank_a` VALUES ('1', '-900', 'shen');
 

如果启动报mysql 错可以添加试试

springcloud之txlcn分布式事务_第2张图片

还不错,学习了

你可能感兴趣的:(springcloud之txlcn分布式事务)