# Script usage demo

## important attributes
you only need to follow the instructions below and keep the corresponding configuration in 'config.txt' to run. For more configuration information, please visit [seata.apache.org](https://seata.apache.org/)
| server | client |
| ------------------------ | ------------------------------------------------------------ |
| store.mode: file,db | config.type: file、nacos 、apollo、zk、consul、etcd3、custom |
| #only db: | #only file: |
| store.db.driverClassName | service.default.grouplist |
| store.db.url | #All: |
| store.db.user | service.vgroupMapping.default_tx_group |
| store.db.password | service.disableGlobalTransaction |
## Script Introduction
The Script has interactive and non-interactive configuration modes,different patterns are distinguished by different file names.
interactive mode(*-config-interactive.sh or *-config-interactive.py): the script starts the config program in interactive mode on the command line, prompting you for each option.
non-interactive mode(*-config.sh or *-config.py): the script use additional config options to specify values for the options you choose during interactive mode, thus scripting the config process.
## Nacos
shell:
- Interactive Mode
```bash
sh ${SEATAPATH}/script/config-center/nacos/nacos-config-interactive.sh
```
This command will generate interactive configuration mode, eg:
```
Please enter the host of nacos.
请输入nacos的host [localhost]:
>>>
Please enter the port of nacos.
请输入nacos的port [8848]:
>>>
Please enter the group of nacos.
请输入nacos的group [SEATA_GROUP]:
>>>
Please enter the tenant of nacos.
请输入nacos的tenant:
>>>
Please enter the username of nacos.
请输入nacos的username:
>>>
Please enter the password of nacos.
请输入nacos的password:
>>>
Are you sure to continue? [y/n]
```
- Non-Interactive Mode
```bash
sh ${SEATAPATH}/script/config-center/nacos/nacos-config.sh -h localhost -p 8848 -g SEATA_GROUP -t 5a3c7d6c-f497-4d68-a71a-2e5e3340b3ca -u username -w password
```
python:
- Interactive Mode
```bash
python ${SEATAPATH}/script/config-center/nacos/nacos-config-interactive.py
```
This command will generate interactive configuration mode like nacos-config-interactive.sh.
- Non-Interactive Mode
```bash
python ${SEATAPATH}/script/config-center/nacos/nacos-config.py localhost:8848
```
Parameter Description:
-h: host, the default value is localhost.
-p: port, the default value is 8848.
-g: Configure grouping, the default value is 'SEATA_GROUP'.
-t: Tenant information, corresponding to the namespace ID field of Nacos, the default value is ''.
-u: username, nacos 1.2.0+ on permission control, the default value is ''.
-w: password, nacos 1.2.0+ on permission control, the default value is ''.
## Apollo
- Interactive Mode
```bash
sh ${SEATAPATH}/script/config-center/apollo/apollo-config-interactive.sh
```
This command will generate interactive configuration mode, eg:
```
Please enter the host of apollo.
请输入apollo的host [localhost]:
>>>
Please enter the port of apollo.
请输入apollo的port [8070]:
>>>
Please enter the env of apollo.
请输入apollo的env [DEV]:
>>>
Please enter the appId of apollo.
请输入apollo的appId [seata-server]:
>>>
Please enter the clusterName of apollo.
请输入apollo的clusterName [default]:
>>>
Please enter the namespaceName of apollo.
请输入apollo的namespaceName [application]:
>>>
Please enter the dataChangeCreatedBy of apollo.
请输入apollo的dataChangeCreatedBy:
>>>
Please enter the releasedBy of apollo.
请输入apollo的releasedBy:
>>>
Please enter the token of apollo.
请输入apollo的token:
>>>
Are you sure to continue? [y/n]
```
- Non-Interactive Mode
```bash
sh ${SEATAPATH}/script/config-center/apollo/apollo-config.sh -h localhost -p 8070 -e DEV -a seata-server -c default -n application -d apollo -r apollo -t 3aa026fc8435d0fc4505b345b8fa4578fb646a2c
```
Parameter Description:
-h: host, the default value is localhost.
-p: port, the default value is 8070.
-e: Managed configuration environment, the default value is DEV.
-a: AppId to which the namespace belongs, the default value is seata-server.
-c: Managed configuration cluster name, Generally, you can pass in default. If it is a special cluster, just pass in the name of the corresponding cluster,the default value is default.
-n: Name of the managed namespace, If the format is not properties, you need to add a suffix name, such as sample.yml, the default value is application.
-d: The creator of the item, in the format of a domain account, which is the User ID of the sso system.
-r: Publisher, domain account, note: if namespace.lock.switch in ApolloConfigDB.ServerConfig is set to true (default is false), Then the environment does not allow the publisher and editor to be the same person. So if the editor is zhangsan, the publisher can no longer be zhangsan.
-t: Apollo admin creates third-party applications in http://{portal_address}/open/manage.html, It is best to check whether this AppId has been created before creation. After successful creation, a token will be generated.
For details of the above parameter descriptions, please see:
https://github.com/ctripcorp/apollo/wiki/Apollo%E5%BC%80%E6%94%BE%E5%B9%B3%E5%8F%B0
## Consul
- Interactive Mode
```bash
sh ${SEATAPATH}/script/config-center/consul/consul-config-interactive.sh
```
This command will generate interactive configuration mode, eg:
```
Please enter the host of consul.
请输入consul的host [localhost]:
>>>
Please enter the port of consul.
请输入consul的port [8500]:
>>>
Are you sure to continue? [y/n]
```
- Non-Interactive Mode
```bash
sh ${SEATAPATH}/script/config-center/consul/consul-config.sh -h localhost -p 8500
```
Parameter Description:
-h: host, the default value is localhost.
-p: port, the default value is 8500.
## Etcd3
- Interactive Mode
```bash
sh ${SEATAPATH}/script/config-center/etcd3/etcd3-config-interactive.sh
```
This command will generate interactive configuration mode, eg:
```
Please enter the host of etcd3.
请输入etcd3的host [localhost]:"
>>>
Please enter the port of etcd3.
请输入etcd3的port [2379]:
>>>
Are you sure to continue? [y/n]
```
- Non-Interactive Mode
```bash
sh ${SEATAPATH}/script/config-center/etcd3/etcd3-config.sh -h localhost -p 2379
```
Parameter Description:
-h: host, the default value is localhost.
-p: port, the default value is 2379.
## ZK
- Interactive Mode
```bash
sh ${SEATAPATH}/script/config-center/zk/zk-config-interactive.sh
```
This command will generate interactive configuration mode, eg:
```
Please enter the host of zookeeper.
请输入zookeeper的host [localhost]:
>>>
Please enter the port of zookeeper.
请输入zookeeper的port [2181]:
>>>
Please enter the zkHome of zookeeper.
请输入zookeeper的zkHome:
>>>
Are you sure to continue? [y/n]
```
- Non-Interactive Mode
```bash
sh ${SEATAPATH}/script/config-center/zk/zk-config.sh -h localhost -p 2181 -z "/Users/zhangchenghui/zookeeper-3.4.14"
```
Parameter Description:
-h: host, the default value is localhost.
-p: port, the default value is 2181.
-z: zk path.
apache-seata-2.2.0-incubating-bin.tar.gz
需积分: 0 46 浏览量
更新于2024-10-11
收藏 180.43MB GZ 举报
Seata是一款开源的分布式事务解决方案,它是在微服务架构下,针对分布式事务问题提供的一种高性能和易用性的服务。在微服务架构下,业务往往被拆分为多个小的服务,每个服务可能有自己的数据源,这样就产生了分布式事务的问题。Seata提供了分布式事务的管理,使得在分布式系统中的每个服务都能够安全、可靠、高效地完成事务操作。
Seata的工作原理是将事务的边界定义在微服务的外部,因此能够覆盖多个微服务内部的多个数据库操作。它通过两阶段提交协议(2PC)来保证数据的一致性。在第一阶段,事务参与者向协调者报告事务状态,并锁定资源;在第二阶段,协调者根据事务参与者报告的状态决定是提交事务还是回滚事务。如果所有参与者都报告了事务成功,那么协调者就命令参与者提交事务,否则,它将命令参与者回滚事务。
Seata主要包含三个组件:事务协调器TC(Transaction Coordinator)、事务管理器TM(Transaction Manager)和服务代理SA(Service Agent)。其中,事务协调器TC是Seata的核心组件,负责协调全局事务;事务管理器TM负责向TC注册全局事务,并协调执行全局事务;服务代理SA负责拦截业务逻辑,生成全局事务,并在需要时向TC报告事务状态。
Seata还引入了"分支事务"和"全局事务"的概念。在Seata中,一个全局事务可以包含多个分支事务,每个分支事务对应一个资源,它们通过全局事务ID关联起来。全局事务由TC协调,分支事务由TM和SA管理。全局事务执行成功,分支事务也需要执行成功,否则全局事务会进行回滚。
Seata的应用场景非常广泛,它可以应用于各种基于微服务的分布式系统中,如电子商务平台、金融服务平台、在线教育平台等。使用Seata,开发者可以更加专注于业务逻辑的开发,而不需要过多关注复杂的事务处理问题。
Seata作为一个开源项目,其开源协议通常规定在源代码和二进制文件中必须包含许可证文件,以便用户了解其使用许可范围和条件。因此,在压缩包中通常会包含LICENSE文件,它详细说明了Seata的使用权限和限制。同时,DISCLAIMER文件声明了软件的免责声明,以及NOTICE文件可能提供了软件的版权声明和其他重要通知。
压缩包中还会包含seata-namingserver和seata-server两个文件夹,分别存放了Seata的命名服务和服务器端的相关文件。命名服务负责注册和发现服务,而服务器端则是Seata的核心,负责全局事务的协调和管理。
Seata作为一款专注于微服务架构下的分布式事务解决方案,其设计目标是让分布式事务管理变得简单高效。开发者通过Seata可以轻松解决分布式系统中的事务一致性问题,同时保证系统的高可用性和高性能。随着微服务架构的普及,Seata的价值日益凸显,成为分布式系统不可或缺的一部分。

qxmjava
- 粉丝: 25
最新资源
- 基于MindSpore框架Yolov3-darknet模型的篮球动作检测体验(1).docx
- 小学计算机教学中趣味性教学策略研究(1)(1).docx
- 2024年税务信息化投资分析报告(1).pdf
- 自动化专业毕业实习报告(1)(1).doc
- 利用大数据提升区域初中数学教学质量的思考(1).docx
- 信息化技术在《机床电气》课程中的应用研究(1).docx
- 消费大数据相关行业投资规划报告范文(1).docx
- 深圳市软件产品销售合同(1).docx
- 计算机网络课程设计网吧组建与实现(1).doc
- 大数据中心建设的策划方案(1).docx
- 中国人工智能商业生态图谱(1).docx
- 程序设计语言的层次体系制度范本格式(1).doc
- 电子商务系统规划培训课件(1).pptx
- 当前通信建设工程监理中存在的问题及对策研究(1)(1).docx
- 基于jsp的图书管理系统设计与实现毕业(设计)论文(1).doc
- 企业流程管理信息化存在的问题及对策分析(1).docx