SpringCloud教程 | 第八篇: 使用seata处理分布式事务

1、参考程序员江小北

2、打算降低nacos版本,先学通再看看升级到高版本nacos能不能正常使用。

3、nacos用1.4.1,正常启动单机版的了

4、seata用2.0.0

我看江小北说用的1.4.0的seata,但是图片中的目录文件都找不到,倒是在2.0.0的seata中找到了,于是使用2.0.0的seata

4.1导入seata数据库

4.2、在源码目录下打开GitBash,输入shnacos-config.sh,导入完成后,可在nacos中查看到所有配置;

5、 修改seata配置文件,修改注册中心及配置中心为nacos,配置nacos地址;

参考江小北的,发现启动不了服务了。

搜了一圈资料,发现有个模板文件可以参考:

application.yml文件最终内容如下:

#  Copyright 1999-2019 Seata.io Group.
#
#  Licensed 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: 7091

spring:
  application:
    name: seata-server

logging:
  config: classpath:logback-spring.xml
  file:
    path: ${log.home:${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: seata
    password: seata
seata:
  config:
    # support: nacos, consul, apollo, zk, etcd3
    # type: nacos
    type: nacos
    nacos:
      server-addr: 127.0.0.1:8848
      namespace:
      group: SEATA_GROUP
      username:
      password:
      context-path:
      ##if use MSE Nacos with auth, mutex with username/password attribute
      #access-key:
      #secret-key:
      data-id: seataServer.properties
  registry:
    # support: nacos, eureka, redis, zk, consul, etcd3, sofa
    # type: file
    type: nacos
    preferred-networks: 30.240.*
    nacos:
      application: seata-server
      server-addr: 127.0.0.1:8848
      group: SEATA_GROUP
      namespace:
      cluster: default
      username:
      password:
      context-path:
      ##if use MSE Nacos with auth, mutex with username/password attribute
      #access-key:
      #secret-key:
  #store:
    # support: file 、 db 、 redis 、 raft
    #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,/**/*.jpeg,/**/*.ico,/api/v1/auth/login,/metadata/v1/**

6、启动seata

点击该文件启动seata

seat服务注册到nacos中了。

相关推荐

  1. springcloud4季 springcloud-alibaba之分布式事务seata

    2024-07-13 07:40:07       27 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-13 07:40:07       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-13 07:40:07       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-13 07:40:07       58 阅读
  4. Python语言-面向对象

    2024-07-13 07:40:07       69 阅读

热门阅读

  1. Tinker集成备忘录

    2024-07-13 07:40:07       18 阅读
  2. TypeScript学习笔记

    2024-07-13 07:40:07       26 阅读
  3. MIME 类型

    2024-07-13 07:40:07       24 阅读
  4. 35、php 实现构建乘积数组、正则表达式匹配

    2024-07-13 07:40:07       22 阅读
  5. django ninja get not allowed 能用 put delete

    2024-07-13 07:40:07       22 阅读
  6. 【算法】删除链表的倒数第 N 个结点

    2024-07-13 07:40:07       21 阅读
  7. 力扣-bfs

    2024-07-13 07:40:07       22 阅读
  8. 访问本地SQL Server:巴比达内网穿透的又一妙用

    2024-07-13 07:40:07       23 阅读
  9. 会话固定攻击

    2024-07-13 07:40:07       25 阅读