一、下载
## 下载seata
wget https://github.com/apache/incubator-seata/releases/download/v2.0.0/seata-server-2.0.0.tar.gz## 解压
tar zxvf seata-server-2.0.0.tar.gz
二、执行sql文件
## 取出sql文件执行
cd /seata/script/server/db/mysql
## 找个mysql数据库执行
三、修改配置文件
vim /seata/conf/seata.conf
## 把下面几个节点更换称自己的
seata:config:type: nacosnacos:server-addr: 127.0.0.1:8848group: 'SEATA_GROUP'namespace: '' # 没有配置使用public命名空间 dataId: 'seataServer.properties' # 配置文件名称username: 'nacos' # nacos用户密码 没有可以不填写password: 'zc#5461q%Eq2' registry:type: nacosnacos:application: seata-serverserver-addr: 127.0.0.1:8848group: SEATA_GROUPnamespace:cluster: defaultusername: 'nacos'password: 'zc#5461q%Eq2'store:# support: file 、 db 、 redis 、 raftmode: db # 存储模式 数据库
四、nacos配置
在public中新建一个seataServer文件,指定为properties格式,如果不知道哪些可以配置,可以前往
github/nacos查看配置,自己本地解压出来的scrpit/config-center/config.txt中也有配置项目
client.rm.asyncCommitBufferLimit=10000
client.rm.lock.retryInterval=10
client.rm.lock.retryTimes=30
client.rm.lock.retryPolicyBranchRollbackOnConflict=true
client.rm.reportRetryCount=5
client.rm.tableMetaCheckEnable=true
client.rm.tableMetaCheckerInterval=60000
client.rm.sqlParserType=druid
client.rm.reportSuccessEnable=false
client.rm.sagaBranchRegisterEnable=false
client.rm.sagaJsonParser=fastjson
client.rm.tccActionInterceptorOrder=-2147482648
client.tm.commitRetryCount=5
client.tm.rollbackRetryCount=5
client.tm.defaultGlobalTransactionTimeout=60000
client.tm.degradeCheck=false
client.tm.degradeCheckAllowTimes=10
client.tm.degradeCheckPeriod=2000
client.tm.interceptorOrder=-2147482648
client.undo.dataValidation=true
client.undo.logSerialization=jackson
client.undo.onlyCareUpdateColumns=true
server.undo.logSaveDays=7
server.undo.logDeletePeriod=86400000
client.undo.logTable=undo_log
client.undo.compress.enable=true
client.undo.compress.type=zip
client.undo.compress.threshold=64k
#For TCC transaction mode
tcc.fence.logTableName=tcc_fence_log
tcc.fence.cleanPeriod=1h#Log rule configuration, for client and server
log.exceptionRate=100#Transaction storage configuration, only for the server. The file, db, and redis configuration values are optional.
store.mode=db
store.lock.mode=db
store.session.mode=db
#Used for password encryption
#store.publicKey=#If `store.mode,store.lock.mode,store.session.mode` are not equal to `file`, you can remove the configuration block.
store.file.dir=file_store/data
store.file.maxBranchSessionSize=16384
store.file.maxGlobalSessionSize=512
store.file.fileWriteBufferCacheSize=16384
store.file.flushDiskMode=async
store.file.sessionReloadReadSize=100#These configurations are required if the `store mode` is `db`. If `store.mode,store.lock.mode,store.session.mode` are not equal to `db`, you can remove the configuration block.
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.jdbc.Driver
store.db.url=jdbc:mysql://10.1.0.45:3306/seata?useUnicode=true&rewriteBatchedStatements=true
store.db.user=seata
store.db.password=ss!Di9%80*J60
store.db.minConn=5
store.db.maxConn=30
store.db.globalTable=global_table
store.db.branchTable=branch_table
store.db.distributedLockTable=distributed_lock
store.db.queryLimit=100
store.db.lockTable=lock_table
store.db.maxWait=5000
五、启动
sh ./bin/seata-server.sh -p 8091 -h 10.1.0.45
登录ip+7091即可