網(wǎng)站首頁(yè) 編程語(yǔ)言 正文
零:相關(guān)問(wèn)題解決
一般容易忘比如云服務(wù)器安全組的開(kāi)放
docker ps 查看運(yùn)行中的容器
[root@VM-12-7-centos resources]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
406794a01181 seataio/seata-server:1.4.2 "java -Djava.securit…" 7 days ago Up 7 days 0.0.0.0:8091->8091/tcp seata-server
a374ab5f1856 nacos/nacos-server:1.3.1 "bin/docker-startup.…" 8 days ago Up 7 days 0.0.0.0:8848->8848/tcp nacos
0059b1e18df8 zookeeper:3.7.0 "/docker-entrypoint.…" 3 weeks ago Up 8 days 2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp, 8080/tcp zookeeper
a4d77b20c42d xuxueli/xxl-job-admin:2.1.2 "sh -c 'java -jar /a…" 6 months ago Up 8 days 0.0.0.0:8010->8080/tcp xxl-job-admin
查看日志
docker logs 406794a01181
09:59:45.280 INFO --- [ettyServerNIOWorker_1_3_4] i.s.c.r.n.AbstractNettyRemotingServer : channel exx:Adjusted frame length exceeds 8388608: 539959368 - discarded,channel:[id: 0x33f60f16, L:/172.17.0.4:8091 - R:/180.163.220.3:38428]
09:59:45.280 WARN --- [ettyServerNIOWorker_1_3_4] io.netty.channel.DefaultChannelPipeline : An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
==>
報(bào)錯(cuò)信息是netty 解碼大小相關(guān),百度上搜了一下有說(shuō)是版本號(hào)的,也有說(shuō)是沒(méi)有注冊(cè)到nacos相關(guān)原因;
宿主機(jī)相關(guān)配置檢查了一下是沒(méi)問(wèn)題的;
然后到容器里查看配置,如下;
發(fā)現(xiàn)并沒(méi)有生效,估計(jì)是中間運(yùn)行了幾次容器,容器掛載目錄可能失效了,手動(dòng)修改一下:
registry和file配置文件
[root@VM-12-7-centos resources]# docker exec -it 406794a01181 /bin/sh
/seata-server # ls
classes libs resources sessionStore
/seata-server # cd resources/
/seata-server/resources # ks
/bin/sh: ks: not found
/seata-server/resources # ks
/bin/sh: ks: not found
/seata-server/resources # ls
META-INF README-zh.md README.md file.conf file.conf.example io logback logback.xml registry.conf
/seata-server/resources # vi registry.conf
registry {
# file ...nacos ...eureka...redis...zk...consul...etcd3...sofa
type = "file"
nacos {
application = "seata-server"
保存重啟seata和nacos服務(wù),查看日志和nacos客戶(hù)端,已經(jīng)有了剛剛的服務(wù)
一:拉取Seata鏡像
docker pull seataio/seata-server:1.4.2
二:創(chuàng)建Seata容器并指定掛載目錄
docker run -d \
--restart always \
--name seata-server \
-p 8091:8091 \
-v /docker-data/seata:/seata-server \
-e SEATA_IP=IP-ADDRESS \
-e SEATA_IP=101.****.62 \
-e SEATA_PORT=8091 \
seataio/seata-server:1.4.2
docker run -d \
--restart always \
--name seata-server \
-p 8091:8091 \
-v /docker-data/seata:/seata-server \
-e SEATA_IP=101.****.62 \
-e SEATA_PORT=8091 \
seataio/seata-server:1.4.2
三:拉取Nacos鏡像
docker pull nacos/nacos-server -----拉取nacos鏡像
四:創(chuàng)建Nacos容器
大致能運(yùn)行打開(kāi);
docker run \
--name nacos -d \
-p 8848:8848 \
--privileged=true \
--restart=always \
-e JVM_XMS=256m \
-e JVM_XMX=256m \
-e MODE=standalone \
-e PREFER_HOST_MODE=hostname \
nacos/nacos-server
五:創(chuàng)建Seata相關(guān)表
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for undo_log
-- ----------------------------
DROP TABLE IF EXISTS `undo_log`;
CREATE TABLE `undo_log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`branch_id` bigint(20) NOT NULL,
`xid` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`context` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`rollback_info` longblob NOT NULL,
`log_status` int(11) NOT NULL,
`log_created` datetime(0) NOT NULL,
`log_modified` datetime(0) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `ux_undo_log`(`xid`, `branch_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'seata操作記錄表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for branch_table
-- ----------------------------
DROP TABLE IF EXISTS `branch_table`;
CREATE TABLE `branch_table` (
`branch_id` bigint(20) NOT NULL,
`xid` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`transaction_id` bigint(20) NULL DEFAULT NULL,
`resource_group_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`resource_id` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`branch_type` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`status` tinyint(4) NULL DEFAULT NULL,
`client_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`application_data` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`gmt_create` datetime(6) NULL DEFAULT NULL,
`gmt_modified` datetime(6) NULL DEFAULT NULL,
PRIMARY KEY (`branch_id`) USING BTREE,
INDEX `idx_xid`(`xid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'seata分支事務(wù)表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for global_table
-- ----------------------------
DROP TABLE IF EXISTS `global_table`;
CREATE TABLE `global_table` (
`xid` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`transaction_id` bigint(20) NULL DEFAULT NULL,
`status` tinyint(4) NOT NULL,
`application_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`transaction_service_group` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`transaction_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`timeout` int(11) NULL DEFAULT NULL,
`begin_time` bigint(20) NULL DEFAULT NULL,
`application_data` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`gmt_create` datetime(0) NULL DEFAULT NULL,
`gmt_modified` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`xid`) USING BTREE,
INDEX `idx_gmt_modified_status`(`gmt_modified`, `status`) USING BTREE,
INDEX `idx_transaction_id`(`transaction_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'seata全局事務(wù)表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for lock_table
-- ----------------------------
DROP TABLE IF EXISTS `lock_table`;
CREATE TABLE `lock_table` (
`row_key` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`xid` varchar(96) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`transaction_id` bigint(20) NULL DEFAULT NULL,
`branch_id` bigint(20) NOT NULL,
`resource_id` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`table_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`pk` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`gmt_create` datetime(0) NULL DEFAULT NULL,
`gmt_modified` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`row_key`) USING BTREE,
INDEX `idx_branch_id`(`branch_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'seata鎖表' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
六:編輯Seata和Nacos相關(guān)配置
編輯配置相關(guān)文件 vim registry.conf
編輯以下兩部分:
注冊(cè)中心相關(guān)指向;
registry {
type = "nacos"
nacos {
# 應(yīng)用名
application = "seata-server"
# nacos ip 地址
serverAddr = "101.****:8848"
# nacos創(chuàng)建的分組
group = "SEATA_GROUP"
# nacos 創(chuàng)建的命名空間名
namespace = "seata-naming"
cluster = "default"
# nacos登錄的賬號(hào)和密碼
username = "nacos"
password = "nacos"
}
config {
# file、nacos 、apollo、zk、consul、etcd3
type = "nacos"
nacos {
# nacos ip 地址
serverAddr = "101.****:8848"
# nacos 創(chuàng)建的命名空間名
namespace = "seata-naming"
# nacos創(chuàng)建的分組
group = "SEATA_GROUP"
# nacos登錄的賬號(hào)和密碼
username = "nacos"
password = "nacos"
# nacos配置相當(dāng)于主鍵id,唯一標(biāo)識(shí)配置
dataId = "seataServer.properties"
}
file {
name = "file.conf"
}
}
編輯Seata存儲(chǔ)數(shù)據(jù)的相關(guān)配置文件 vim file.conf;
這里面連接的庫(kù)就是上面執(zhí)行腳本的庫(kù);
## transaction log store, only used in seata-server
store {
## store mode: file、db、redis
mode = "db"
## 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.cn.jdbc.Driver"
## if using mysql to store the data, recommend add rewriteBatchedStatements=true in jdbc connection param
url = "jdbc:mysql://182.****:3307/order-info"
user = "****"
password = "****"
minConn = 5
maxConn = 100
globalTable = "global_table"
branchTable = "branch_table"
lockTable = "lock_table"
queryLimit = 100
maxWait = 5000
}
}
七:進(jìn)入Nacos配置Seata相關(guān)信息
根據(jù)上一步注釋可以看到需要修改補(bǔ)充哪些字段屬性;
先在配置管理里面進(jìn)行相應(yīng)操作:
填寫(xiě):Data Id = seataServer.properties
GROUP = SEATA_GROUP
配置內(nèi)容:
transport.type=TCP
transport.server=NIO
transport.heartbeat=true
transport.enableClientBatchSendRequest=false
transport.threadFactory.bossThreadPrefix=NettyBoss
transport.threadFactory.workerThreadPrefix=NettyServerNIOWorker
transport.threadFactory.serverExecutorThreadPrefix=NettyServerBizHandler
transport.threadFactory.shareBossWorker=false
transport.threadFactory.clientSelectorThreadPrefix=NettyClientSelector
transport.threadFactory.clientSelectorThreadSize=1
transport.threadFactory.clientWorkerThreadPrefix=NettyClientWorkerThread
transport.threadFactory.bossThreadSize=1
transport.threadFactory.workerThreadSize=default
transport.shutdown.wait=3
service.vgroupMapping.storage-service-group=default
service.vgroupMapping.order-service-group=default
service.vgroupMapping.account-service-group=default
service.default.grouplist=192.168.23.3:8091
service.enableDegrade=false
service.disableGlobalTransaction=false
client.rm.asyncCommitBufferLimit=10000
client.rm.lock.retryInterval=10
client.rm.lock.retryTimes=30
client.rm.lock.retryPolicyBranchRollbackOnConflict=true
client.rm.reportRetryCount=5
client.rm.tableMetaCheckEnable=false
client.rm.tableMetaCheckerInterval=60000
client.rm.sqlParserType=druid
client.rm.reportSuccessEnable=false
client.rm.sagaBranchRegisterEnable=false
client.tm.commitRetryCount=5
client.tm.rollbackRetryCount=5
client.tm.defaultGlobalTransactionTimeout=60000
client.tm.degradeCheck=false
client.tm.degradeCheckAllowTimes=10
client.tm.degradeCheckPeriod=2000
store.mode=db
store.publicKey=
store.file.dir=file_store/data
store.file.maxBranchSessionSize=16384
store.file.maxGlobalSessionSize=512
store.file.fileWriteBufferCacheSize=16384
store.file.flushDiskMode=async
store.file.sessionReloadReadSize=100
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.cj.jdbc.Driver
store.db.url=jdbc:mysql://182.****:3307/order-info?useUnicode=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai
store.db.user=****
store.db.password=****
store.db.minConn=5
store.db.maxConn=30
store.db.globalTable=global_table
store.db.branchTable=branch_table
store.db.queryLimit=100
store.db.lockTable=lock_table
store.db.maxWait=5000
store.redis.mode=single
store.redis.single.host=127.0.0.1
store.redis.single.port=6379
store.redis.sentinel.masterName=
store.redis.sentinel.sentinelHosts=
store.redis.maxConn=10
store.redis.minConn=1
store.redis.maxTotal=100
store.redis.database=0
store.redis.password=
store.redis.queryLimit=100
server.recovery.committingRetryPeriod=1000
server.recovery.asynCommittingRetryPeriod=1000
server.recovery.rollbackingRetryPeriod=1000
server.recovery.timeoutRetryPeriod=1000
server.maxCommitRetryTimeout=-1
server.maxRollbackRetryTimeout=-1
server.rollbackRetryTimeoutUnlockEnable=false
client.undo.dataValidation=true
client.undo.logSerialization=jackson
client.undo.onlyCareUpdateColumns=true
server.undo.logSaveDays=7
server.undo.logDeletePeriod=86400000
client.undo.logTable=undo_log
client.undo.compress.enable=true
client.undo.compress.type=zip
client.undo.compress.threshold=64k
log.exceptionRate=100
transport.serialization=seata
transport.compressor=none
metrics.enabled=false
metrics.registryType=compact
metrics.exporterList=prometheus
metrics.exporterPrometheusPort=9898
創(chuàng)建命名空間:
用于后面區(qū)分唯一服務(wù)和配置 ->
命名空間ID(不填則自動(dòng)生成):seata-naming
命名空間名:seata
描述:desc
八:容器啟動(dòng)
docker stop seata-container-id 停掉
docker start seata-container-id 開(kāi)啟
docker ps 查看運(yùn)行中的容器
docker logs containerid 啟動(dòng)打印日志
我遇到的問(wèn)題放到了開(kāi)頭 第0點(diǎn)
原文鏈接:https://blog.csdn.net/Abraxs/article/details/125762857
相關(guān)推薦
- 2022-05-25 Python異常處理如何才能寫(xiě)得優(yōu)雅(retrying模塊)_python
- 2022-11-06 在Centos7中使用vscode和gdb調(diào)試PG插件的方法_C 語(yǔ)言
- 2022-07-03 python使用pandas讀xlsx文件的實(shí)現(xiàn)_python
- 2022-01-17 將字符串轉(zhuǎn)換成時(shí)間戳,yyyymmss到y(tǒng)yyy-mm-dd ,之后從時(shí)間戳轉(zhuǎn)換成時(shí)間格式字符串
- 2022-05-27 .Net動(dòng)態(tài)生成controller遇到的坑_實(shí)用技巧
- 2023-02-10 Pytorch模型微調(diào)fine-tune詳解_python
- 2022-08-30 android dialog懸浮和圓角
- 2022-08-01 MongoDB創(chuàng)建與刪除數(shù)據(jù)庫(kù)_MongoDB
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過(guò)濾器
- Spring Security概述快速入門(mén)
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支