Seata 部署遇到的各种奇葩问题
1、在部署阶段使用的是MariaDB,虽说这个也算上mysql,但是那seata就是链接不上该数据库,最后实在太恶心,我就换用mysql8.0的数据库,解决一切奇奇怪怪的问题。建议大家不要尝试奇奇怪怪的非主流数据库,除非有厂家支持。该项目是自己公司使用,用的服务器是铁威马网络存储服务器,吐槽一下这个服务器,真垃圾。
2、在部署Seata的时候一定要按照官网给的配置文件和mysql表进行操作,不要随便在网上抄,因为版本不一样,到时候又是各种字段报错,然后稀里糊涂各种看源码,一顿恶心。
我在写配置文件的时候少了日志的配置,也是各种出问题。我的部署方式用docker-compose+eureka
docker-compose的配置文件如下:
seata:
image: seataio/seata-server:1.8.0
hostname: seata
container_name: seata
volumes:
- /Volume1/docker/seata-server/resources/application.yml:/seata-server/resources/application.yml
ports:
- 7091:7091
networks:
- bri
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: seata
password: seata
seata:
registry:
# support: nacos 、 eureka 、 redis 、 zk 、 consul 、 etcd3 、 sofa
type: eureka
eureka:
service-url: http://ecms-registry:10070/eureka
application: seata-server
weight: 1
server:
max-commit-retry-timeout: -1
max-rollback-retry-timeout: -1
rollback-retry-timeout-unlock-enable: false
enable-check-auth: true
enable-parallel-request-handle: true
retry-dead-threshold: 130000
xaer-nota-retry-timeout: 60000
enableParallelRequestHandle: true
recovery:
committing-retry-period: 1000
async-committing-retry-period: 1000
rollbacking-retry-period: 1000
timeout-retry-period: 1000
undo:
log-save-days: 7
log-delete-period: 86400000
session:
branch-async-queue-size: 5000 #branch async remove queue size
enable-branch-async-remove: false #enable to asynchronous remove branchSession
store:
mode: db
session:
mode: db
lock:
mode: db
db:
datasource: druid
db-type: mysql
driver-class-name: com.mysql.cj.jdbc.Driver #这里需要根据你的mysql的实际版本去判断使
用什么驱动mysql8.0使用com.mysql.cj.jdbc.Driver,其他使用com.mysql.jdbc.Driver。官网上
有具体看官网
url: jdbc:mysql://192.168.1.111:3306/ECMS?rewriteBatchedStatements=true
user: root
password: 000000000
min-conn: 10
max-conn: 100
global-table: global_table
branch-table: branch_table
lock-table: lock_table
distributed-lock-table: distributed_lock
query-limit: 1000
max-wait: 5000
metrics:
enabled: false
registry-type: compact
exporter-list: prometheus
exporter-prometheus-port: 9898
transport:
rpc-tc-request-timeout: 15000
enable-tc-server-batch-send-response: false
shutdown:
wait: 3
thread-factory:
boss-thread-prefix: NettyBoss
worker-thread-prefix: NettyServerNIOWorker
boss-thread-size: 1
security:
secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
tokenValidityInMilliseconds: 1800000
ignore:
urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/api/v1/auth/login