1. 下载压缩包,解压
https://github.com/seata/seata/releases
我用的1.5.2版本
2. 建表
script/server/db目录下有建表sql
3. 改配置
config/application.yml
server:
port: 7091
spring:
application:
name: seata-server
logging:
config: classpath:logback-spring.xml
file:
path: ${user.home}/logs/seata
#登录控制台用的账密
console:
user:
username: xxxx
password: yyyy
#使用nacos做配置中心和注册中心
seata:
config:
# support: nacos, consul, apollo, zk, etcd3
type: nacos
nacos:
serverAddr: xx.xx.xx.xx:8848
namespace: nnnnnnnnnn
group: SEATA_GROUP #需要与前面创建的配置文件相对应
username: uuuuu
password: ppppp
file-extension: yml
dataId: seata-server.yml #需要与前面创建的配置文件相对应
registry:
# support: nacos, eureka, redis, zk, consul, etcd3, sofa
type: nacos
nacos:
serverAddr: xx.xx.xx.xx:8848
namespace: nnnnnnnnnn
group: SEATA_GROUP
username: uuuuu
password: ppppp
application: ${spring.application.name}
#store:
# support: file 、 db 、 redis
#mode: file
security:
secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
tokenValidityInMilliseconds: 1800000
ignore:
urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/api/v1/auth/login
4. 添加nacos配置
- dataId: seata-server.yml, group: SEATA_GROUP
service:
vgroupMapping:
netty-seata-test-group: default
netty-system-platform-group: default
netty-mybatis-plus-test-group: default
seata-storage-service: default
enableDegrade: false
disableGlobalTransaction: false
client:
rm:
asyncCommitBufferLimit: 10000
lock:
retryInterval: 10
retryTimes: 30
retryPolicyBranchRollbackOnConflict: true
reportRetryCount: 5
tableMetaCheckEnable: true
tableMetaCheckerInterval: 60000
sqlParserType: druid
reportSuccessEnable: false
sagaBranchRegisterEnable: false
sagaJsonParser: fastjson
tccActionInterceptorOrder: -2147482648
tm:
commitRetryCount: 5
rollbackRetryCount: 5
defaultGlobalTransactionTimeout: 60000
degradeCheck: false
degradeCheckAllowTimes: 10
degradeCheckPeriod: 2000
interceptorOrder: -2147482648
undo:
dataValidation: true
logSerialization: jackson
onlyCareUpdateColumns: true
logTable: undo_log
compress:
enable: true
type: zip
threshold: 64k
server:
undo:
logSaveDays: 7
logDeletePeriod: 86400000
recovery:
committingRetryPeriod: 1000
asynCommittingRetryPeriod: 1000
rollbackingRetryPeriod: 1000
timeoutRetryPeriod: 1000
maxCommitRetryTimeout: -1
maxRollbackRetryTimeout: -1
rollbackRetryTimeoutUnlockEnable: false
distributedLockExpireTime: 10000
xaerNotaRetryTimeout: 60000
session:
branchAsyncQueueSize: 5000
enableBranchAsyncRemove: false
enableParallelRequestHandle: false
tcc:
fence:
logTableName: tcc_fence_log
cleanPeriod: 1h
log:
exceptionRate: 100
store:
mode: db
lock:
mode: db
session:
mode: db
db:
datasource: druid
dbType: mysql
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://xx.xx.xx.xx:3306/seata?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
user: uuuu
password: pppp
minConn: 5
maxConn: 30
globalTable: global_table
branchTable: branch_table
distributedLockTable: distributed_lock
queryLimit: 100
lockTable: lock_table
maxWait: 5000
metrics:
enabled: false
registryType: compact
exporterList: prometheus
exporterPrometheusPort: 9898
transport:
type: TCP
server: NIO
heartbeat: true
enableTmClientBatchSendRequest: false
enableRmClientBatchSendRequest: true
enableTcServerBatchSendResponse: false
rpcRmRequestTimeout: 30000
rpcTmRequestTimeout: 30000
rpcTcRequestTimeout: 30000
threadFactory:
bossThreadPrefix: NettyBoss
workerThreadPrefix: NettyServerNIOWorker
serverExecutorThreadPrefix: NettyServerBizHandler
shareBossWorker: false
clientSelectorThreadPrefix: NettyClientSelector
clientSelectorThreadSize: 1
clientWorkerThreadPrefix: NettyClientWorkerThread
bossThreadSize: 1
workerThreadSize: default
shutdown:
wait: 3
serialization: seata
compressor: none
- dataId: service.vgroupMapping.seata-storage-service, group: SEATA_GROUP
default
5 启动
运行bin/seata-server.sh
访问控制台 http://xx.xx.xx.xx:7091/#/login