当前位置: 首页 > article >正文

centos集群部署seata

文章目录

      • 场景
      • 环境介绍
      • 100.64.0.3节点部署seata
      • 100.64.0.4节点部署seata
      • nacos注册的效果
      • 我的配置,可以参考下

场景

生产环境都是以集群的方式部署seata, 这里演示下部署方式

环境介绍

  1. 2台centos7.9的开发机(内网ip100.64.0.4 ,100.64.0.3)
  2. jdk17
  3. 一个nacos服务
  4. 一个8.0.40版本的mysql服务
  5. seata 1.7.1集群部署

seata存储到mysql, 注册到nacos 所以需要做2个配置项的修改;
PS: 如果有需要的话 可以使用nacos替换file配置

100.64.0.3节点部署seata

  1. 下载seata 1.7.1安装包
wget https://github.com/seata/seata/releases/download/v1.7.1/seata-server-1.7.1.tar.gz

tar -zxvf seata-server-1.7.1.tar.gz 
  1. 初始化seata数据库

初始化sql脚本在 seata/script/server/db/mysql.sql
我新建了seata数据库
在这里插入图片描述

在这里插入图片描述

  1. 将存储切换到mysql

conf/application.yaml
在这里插入图片描述

  1. 注册到nacos

在这里插入图片描述

100.64.0.4节点部署seata

同 100.64.0.3节点

nacos注册的效果

在这里插入图片描述

我的配置,可以参考下

#  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: file
  registry:
    # support: nacos 、 eureka 、 redis 、 zk  、 consul 、 etcd3 、 sofa
    type: nacos
    nacos:
      application: seata-server
      server-addr: 100.64.0.4:8848
      group: DEFAULT_GROUP
      namespace: dev
      cluster: default
      username: nacos
      password: XCJiZWOBoF
      context-path:
      ##if use MSE Nacos with auth, mutex with username/password attribute
      #access-key:
      #secret-key:
    eureka:
      service-url: http://localhost:8761/eureka
      application: default
      weight: 1
    redis:
      server-addr: localhost:6379
      db: 0
      password:
      cluster: default
      timeout: 0
    zk:
      cluster: default
      server-addr: 127.0.0.1:2181
      session-timeout: 6000
      connect-timeout: 2000
      username:
      password:
    consul:
      cluster: default
      server-addr: 127.0.0.1:8500
      acl-token:
    etcd3:
      cluster: default
      server-addr: http://localhost:2379
    sofa:
      server-addr: 127.0.0.1:9603
      application: default
      region: DEFAULT_ZONE
      datacenter: DefaultDataCenter
      cluster: default
      group: SEATA_GROUP
      address-wait-time: 3000
  store:
    # support: file 、 db 、 redis
    mode: db
    session:
      mode: db
    lock:
      mode: db
    file:
      dir: sessionStore
      max-branch-session-size: 16384
      max-global-session-size: 512
      file-write-buffer-cache-size: 16384
      session-reload-read-size: 100
      flush-disk-mode: async
    db:
      datasource: druid
      db-type: mysql
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://100.64.0.4:3306/seata?rewriteBatchedStatements=true&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
      user: root
      password: Pw#s@Y#j1
      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
    redis:
      mode: single
      database: 0
      min-conn: 10
      max-conn: 100
      password:
      max-total: 100
      query-limit: 1000
      single:
        host: 127.0.0.1
        port: 6379
      sentinel:
        master-name:
        sentinel-hosts:
#  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

http://www.kler.cn/a/448080.html

相关文章:

  • c++--------c++概念
  • 文件解析漏洞中间件(iis和Apache)
  • 网络安全防范
  • 第十五届蓝桥杯Scratch01月stema选拔赛—排序
  • webview和H5来实现的android短视频(短剧)音视频播放依赖控件
  • 全志H618 Android12修改doucmentsui鼠标单击图片、文件夹选中区域
  • Mono里运行C#脚本1
  • arXiv-2024 | 当视觉语言导航遇见自动驾驶!doScenes:基于自然语言指令的人车交互自主导航驾驶数据集
  • 【hackmyvm】eigthy 靶机wp
  • 无人机视频传输系统的通信能耗优化
  • 拷贝构造和赋值运算符重载
  • 质量小议51 - 茧房
  • 主要模型记录
  • Ubuntu系统安装MySQL
  • GA-BP分类-遗传算法(Genetic Algorithm)和反向传播算法(Backpropagation)
  • java全栈day18--Web后端实战(java操作数据库2)
  • Linux export命令
  • Elasticsearch:什么是查询语言?
  • C++ 杨辉三角 - 力扣(LeetCode)
  • 如何制作搞笑配音视频?操作方法
  • 智能电商:API接口如何驱动自动化与智能化转型
  • Yolo11改进策略:主干网络改进|FastVit与Yolo11完美融合,重参数重构Yolo11网络(全网首发)
  • 插入排序与计数排序;数据库的三范式
  • DC-9靶场练习
  • JavaScript 类型转换的意外
  • 数组相关简单算法