一个菜鸟的ELK服务搭建(踩坑)日记(5)- Seata篇

下载和安装

        从github上下载seata压缩包到本地

# 下载压缩包
curl -L -O https://github.com/seata/seata/releases/download/v1.4.2/seata-server-1.4.2.tar.gz
# 解压缩
tar -zvxf seata-server-1.4.2.tar.gz

配置和启动

        修改seata的配置文件,这里为了方便我先采用nacos作为服务注册中心,进入seata的conf配置文件目录

[seata@localhost seata-server-1.4.2]$ cd conf/
[seata@localhost conf]$ ll -l
total 24
-rw-r--r-- 1 seata seata 1859 Aug 18 15:44 file.conf
-rw-r--r-- 1 seata seata 3112 Aug 18 15:44 file.conf.example
drwxr-xr-x 2 seata seata  114 Aug 18 15:44 logback
-rw-r--r-- 1 seata seata 2222 Aug 18 15:44 logback.xml
drwxr-xr-x 3 seata seata   22 Aug 18 15:44 META-INF
-rw-r--r-- 1 seata seata 1324 Aug 18 15:44 README.md
-rw-r--r-- 1 seata seata 1327 Aug 18 15:44 README-zh.md
-rw-r--r-- 1 seata seata 1938 Aug 18 15:44 registry.conf

分布式事务保存模式 

   修改保存文件file.conf

## transaction log store, only used in seata-server
## 这里我默认使用db的方式保存,将分布式的事务记录保存到mysql中
store {
  ## store mode: file、db、redis
  mode = "db"
  ## rsa decryption public key
  publicKey = ""
  ## 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)/HikariDataSource(hikari) etc.
    datasource = "druid"
    ## mysql/oracle/postgresql/h2/oceanbase etc.
    dbType = "mysql"
    driverClassName = "com.mysql.jdbc.Driver"
    ## if using mysql to store the data, recommend add rewriteBatchedStatements=true in jdbc connection param
    url = "jdbc:mysql://192.168.10.193:3306/seata?rewriteBatchedStatements=true"
    user = "gdca"
    password = "gdca@1234"
    minConn = 5
    maxConn = 100
    globalTable = "global_table"
    branchTable = "branch_table"
    lockTable = "lock_table"
    queryLimit = 100
    maxWait = 5000
  }

  ## redis store property
  redis {
    ## redis mode: single、sentinel
    mode = "single"
    ## single mode property
    single {
      host = "127.0.0.1"
      port = "6379"
    }
    ## sentinel mode property
    sentinel {
      masterName = ""
      ## such as "10.28.235.65:26379,10.28.235.65:26380,10.28.235.65:26381"
      sentinelHosts = ""
    }
    password = ""
    database = "0"
    minConn = 1
    maxConn = 10
    maxTotal = 100
    queryLimit = 100
  }
}

修改配置文件registry.conf

[seata@localhost conf]$ vim registry.conf 
registry {
  # 选择分布式服务的配置保存模式
  # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
  # 这个意思是用文件的形式保存,这里我改成用nacos
  type = "nacos"
  nacos {
    application = "seata-server"
    serverAddr = "192.168.10.194:8848"
    group = "SEATA_GROUP"
    namespace = ""
    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"
    aclToken = ""
  }
  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"
    addressWait
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值