一 注册失败的搭建过程        Docker搭建Seata服务并注册到Nacos中_calm_encode的博客-CSDN博客一 获取镜像docker search seatadocker pull seataio/seata-server二 创建本地Seata数据库 seata的官方数据库脚本seata/mysql.sql at develop · seata/seata · GitHub:fire: Seata is an easy-to-use, high-performance, open source distributed transaction solution. - seata/m...https://blog.csdn.net/calm_encode/article/details/123418750二 注册成功的搭建过程

        在上面的搭建基础上,将容器中的seata-server包拷贝到宿主主机上:

docker cp seata:/seata-server /data/seata/

        说明:seata是指启动的容器名

        停止并删除启动中的容器

docker stop seata

docker rm seata

        修改配置文件application.yml

        修改前

server:
  port: 7091

spring:
  application:
    name: seata-server

logging:
  config: classpath:logback-spring.xml
  file:
    path: ${user.home}/logs/seata
  extend:
    logstash-appender:
      destination: 127.0.0.1:4560
    kafka-appender:
      bootstrap-servers: 127.0.0.1:9092
      topic: logback_to_logstash

console:
  user:
    username: admin
    password: admin

seata:
  config:
    # support: nacos, consul, apollo, zk, etcd3
    type: file
  registry:
    # support: nacos, eureka, redis, zk, consul, etcd3, sofa
    type: file
  store:
    # support: file 、 db 、 redis
    mode: file
#  server:
#    service-port: 8091 #If not configured, the default is '${server.port} + 1000'
  security:
    secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
    tokenValidityInMilliseconds: 1800000
    ignore:
      urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/api/v1/auth/login

        修改后

server:
  port: 7091

spring:
  application:
    name: seata-server

logging:
  config: classpath:logback-spring.xml
  file:
    path: ${user.home}/logs/seata
  extend:
    logstash-appender:
      destination: 127.0.0.1:4560
    kafka-appender:
      bootstrap-servers: 127.0.0.1:9092
      topic: logback_to_logstash

console:
  user:
    username: admin
    password: admin

seata:
  config:
    # support: nacos, consul, apollo, zk, etcd3
    type: nacos
    nacos:
      server-addr: ip:8848
      group: SEATA_GROUP
      namespace: b94cfd49-3743-4bac-b1d3-41dcc2d07070
      username: nacos
      password: nacos
  registry:
    # support: nacos, eureka, redis, zk, consul, etcd3, sofa
    type: nacos
    nacos:
      application: seata-server
      server-addr: ip:8848
      group: SEATA_GROUP
      namespace: b94cfd49-3743-4bac-b1d3-41dcc2d07070
      username: nacos
      password: nacos
  store:
    # support: file 、 db 、 redis
    mode: db
    db:
      datasource: druid
    ## mysql/oracle/postgresql/h2/oceanbase etc.
      dbType: mysql
      driverClassName: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://ip:3306/seata?rewriteBatchedStatements=true
      user: root
      password: root
      minConn: 5
      maxConn: 100
      globalTable: global_table
      branchTable: branch_table
      lockTable: lock_table
      queryLimit: 100
      maxWait: 5000

  #  server:
  #    service-port: 8091 #If not configured, the default is '${server.port} + 1000'
  security:
    secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
    tokenValidityInMilliseconds: 1800000
    ignore:
      urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/api/v1/auth/login

        重新启动一个新的seata容器

docker run -d --name seata -p 8091:8091 -e SEATA_CONFIG_NAME=file:/seata-server/registry.conf -e SEATA_IP=IP -e SEATA_PORT=8091 -v /data/seata/seata-server/:/seata-server/ --restart always seataio/seata-server

        

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