阿里分布式事务 seata 入门 (一)

新建目录

mkdir /roo/seata/config
cd /root/seata/config

创建相关配置文件 

vi registry.conf  

# 内容如下

registry {
 type = "eureka"
 eureka { 
    serviceUrl = "http://192.168.0.189:8761/eureka,http://192.168.0.189:8762/eureka"
    application = "SEATA"
    weight = "1"
 }
}

config {
   type = "file"
   file {
   # 存储模式的配置
     name = "./file.conf"
   }
}
vi file.conf 

# 内容如下

service {
  #transaction service group mapping
  #注册中心指定的Application name
  vgroup_mapping.my_test_tx_group = "SEATA"
  #only support when registry.type=file, please don't set multiple addresses
  # file模式不需要配置这个参数
  SEATA.grouplist = "192.168.0.189:8091"
  #disable seata
  disableGlobalTransaction = false
}

## transaction log store, only used in seata-server
store {
  ## store mode: file、db
  # 指定存储模式为db,集群必须配置为db
  mode = "db"

  ## file store property
  file {
    ## store location dir
    dir = "sessionStore"
  }

  ## database store property
  # 第一步创建数据表的数据库配置参数
  db {
    ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc.
    datasource = "druid"
    ## mysql/oracle/h2/oceanbase etc.
    db-type = "mysql"
    driver-class-name = "com.mysql.jdbc.Driver"
    url = "jdbc:mysql://192.168.0.155:3306/seata"
    user = "root"
    password = "123456"
  }
}



 

 docker 启动

docker run --name seata-server \
        -p 8091:8091 \
        -e SEATA_CONFIG_NAME=file:/root/seata-config/registry \
        -v /root/seata/config:/root/seata-config  \
        -e SEATA_IP=192.168.0.189 \
        -e SEATA_PORT=8091 \
        seataio/seata-server

 

docker run --name seata-server2 \
        -p 8092:8092 \
        -e SEATA_CONFIG_NAME=file:/root/seata-config/registry \
        -v /root/seata/config:/root/seata-config  \
        -e SEATA_IP=192.168.0.189 \
        -e SEATA_PORT=8092 \
        seataio/seata-server

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值