新建目录
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