在Linux和Windows上安装seata-1.6.0

news2024/9/23 11:25:24

记录:381

场景:在CentOS 7.9操作系统上,安装seata-1.6.0。在Windows上操作系统上,安装seata-1.6.0。Seata,一款开源的分布式事务解决方案,致力于提供高性能和简单易用的分布式事务服务。

版本:

JDK 1.8
seata-1.6.0
CentOS 7.9

官网地址:https://seata.io/

源码地址:https://github.com/seata/seata

官网手册:https://seata.io/zh-cn/docs/ops/deploy-guide-beginner.html

Seata,一款开源的分布式事务解决方案,致力于提供高性能和简单易用的分布式事务服务。

Three roles in Seata Framework:

Transaction Coordinator(TC): Maintain status of global and branch transactions, drive the global commit or rollback.

Transaction Manager(TM): Define the scope of global transaction: begin a global transaction, commit or rollback a global transaction.

Resource Manager(RM): Manage resources that branch transactions working on, talk to TC for registering branch transactions and reporting status of branch transactions, and drive the branch transaction commit or rollback.

一、在Linux上安装seata

安装Seata,存储模式使用MySQL,服务发现和配置使用Nacos。

1.下载Seata

版本:v1.6.0

发布日期:Dec 17, 2022

下载地址:wget https://github.com/seata/seata/releases/download/v1.6.0/seata-server-1.6.0.tar.gz

下载包:seata-server-1.6.0.tar.gz

2.解压Seata

解压命令:tar -zxvf seata-server-1.6.0.tar.gz -C /opt/seata-1.6.0

解析:把seata-server-1.6.0.tar.gz解压到/opt/seata-1.6.0。在seata下的目录。bin目录是启动脚本。conf目录是配置文件。ext目录下是skywalking插件相关内容。lib目录是全量jar包。logs目录是日志包。script目录是脚本目录。target目录是seata-server.jar包。

3.初始化数据库脚本

本例存储模式使用MySQL数据库。

3.1创建数据库和用户

用户名/口令:hub_seata/12345678

数据库名称:hub_seatadb

登录控制台:mysql -u root -p

在MySQL命令行控制台执行脚本。

USE mysql;
CREATE DATABASE hub_seatadb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER hub_seata@'%' IDENTIFIED BY '12345678';
GRANT ALL ON hub_seatadb.* TO 'hub_seata'@'%' IDENTIFIED BY '12345678';
FLUSH PRIVILEGES;

3.2初始化seata数据库

脚本目录:/opt/seata-1.6.0/script/server/db/mysql.sql

初始化表:branch_table、distributed_lock、global_table、lock_table。

4.启动Nacos

启动脚本目录:/opt/nacos-2.1.1/bin

4.1启动Nacos

启动命令:sh startup.sh -m standalone

地址:http://127.0.0.1:18848/nacos

用户名/口令:nacos/nacos

4.2创建seata命名空间

命名空间名称:hub_seata

命名空间ID:142eba5f-a7b5-4a83-85bb-663c582c8ef1

5.配置seata

在/opt/seata-1.6.0/conf目录下,application.example.yml是配置文件的模板,包含全量配置。application.yml是应用启动时加载配置,根据实际情况按需从application.example.yml中拷贝添加就行

5.1修改application.yml配置

修改文件:/opt/seata-1.6.0/conf/application.yml

修改内容:

server:
  port: 7091
spring:
  application:
    name: seata-server
logging:
  config: classpath:logback-spring.xml
  file:
    path: ${user.home}/logs/seata
  extend:
    logstash-appender:
      destination: 127.0.0.1:4560
    kafka-appender:
      bootstrap-servers: 127.0.0.1:9092
      topic: logback_to_logstash
console:
  user:
    username: seata
    password: seata
seata:
  config:
    type: nacos
    nacos:
      server-addr: 192.168.19.203:18848
      namespace: 142eba5f-a7b5-4a83-85bb-663c582c8ef1
      group: SEATA_GROUP
      username: nacos
      password: nacos
      context-path:
      data-id: seataServer.properties
  registry:
    type: nacos
    nacos:
      application: seata-server
      server-addr: 192.168.19.203:18848
      group: SEATA_GROUP
      namespace: 142eba5f-a7b5-4a83-85bb-663c582c8ef1
      cluster: default
      username: nacos
      password: nacos
      context-path:
  store:
    mode: db
    db:
      datasource: druid
      db-type: mysql
      driver-class-name: com.mysql.jdbc.Driver
      url: jdbc:mysql://192.168.19.202:3306/hub_seatadb?rewriteBatchedStatements=true
      user: hub_seata
      password: 12345678
      min-conn: 5
      max-conn: 100
      global-table: global_table
      branch-table: branch_table
      lock-table: lock_table
      distributed-lock-table: distributed_lock
      query-limit: 100
      max-wait: 5000    
  security:
    secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
    tokenValidityInMilliseconds: 1800000
    ignore:
      urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/api/v1/auth/login

