reference:
install mysql
# 安装
sudo apt install mysql-server
# 启动
su
service mysql start
mysql config
# 查看用户名密码
sudo cat /etc/mysql/debian.cnf
# 登录
mysql -u <username> -p
#查看登录用户
mysql> select user();
# 查看现有数据库
mysql> show databases;
# 新建测试数据库
mysql> create database if not exists `seata` default character set utf8mb4 collate utf8mb4_unicode_ci;
install golang
setup tc server
git clone <https://github.com/opentrx/seata-golang.git>
cd seata-golang
vi ./cmd/profiles/dev/config.yml
# 查看用户名密码
sudo cat /etc/mysql/debian.cnf
# 更新 storage.mysql.dsn 字段
# 更新 log.logPath
cd cmd/tc
go run main.go start -config ../profiles/dev/config.yml
_ _
___ ___ __ _| |_ __ _ __ _ ___ | | __ _ _ __ __ _
/ __|/ _ \\/ _` | __/ _` |_____ / _` |/ _ \\| |/ _` | '_ \\ / _` |
\\__ \\ __/ (_| | || (_| |_____| (_| | (_) | | (_| | | | | (_| |
|___/\\___|\\__,_|\\__\\__,_| \\__, |\\___/|_|\\__,_|_| |_|\\__, |
|___/ |___/
Seata-Golang (v2) Transaction Coordinator (TC)
2022-06-08T08:23:12.484Z INFO start to serve on port 8091
setup tcc mode example client
git clone <https://github.com/opentrx/seata-go-samples.git>
cd seata-go-samples/tcc
export ConfigPath="./conf/config.yml"
go run main.go
access
curl <http://localhost:8080/commit>
curl <http://localhost:8080/rollback>
clone
git clone <https://github.com/MarcGrol/golangAnnotations.git>
tree
命令查看文件目录结构
@GlobalTransactional
注解,动态生成 AOP 切面,代理被 @GlobalTransactional
标记的方法,实现全局事务的开启、提交或者回滚tree
命令查看文件目录结构