分布式事务 seata2.5部署问题 nacos,db启动使用

1. 下载源码 :

https://github.com/apache/incubator-seata

image

2. 本地启动注意:

缺少包的情况大部分需要编译proto文件

image

下载proto https://github.com/protocolbuffers/protobuf/releases

2.1 插件编译

idea 插件 Protobuf Generator
在工具里配置

image

3. 配置文件

application.yml 参考application.example.yml

参考配置

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
server:
  port: 8091
spring:
  application:
    name: seata-server
  main:
    web-application-type: none
logging:
  config: classpath:logback-spring.xml
  file:
    path: /data/logs/seata
  extend:
    logstash-appender:
      # off by default
      enabled: false
      destination: 127.0.0.1:4560
    kafka-appender:
      # off by default
      enabled: false
      bootstrap-servers: 127.0.0.1:9092
      topic: logback_to_logstash
      producer:
        acks: 0
        linger-ms: 1000
        max-block-ms: 0
    metric-appender:
      # off by default
      enabled: false
seata:
  config:
    type: nacos
    nacos:
      server-addr: 127.0.0.1:8848
      namespace: 240ed423-32d6-4e8e-b848-04fefd4600f8
      group: SEATA_GROUP
      username: nacos
      password: nacos
      data-id: seataServer.properties
  registry:
    type: nacos
    nacos:
      application: seata-server
      server-addr: 127.0.0.1:8848
      group: SEATA_GROUP
      namespace: 240ed423-32d6-4e8e-b848-04fefd4600f8
      cluster: default
      username: nacos
      password: nacos
  server:
    service-port: 8091 # If not configured, the default is '${server.port}'
    max-commit-retry-timeout: -1
    max-rollback-retry-timeout: -1
    rollback-failed-unlock-enable: false
    enable-check-auth: true
    enable-parallel-request-handle: true
    enable-parallel-handle-branch: false
    retry-dead-threshold: 70000
    xaer-nota-retry-timeout: 60000
    enableParallelRequestHandle: true
    applicationDataLimitCheck: true
    applicationDataLimit: 64000
    recovery:
      committing-retry-period: 1000
      async-committing-retry-period: 1000
      rollbacking-retry-period: 1000
      end-status-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
    ratelimit:
      enable: false
      bucketTokenNumPerSecond: 999999
      bucketTokenMaxNum: 999999
      bucketTokenInitialNum: 999999

3.1 nacos配置

增加nacos中mysql配置

image
配置参考
script/config-center/config.txt

image

3.1 mysql配置

新建seata-server数据库, 名字无所谓

脚本目录 script/server/db
找到 mysql.sql

4. 数据库版本, 需要指定数据库驱动

8.0 需要下载驱动到src/main/resources/jdbc目录下
驱动下载 https://downloads.mysql.com/archives/c-j/

服务启动成功

image

image

确保nacos名空间组名等保持一致

posted @ 2025-08-20 23:20  freedomlog  阅读(244)  评论(0)    收藏  举报