docker seata

docker pull seataio/seata-server:1.6.1

数据库脚本:

incubator-seata/script/server/db at master · apache/incubator-seata · GitHub
 

#先启动服务

docker run -d --name seata -p 8091:8091 -p 7091:7091 seataio/seata-server:1.6.1

#将配置文件拷贝出来

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

#修改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: ${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
    nacos:
      server-addr: 120.46.162.36:8848   # nacos的访问地址,因为是在docker中,ip地址改为宿主机地址
      namespace:
      group: SEATA_GROUP  # nacos的分组
      username: nacos     # nacos的用户名
      password: dhc@2023Qwe!     # nacos的密码
      context-path:
      ##if use MSE Nacos with auth, mutex with username/password attribute
      #access-key:
      #secret-key:
      data-id: seata.properties  # nacos中的配置文件名称
  registry:
    # support: nacos, eureka, redis, zk, consul, etcd3, sofa
    type: nacos
    nacos:
      application: seata-server       # seata启动后在nacos的服务名
      server-addr: 120.46.162.36:8848  # nacos的访问地址,因为是在docker中,ip地址改为宿主机地址
      group: SEATA_GROUP   # nacos的分组
      namespace:
      cluster: default     # 这个歌参数在每个微服务seata时会用到
      username: nacos      # nacos的用户名
      password: dhc@2023Qwe!      # nacos的密码
      context-path:
      ##if use MSE Nacos with auth, mutex with username/password attribute
      #access-key:
      #secret-key:
  store:    
    # support: file 、 db 、 redis
    mode: db
    db:
      datasource: druid
      db-type: mysql
      driver-class-name: com.mysql.jdbc.Driver
      url: jdbc:mysql://120.46.162.36:13306/seata?characterEncoding=utf8&connectTimeout=10000&socketTimeout=30000&autoReconnect=true&useUnicode=true&useSSL=false
      user: root
      password: i379aBcp
      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
#  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

在nacos中创建seata.properties

store.mode=db
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.cj.jdbc.Driver
store.db.url=jdbc:mysql://120.46.162.36:13306/seata?useUnicode=true
store.db.user=root
store.db.password=i379aBcp
store.db.minConn=5
store.db.maxConn=30
store.db.globalTable=global_table
store.db.branchTable=branch_table
store.db.queryLimit=100
store.db.lockTable=lock_table
store.db.maxWait=5000

docker stop seata

docker rm seata

docker run -d --name seata \
-p 8091:8091 \
-p 7091:7091 \
-v /data/seata/resources:/seata-server/resources \
seataio/seata-server:1.6.1

相关推荐

最近更新

  1. TCP协议是安全的吗?

    2024-05-01 17:58:01       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-05-01 17:58:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-05-01 17:58:01       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-05-01 17:58:01       20 阅读

热门阅读

  1. Hadoop生态系统的核心组件探索

    2024-05-01 17:58:01       8 阅读
  2. RabbitMQ Transport indicated EOF 总结

    2024-05-01 17:58:01       10 阅读
  3. oracle的sqlplus默认会执行的脚本

    2024-05-01 17:58:01       10 阅读
  4. 访问一个 HTTP 接口却收到 HTTPS 错误的响应

    2024-05-01 17:58:01       9 阅读
  5. python实现RGB模式颜色转换器

    2024-05-01 17:58:01       11 阅读
  6. Centos7安装完ifconfig命令出错:bash: command not found

    2024-05-01 17:58:01       7 阅读
  7. k8s pod 镜像拉取策略

    2024-05-01 17:58:01       8 阅读
  8. Python解释器:编程界的“翻译官”

    2024-05-01 17:58:01       10 阅读
  9. ps基础学习笔记-颜色模式

    2024-05-01 17:58:01       13 阅读
  10. 排序试题(一)

    2024-05-01 17:58:01       9 阅读