5.2在Nacos新建seataServer.properties

5.2.1页面配置

在Nacos页面中,选择

命名空间:hub_seata。命名空间ID:142eba5f-a7b5-4a83-85bb-663c582c8ef1。创建配置seataServer.properties。

Data ID:seataServer.properties。

Group:SEATA_GROUP

配置格式:Properties

配置内容:从/opt/seata-1.6.0/script/config-center\config.txt文件中拷贝需求的配置。

本例从config.txt摘取的配置修改过的配置。

service.vgroupMapping.hub_tx_group=default
store.mode=db
store.lock.mode=db
store.session.mode=db
store.publicKey=123456
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.jdbc.Driver
store.db.url=jdbc:mysql://192.168.19.203:3306/hub_seatadb?useUnicode=true&rewriteBatchedStatements=true
store.db.user=hub_seata
store.db.password=12345678

解析:config.txt配置内容在源码包../seata-1.6.0/config/seata-config-core/src/main/resources/config.txt和安装包/opt/seata-1.6.0/script/config-center/config.txt两处位置都可以找到。

5.2.2配置生效

在Nacos中配置已经生效。

6启动seata

6.1启动seata

操作目录:/opt/seata-1.6.0/bin

启动命令:sh seata-server.sh

6.2查看seata日志

日志:/opt/seata-1.6.0/logs/start.out

命令:tail -f -n 300 /opt/seata-1.6.0/logs/start.out

6.3查看seata已注册

在Nacos已经注册了seata-server服务。

7基于普通用户使用seata

在启动seata时,不使用root用户直接启动,建议使用普通用户。

改变安装目录赋权给一个普通用户就可以。

7.1创建普通用户操作

创建用户命令:useradd learn

修改密码命令:passwd

解析:在执行passwd时,提示输入密码。可以查看用户信息:cat /etc/passwd。

7.2普通用户信息

用户名称/口令:learn/12345678

7.3把seata的安装目录赋权给普通用户

命令:chown -R learn:learn /opt/seata-1.6.0

7.4启动seata

切换用户:su learn

操作目录:/opt/seata-1.6.0/bin

启动命令:sh seata-server.sh

8.使用nacos-config.sh脚本加载配置

使用nacos-config.sh脚本加载config.txt配置到nacos。

脚本目录:/opt/seata-1.6.0/script/config-center/nacos

命令:sh nacos-config.sh -h 192.168.19.203 -p 18848 -g SEATA_GROUP -t 142eba5f-a7b5-4a83-85bb-663c582c8ef1 -u nacos -w nacos

解析:本例没有使用这种方式。

二、在Windows上安装seata

安装Seata,存储模式使用MySQL,服务发现和配置使用Nacos。

1.下载Seata

版本:v1.6.0

发布日期:Dec 17, 2022

下载地址:https://github.com/seata/seata/releases/download/v1.6.0/seata-server-1.6.0.zip

下载包:seata-server-1.6.0.zip

2.解压Seata

seata-server-1.6.0.zip包解压到D:\dev\hub\ali\seata-1.6.0。

在seata-1.6.0下的目录。bin目录是启动脚本。conf目录是配置文件。ext目录下是skywalking插件相关内容。lib目录是全量jar包。logs目录是日志包。script目录是脚本目录。target目录是seata-server.jar包。

3.初始化数据库脚本

本例存储模式使用MySQL数据库。

3.1创建数据库和用户

用户名/口令:hub_seata/12345678

数据库名称:hub_seatadb

登录控制台:mysql -u root -p

在MySQL命令行控制台执行脚本。

USE mysql;
CREATE DATABASE hub_seatadb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER hub_seata@'%' IDENTIFIED BY '12345678';
GRANT ALL ON hub_seatadb.* TO 'hub_seata'@'%' IDENTIFIED BY '12345678';
FLUSH PRIVILEGES;

