zoukankan      html  css  js  c++  java
  • docker 运行 seata-server 配置nacos

    1、拉取镜像

    docker pull seataio/seata-server:1.2.0

    2、运行镜像

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

    3、复制配置文件到主机

    docker cp seata-server:/seata-server  /home/dockerdata/seata

    4、停止服务

    docker stop seata-server

    5、删除服务

    docker rm seata-server

    6、重新运行服务,至此服务已经启动完成,接下来就是在/home/dockerdata/seata/seata-server目录中修改对应的配置(设置开机自启和关键配置挂载到本地目录方便修改配置)

    docker run -d --restart always  --name  seata-server -p 8091:8091  -v /home/dockerdata/seata:/seata-server -e SEATA_IP=172.168.1.35 -e SEATA_PORT=8091 seataio/seata-server:1.2.0 

    7、切换到seata配置目录

    cd /home/dockerdata/seata/resources

    8、修改registry.conf文件,修为nacos启用方式,绿色字体为修改的关键地方

    registry {
      # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
      type = "nacos"
    
      nacos {
        application = "seata-server"
        serverAddr = "172.168.1.35:8848"
        namespace = "89f54c6f-3b21-46a4-bd1b-242ae159c12e"
        cluster = "default"
        username = ""
        password = ""
      }
      eureka {
        serviceUrl = "http://localhost:8761/eureka"
        application = "default"
        weight = "1"
      }
      redis {
        serverAddr = "localhost:6379"
        db = 0
        password = ""
        cluster = "default"
        timeout = 0
      }
      zk {
        cluster = "default"
        serverAddr = "127.0.0.1:2181"
        sessionTimeout = 6000
        connectTimeout = 2000
        username = ""
        password = ""
      }
      consul {
        cluster = "default"
        serverAddr = "127.0.0.1:8500"
      }
      etcd3 {
        cluster = "default"
        serverAddr = "http://localhost:2379"
      }
      sofa {
        serverAddr = "127.0.0.1:9603"
        application = "default"
        region = "DEFAULT_ZONE"
        datacenter = "DefaultDataCenter"
        cluster = "default"
        group = "SEATA_GROUP"
        addressWaitTime = "3000"
      }
      file {
        name = "file.conf"
      }
    }
    
    config {
      # file、nacos 、apollo、zk、consul、etcd3
      type = "file"
    
      nacos {
        serverAddr = "172.168.1.35:8848"
        namespace = "89f54c6f-3b21-46a4-bd1b-242ae159c12e"
        group = "DEFAULT_GROUP"
        username = ""
        password = ""
      }
      consul {
        serverAddr = "127.0.0.1:8500"
      }
      apollo {
        appId = "seata-server"
        apolloMeta = "http://192.168.1.204:8801"
        namespace = "application"
      }
      zk {
        serverAddr = "127.0.0.1:2181"
        sessionTimeout = 6000
        connectTimeout = 2000
        username = ""
        password = ""
      }
      etcd3 {
        serverAddr = "http://localhost:2379"
      }
      file {
        name = "file.conf"
      }
    }

    项目中的库需要执行,sql文件路径:https://github.com/seata/seata/tree/develop/script/client

    seata服务 需要sql https://github.com/seata/seata/tree/develop/script/server

    不用的模式执行不同的脚本

    具体的注意点查看/home/dockerdata/seata/README-zh.md

    9、修改存储方式为mysql

    store {
      ## store mode: file、db
      mode = "db"
    
      ## file store property
      file {
        ## store location dir
        dir = "sessionStore"
        # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
        maxBranchSessionSize = 16384
        # globe session size , if exceeded throws exceptions
        maxGlobalSessionSize = 512
        # file buffer size , if exceeded allocate new buffer
        fileWriteBufferCacheSize = 16384
        # when recover batch read size
        sessionReloadReadSize = 100
        # async, sync
        flushDiskMode = async
      }
    
      ## database store property
      db {
        ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc.
        datasource = "druid"
        ## mysql/oracle/postgresql/h2/oceanbase etc.
        dbType = "mysql"
        driverClassName = "com.mysql.jdbc.Driver"
        url = "jdbc:mysql://127.0.0.1:3306/seata?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false&serverTimezone=Asia/Shanghai"
        user = "root"
        password = "root"
        minConn = 5
        maxConn = 30
        globalTable = "global_table"
        branchTable = "branch_table"
        lockTable = "lock_table"
        queryLimit = 100
        maxWait = 5000
      }
    }

    10、重启服务

    docker restart seata-server
    docker logs seata-server #查看启动日志

    11、可以登录nacos查看服务列表,就会发现seata-server已经注册上来了

    我是参考此文章写出:https://blog.csdn.net/qq_36476972/article/details/105842611?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-17&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-17

  • 相关阅读:
    WPF ViewModel 调用任意前台控件的方法
    xxxx
    modelsim一些error(warning)的原因
    [verilog] inout端口处理
    [c语言]指针数组和数组指针
    电机控制术语
    MAC和PHY关系
    IAR map文件说明
    [corterm3]汇编语法
    TI 2802x系列中断系统及应用
  • 原文地址:https://www.cnblogs.com/binz/p/12841125.html
Copyright © 2011-2022 走看看