Seata分布式事务环境搭建
安装Seata,启动端口7091、8091:
1 下载并解压seata-server-2.2.0.zip
https://github.com/apache/incubator-seata/releases/download/v2.0.0/seata-server-2.0.0.zip
2 vi conf/application.yml
配置中心参考:https://seata.apache.org/zh-cn/docs/user/configuration/nacos
注册中心参考:https://seata.apache.org/zh-cn/docs/user/registry/nacos
3 登录Nacos控制台,创建namespace,绑定seata对应的namespaceid和group,添加配置文件:
文件内容来自:https://github.com/apache/incubator-seata/blob/develop/script/config-center/config.txt
把这里面的内容复制过来,修改其中的部分内容,并配置到seataServer.properties中:
需要修改的地方:
踩坑:这里的mysql IP地址需要配置公网ip,不能配置localhost或127.0.0.1,因为nacos是运行在docker容器中的,mysql服务是在宿主机中,所以要填宿主机的ip(192.168.2.169)
4 创建Seata Server依赖的DB表结构
创建一个库名为seata的数据库,然后执行https://github.com/apache/incubator-seata/blob/develop/script/server/db/mysql.sql 文件中的SQL内容
5创建运行日志目录:
mkdir /Users/supertian/logs/seata
chmod -R 777 /Users/supertian/logs/seata
chmod -R 777 /Users/supertian/logs/
6 启动Seata Server:
sh seata-server.sh -h 127.0.0.1 -p 8091
访问Seata控制台:127.0.0.1:7091
默认用户密码:seata/seata