1. 解压安装包到指定目录
$ tar xvf seata-server-1.4.2.tar.gz -C /data/seata/
#创建数据库跟seata需要的用户,导入seata自带的sql文件
数据库Sql文件在/seata-1.4.2/script/server/db/mysql.sql
#修改seata注册文件registry.conf,注册到nacos
vim registry.conf
registry {
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type = "nacos " #修改为nacos
nacos {
application = "seata-server"
serverAddr = "127.0.0.1:8848"
group = "SEATA_GROUP"
namespace = ""
cluster = "default"
#如果nacos开启了权限控制,请配置用户名密码
username = "nacos"
password = "****"
}
}
config {
# file、nacos 、apollo、zk、consul、etcd3
type = "nacos" #修改为nacos
nacos {
serverAddr = "127.0.0.1:8848"
namespace = ""
group = "SEATA_GROUP"
#如果nacos开启了权限控制,请配置用户名密码
username = "nacos"
password = "****"
}
}
#新建config.txt文件,修改数据库信息
$ vim /data/seata/config.txt
service.vgroupMapping.my_test_tx_group=default
store.mode=db
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.jdbc.Driver
store.db.url=jdbc:mysql://IP:3306/seata?useUnicode=true
store.db.user=用户
store.db.password=******8
store.db.minConn=5
store.db.maxConn=30
store.db.globalTable=global_table
store.db.branchTable=branch_table
store.db.queryLimit=100
store.db.lockTable=lock_table
store.db.maxWait=5000
#执行nacos-config.sh脚本注册到nacos里面
sh nacos-config.sh
2. 启动seata
sh /data/seata/bin/seata-server.sh > seata.log &
#检查Nacos里面的服务列表是否有seata-server这个服务,有的话则注册成功