3.2初始化seata数据库

脚本目录:seata\script\server\db\mysql.sql

初始化表:branch_table、distributed_lock、global_table、lock_table。

4.启动Nacos

启动脚本目录:D:\dev\hub\ali\nacos-2.1.1\nacos\bin

4.1启动Nacos

启动命令:sh startup.sh -m standalone

地址:http://192.168.19.203:18848/nacos

用户名/口令:nacos/nacos

4.2创建seata命名空间

命名空间名称:hub_seata

命名空间ID:142eba5f-a7b5-4a83-85bb-663c582c8ef1

5.配置seata

在..\seata\conf目录下,application.example.yml是配置文件的模板,包含全量配置。application.yml是应用启动时加载配置,根据实际情况按需从application.example.yml中拷贝添加就行

5.1修改application.yml配置

修改文件:application.yml

修改内容:

server:
  port: 7091
spring:
  application:
    name: seata-server
logging:
  config: classpath:logback-spring.xml
  file:
    path: ${user.home}/logs/seata
  extend:
    logstash-appender:
      destination: 127.0.0.1:4560
    kafka-appender:
      bootstrap-servers: 127.0.0.1:9092
      topic: logback_to_logstash
console:
  user:
    username: seata
    password: seata
seata:
  config:
    type: nacos
    nacos:
      server-addr: 127.0.0.1:18848
      namespace: 142eba5f-a7b5-4a83-85bb-663c582c8ef1
      group: SEATA_GROUP
      username: nacos
      password: nacos
      context-path:
      data-id: seataServer.properties
  registry:
    type: nacos
    nacos:
      application: seata-server
      server-addr: 127.0.0.1:18848
      group: SEATA_GROUP
      namespace: 142eba5f-a7b5-4a83-85bb-663c582c8ef1
      cluster: default
      username: nacos
      password: nacos
      context-path:
  store:
    mode: db
    db:
      datasource: druid
      db-type: mysql
      driver-class-name: com.mysql.jdbc.Driver
      url: jdbc:mysql://127.0.0.1:3306/hub_seatadb?rewriteBatchedStatements=true
      user: hub_seata
      password: 12345678
      min-conn: 5
      max-conn: 100
      global-table: global_table
      branch-table: branch_table
      lock-table: lock_table
      distributed-lock-table: distributed_lock
      query-limit: 100
      max-wait: 5000    
  security:
    secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
    tokenValidityInMilliseconds: 1800000
    ignore:
      urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/api/v1/auth/login

5.2在Nacos新建seataServer.properties

5.2.1页面配置

在Nacos页面中,选择

命名空间:hub_seata。命名空间ID:142eba5f-a7b5-4a83-85bb-663c582c8ef1。创建配置seataServer.properties。

Data ID:seataServer.properties。

Group:SEATA_GROUP

配置格式:Properties

配置内容:从seata\script\config-center\config.txt文件中拷贝需求的配置。

本例从config.txt摘取的配置修改过的配置。

service.vgroupMapping.hub_tx_group=default
store.mode=db
store.lock.mode=db
store.session.mode=db
store.publicKey=123456
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.jdbc.Driver
store.db.url=jdbc:mysql://127.0.0.1:3306/hub_seatadb?useUnicode=true&rewriteBatchedStatements=true
store.db.user=hub_seata
store.db.password=12345678

解析:config.txt配置内容在源码包seata-1.6.0\config\seata-config-core\src\main\resources\config.txt和编译包seata\script\config-center\config.txt两处位置都可以找到。

5.2.2配置生效

在Nacos中配置已经生效。

6启动seata

6.1启动seata

操作目录:..\seata\bin

双击seata-server.bat启动。

6.2查看seata已注册

在Nacos已经注册了seata-server服务。

三、官方配置和SQL脚本

配置文件均是官网原件。

1.mysql.sql

文件目录:/opt/seata-1.6.0/script/server/db

文件内容:

