登录
注册
写文章
发现
工具
docker部署seata server
_3t3lfz KEKfID
编辑文章
docker部署seata server
asfx站长
2021.06.08 11:19:32
阅读
1044
# docker部署seata server https://seata.io/zh-cn/docs/ops/deploy-by-docker.html 这里以1.4.1版本为例: 1. 启动seata-server实例 ``` docker run -d --name seata-server -p 8091:8091 seataio/seata-server:1.4.1 ``` 2. 把相关文件拷到宿主机,主要包含三个文件夹:classes、libs、resources ``` docker cp 1ba061641b3b:/seata-server/classes /data/dockerdata/seata/seata-server-141 docker cp 1ba061641b3b:/seata-server/libs /data/dockerdata/seata/seata-server-141 docker cp 1ba061641b3b:/seata-server/resources /data/dockerdata/seata/seata-server-141 ``` 3. 修改相关配置,配置文件在resources下,修改的文件为registry.conf和file.conf,删除原容器准备重建seata-server容器 参考配置: ##### registry.conf ``` registry { type = "nacos" loadBalance = "RandomLoadBalance" loadBalanceVirtualNodes = 10 nacos { application = "seata-server" serverAddr = "192.168.10.xx:8848" group = "SEATA_GROUP" namespace = "public" cluster = "default" username = "nacos" password = "nacos" } file { name = "file.conf" } } config { type = "nacos" nacos { serverAddr = "192.168.10.xx:8848" namespace = "public" group = "SEATA_GROUP" username = "nacos" password = "nacos" } file { name = "file.conf" } } ``` ##### file.conf ``` store { 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 { datasource = "druid" dbType = "mysql" driverClassName = "com.mysql.cj.jdbc.Driver" url = "jdbc:mysql://192.168.10.xxx:3309/test?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai" user = "xx" password = "xxx" minConn = 5 maxConn = 100 globalTable = "global_table" branchTable = "branch_table" lockTable = "lock_table" queryLimit = 100 maxWait = 5000 } } ``` #### 启动seata-server并挂载配置文件到宿主机 ``` docker run -d --name seata-server \ -p 8091:8091 \ -e SEATA_CONFIG_NAME=file:/seata-server/resources/registry -e SEATA_IP=172.16.27.72 \ -v /etc/localtime:/etc/localtime:ro \ -v /data/dockerdata/seata/seata-server-141:/seata-server -v /data/logs/seata:/root/logs/seata \ seataio/seata-server:1.4.1 ``` 注意: ``` # 让容器使用系统时区 -v /etc/localtime:/etc/localtime:ro ``` ##### 此时可以去nacos查看是否有seata-server的可用服务
我的主页
退出