CREATE TABLE IF NOT EXISTS `global_table`
(
    `xid`                       VARCHAR(128) NOT NULL,
    `transaction_id`            BIGINT,
    `status`                    TINYINT      NOT NULL,
    `application_id`            VARCHAR(32),
    `transaction_service_group` VARCHAR(32),
    `transaction_name`          VARCHAR(128),
    `timeout`                   INT,
    `begin_time`                BIGINT,
    `application_data`          VARCHAR(2000),
    `gmt_create`                DATETIME,
    `gmt_modified`              DATETIME,
    PRIMARY KEY (`xid`),
    KEY `idx_status_gmt_modified` (`status` , `gmt_modified`),
    KEY `idx_transaction_id` (`transaction_id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4;

-- the table to store BranchSession data
CREATE TABLE IF NOT EXISTS `branch_table`
(
    `branch_id`         BIGINT       NOT NULL,
    `xid`               VARCHAR(128) NOT NULL,
    `transaction_id`    BIGINT,
    `resource_group_id` VARCHAR(32),
    `resource_id`       VARCHAR(256),
    `branch_type`       VARCHAR(8),
    `status`            TINYINT,
    `client_id`         VARCHAR(64),
    `application_data`  VARCHAR(2000),
    `gmt_create`        DATETIME(6),
    `gmt_modified`      DATETIME(6),
    PRIMARY KEY (`branch_id`),
    KEY `idx_xid` (`xid`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4;

-- the table to store lock data
CREATE TABLE IF NOT EXISTS `lock_table`
(
    `row_key`        VARCHAR(128) NOT NULL,
    `xid`            VARCHAR(128),
    `transaction_id` BIGINT,
    `branch_id`      BIGINT       NOT NULL,
    `resource_id`    VARCHAR(256),
    `table_name`     VARCHAR(32),
    `pk`             VARCHAR(36),
    `status`         TINYINT      NOT NULL DEFAULT '0' COMMENT '0:locked ,1:rollbacking',
    `gmt_create`     DATETIME,
    `gmt_modified`   DATETIME,
    PRIMARY KEY (`row_key`),
    KEY `idx_status` (`status`),
    KEY `idx_branch_id` (`branch_id`),
    KEY `idx_xid` (`xid`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `distributed_lock`
(
    `lock_key`       CHAR(20) NOT NULL,
    `lock_value`     VARCHAR(20) NOT NULL,
    `expire`         BIGINT,
    primary key (`lock_key`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4;

INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('AsyncCommitting', ' ', 0);
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('RetryCommitting', ' ', 0);
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('RetryRollbacking', ' ', 0);
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('TxTimeoutCheck', ' ', 0);

2.config.txt

文件目录:/opt/seata-1.6.0/script/config-center

文件内容:

#For details about configuration items, see https://seata.io/zh-cn/docs/user/configurations.html
#Transport configuration, for client and server
transport.type=TCP
transport.server=NIO
transport.heartbeat=true
transport.enableTmClientBatchSendRequest=false
transport.enableRmClientBatchSendRequest=true
transport.enableTcServerBatchSendResponse=false
transport.rpcRmRequestTimeout=30000
transport.rpcTmRequestTimeout=30000
transport.rpcTcRequestTimeout=30000
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
transport.serialization=seata
transport.compressor=none

#Transaction routing rules configuration, only for the client
service.vgroupMapping.default_tx_group=default
#If you use a registry, you can ignore it
service.default.grouplist=127.0.0.1:8091
service.enableDegrade=false
service.disableGlobalTransaction=false

#Transaction rule configuration, only for the client
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=true
client.rm.tableMetaCheckerInterval=60000
client.rm.sqlParserType=druid
client.rm.reportSuccessEnable=false
client.rm.sagaBranchRegisterEnable=false
client.rm.sagaJsonParser=fastjson
client.rm.tccActionInterceptorOrder=-2147482648
client.tm.commitRetryCount=5
client.tm.rollbackRetryCount=5
client.tm.defaultGlobalTransactionTimeout=60000
client.tm.degradeCheck=false
client.tm.degradeCheckAllowTimes=10
client.tm.degradeCheckPeriod=2000
client.tm.interceptorOrder=-2147482648
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
#For TCC transaction mode
tcc.fence.logTableName=tcc_fence_log
tcc.fence.cleanPeriod=1h

#Log rule configuration, for client and server
log.exceptionRate=100

#Transaction storage configuration, only for the server. The file, db, and redis configuration values are optional.
store.mode=file
store.lock.mode=file
store.session.mode=file
#Used for password encryption
store.publicKey=

#If `store.mode,store.lock.mode,store.session.mode` are not equal to `file`, you can remove the configuration block.
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

#These configurations are required if the `store mode` is `db`. If `store.mode,store.lock.mode,store.session.mode` are not equal to `db`, you can remove the configuration block.
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.jdbc.Driver
store.db.url=jdbc:mysql://127.0.0.1:3306/seata?useUnicode=true&rewriteBatchedStatements=true
store.db.user=username
store.db.password=password
store.db.minConn=5
store.db.maxConn=30
store.db.globalTable=global_table
store.db.branchTable=branch_table
store.db.distributedLockTable=distributed_lock
store.db.queryLimit=100
store.db.lockTable=lock_table
store.db.maxWait=5000

#These configurations are required if the `store mode` is `redis`. If `store.mode,store.lock.mode,store.session.mode` are not equal to `redis`, you can remove the configuration block.
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

#Transaction rule configuration, only for the server
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
server.distributedLockExpireTime=10000
server.xaerNotaRetryTimeout=60000
server.session.branchAsyncQueueSize=5000
server.session.enableBranchAsyncRemove=false
server.enableParallelRequestHandle=false

#Metrics configuration, only for the server
metrics.enabled=false
metrics.registryType=compact
metrics.exporterList=prometheus
metrics.exporterPrometheusPort=9898

以上,感谢。

2023年2月19日

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/357068.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【java基础】Java常用类———包装类

包装类 wrapper 装箱与拆箱 装箱&#xff1a;基本类型->包装类&#xff1b; 拆箱&#xff1a; 包装类->基本类型 public class Integer01 {public static void main(String[] args) {//演示int <--> Integer 的装箱和拆箱//jdk5前是手动装箱和拆箱//手动装箱 in…

学海记录项目测试报告

⭐️前言⭐️ 本篇文章是博主基于学海记录的个人项目所做的测试报告&#xff0c;用于总结运用自动化测试技术&#xff0c;应用于自己的项目。 &#x1f349;欢迎点赞 &#x1f44d; 收藏 ⭐留言评论 &#x1f4dd;私信必回哟&#x1f601; &#x1f349;博主将持续更新学习记录…

【查找算法】解析学习四大常用的计算机查找算法 | C++

第二十二章 四大查找算法 目录 第二十二章 四大查找算法 ●前言 ●查找算法 ●一、顺序查找法 1.什么是顺序查找法&#xff1f; 2.案例实现 ●二、二分查找法 1.什么是二分查找法&#xff1f; 2.案例实现 ●三、插值查找法 1.什么是插值查找法&#xff1f; 2…

数据结构:基数排序

基数排序(radix sorting) 实现排序主要是通过关键字之间的比较和移动记录这两种操作来完成的,而实现基数排序不需要进行关键字间的比较,而是利用“分配”和“收集”两种基本操作。 例如,我们可以用分配和收集的方法来对扑克牌进行“排序” 已知扑克牌中 52 张牌面的次序关系为…

Time-distributed 的理解

前言 今天看到论文中用到 Time-distributed CNN&#xff0c;第一次见到 Time-distributed&#xff0c;不理解是什么含义&#xff0c;看到代码实现也很懵。不管什么网络结构&#xff0c;外面都能套一个TimeDistributed。看了几个博客&#xff0c;还是不明白&#xff0c;问了问C…

Python数据挖掘基础

一、Matplotlib 画二维图表的python库&#xff0c;实现数据可视化 &#xff0c; 帮助理解数据&#xff0c;方便选择更合适的分析方法1、折线图1.1引入matplotlibimport matplotlib.pyplot as plt %matplotlib inlineplt.figure() plt.plot([1, 0, 9], [4, 5, 6]) plt.show()1.2…

知识探索项目测试报告

⭐️前言⭐️ 本篇文章是博主基于知识探索项目所做的测试报告&#xff0c;主要涉及到的测试知识有设计测试用例、自动化测试等测试知识。 &#x1f349;欢迎点赞 &#x1f44d; 收藏 ⭐留言评论 &#x1f4dd;私信必回哟&#x1f601; &#x1f349;博主将持续更新学习记录收获…

基于springboot+vue的药物咨询平台

基于springbootvue的药物咨询平台 ✌全网粉丝20W,csdn特邀作者、博客专家、CSDN新星计划导师、java领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ &#x1f345;文末获取项目下载方式&#x1f345; 一、项目背景介绍&…

二阶段提交事务的实现和缺点

背景 说起分布式事务&#xff0c;我们最绕不开的一个话题就是该不该使用分布式事务&#xff0c;而要理解为什么做出使用与否的决定&#xff0c;就必须要提到分布式事务中的最经典的实现&#xff1a;两阶段提交事务,本文我们就简答介绍下这个两阶段提交事务以及它的优缺点 技术…

【Opencv 系列】 第6章 人脸检测(Haar/dlib) 关键点检测

本章内容 1.人脸检测&#xff0c;分别用Haar 和 dlib 目标&#xff1a;确定图片中人脸的位置&#xff0c;并画出矩形框 Haar Cascade 哈尔级联 核心原理 &#xff08;1&#xff09;使用Haar-like特征做检测 &#xff08;2&#xff09;Integral Image : 积分图加速特征计算 …

SpringSecurity的权限校验详解说明(附完整代码)

说明 SpringSecurity的权限校是基于SpringSecurity的安全认证的详解说明(附完整代码) &#xff08;https://blog.csdn.net/qq_51076413/article/details/129102660&#xff09;的讲解&#xff0c;如果不了解SpringSecurity是怎么认证&#xff0c;请先看下【SpringSecurity的安…

【1792. 最大平均通过率】

来源&#xff1a;力扣&#xff08;LeetCode&#xff09; 描述&#xff1a; 一所学校里有一些班级&#xff0c;每个班级里有一些学生&#xff0c;现在每个班都会进行一场期末考试。给你一个二维数组 classes &#xff0c;其中 classes[i] [passi, totali] &#xff0c;表示你…

0xL4ugh 2023

这回跟着个队伍跑&#xff0c;不过还是2X以后的成绩&#xff0c;前边太卷了。自己会的部分&#xff0c;有些是别人已经提交了的。记录一下。Cryptocrypto 1给了一些数据&#xff0c;像这样就没有别的了ct [0, 1, 1, 2, 5, 10, 20, 40, 79, 159, 317, 635, 1269, 2538, 5077, 1…

2023.02.19 学习周报

文章目录摘要文献阅读1.题目2.摘要3.介绍4.本文贡献5.方法5.1 Local Representation Learning5.2 Global Representation Learning5.3 Item Similarity Gating6.实验6.1 数据集6.2 结果7.结论深度学习1.对偶问题1.1 拉格朗日乘数法1.2 强对偶性2.SVM优化3.软间隔3.1 解决问题3.…

尚医通 (十八)微信登录

目录一、生成微信登录二维码1、准备工作2、后端开发service_user3、前端显示登录二维码4、二维码出现不了进行调试二、开发微信扫描回调1、准备工作2、后台开发3、前台开发三、分析代码四、bug一、生成微信登录二维码 1、准备工作 1、注册 2、邮箱激活 3、完善开发者资料 4、…

JSP中http与内置对象学习笔记

本博文讲述jsp客户端与服务器端的http、jsp内置对象与控制流和数据流实现 1.HTTP请求响应机制 HTTP协议是TCP/IP协议中的一个应用层协议&#xff0c;用于定义客户端与服务器之间交换数据的过程 1.1 HTTP请求 HTTP请求由请求行、消息报头、空行和请求数据4部分组成。 请求行…

ThreeJS 之界面控制

文章目录参考描述界面自适应问题resize 事件修改画布大小修改视锥体的宽高比全屏显示dblclick 事件检测全屏显示状态进入全屏显示状态退出全屏显示状态尾声参考 项目描述ThreeJS官方文档哔哩哔哩老陈打码搜索引擎BingMDN 文档document.mozFullScreenElementMDN 文档Element.re…

LeetCode题目笔记——6359. 替换一个数字后的最大差值

文章目录题目描述题目链接题目难度——简单方法一&#xff1a;替换代码/Python代码优化总结题目描述 给你一个整数 num 。你知道 Danny Mittal 会偷偷将 0 到 9 中的一个数字 替换 成另一个数字。 请你返回将 num 中 恰好一个 数字进行替换后&#xff0c;得到的最大值和最小值…

CTK学习:(一)编译CTK

CTK插件框架简介 CTK Plugin Framework是用于C++的动态组件系统,以OSGi规范为模型。在此框架下,应用程序由不同的组件组成,遵循面向服务的方法。 ctk是一个开源项目,Github 地址:https://github.com/commontk。 源码地址commontk/CTK: A set of common support code for…

信小程序点击按钮绘制定制转发分享图

1. 说明 先上代码片断分享链接&#xff1a; https://developers.weixin.qq.com/s/vl3ws9mA72GG 使用 painter 画图 按钮传递定制化信息 效果如下&#xff1a; 2. 关键代码说明 文件列表如下&#xff1a; {"usingComponents": {"painter": "/com…