分布式事务-基本概念

2019/08/04

相关链接

http://www.tianshouzhi.com/api/tutorials/distributed_transaction/388

名词解释

2PC

两阶段提交协议 2PC(Two Phase Commitment Protocol) 实现分布式事务的关键就是两阶段提交协议。在此协议中,一个或多个资源管理器的活动均由一个称为事务协调器的单独软件组件来控制。此协议中的五个步骤如下: · 应用程序调用事务协调器中的提交方法。 · 事务协调器将联络事务中涉及的每个资源管理器,并通知它们准备提交事务(这是第一阶段的开始)。 · 为 了以肯定的方式响应准备阶段,资源管理器必须将自己置于以下状态:确保能在被要求提交事务时提交事务,或在被要求回滚事务时回滚事务。大多数资源管理器会 将包含其计划更改的日记文件(或等效文件)写入持久存储区中。如果资源管理器无法准备事务,它会以一个否定响应来回应事务协调器。 · 事务协调器收集来自资源管理器的所有响应。 · 在 第二阶段,事务协调器将事务的结果通知给每个资源管理器。如果任一资源管理器做出否定响应,则事务协调器会将一个回滚命令发送给事务中涉及的所有资源管理 器。如果资源管理器都做出肯定响应,则事务协调器会指示所有的资源管理器提交事务。一旦通知资源管理器提交,此后的事务就不能失败了。通过以肯定的方式响 应第一阶段,每个资源管理器均已确保,如果以后通知它提交事务,则事务不会失败。

BASE

CAP

TCC

CQRS

ACID

RBAC

SOUP

SOA

分布式事务解决方案-SAGA

Service-Comb

相关链接

官网: http://servicecomb.apache.org/

官方文档:https://docs.servicecomb.io/saga/en_US/

Apache Project: https://github.com/apache/servicecomb-saga.git

Demo 演示 10.120.120.88

docker运行DB: docker-compose up -d

构建并启动alpha-server:

项目构建:mvn clean package -DskipTests=true

启动alpha server
nohup java -jar alpha-server-0.3.1-SNAPSHOT-exec.jar >>alpha.log &


1、构建并本地启动service-omega:
nohup java -Dserver.port=8081 -Dalpha.cluster.address=localhost:8080 -jar hotel-0.3.1-SNAPSHOT-exec.jar  >>hotel.log &

nohup java -Dserver.port=8082 -Dalpha.cluster.address=localhost:8080 -jar car-0.3.1-SNAPSHOT-exec.jar  >>car.log &

nohup java -Dserver.port=8083 -Dalpha.cluster.address=localhost:8080 -Dcar.service.address=http://localhost:8082 -Dhotel.service.address=http://localhost:8081  -jar booking-0.3.1-SNAPSHOT-exec.jar  >>book.log &



2、构建并服务器启动service-omega:
nohup java -Dserver.port=8081 -Dalpha.cluster.address=10.120.115.88:8080 -jar hotel-0.3.1-SNAPSHOT-exec.jar  >>hotel.log &

nohup java -Dserver.port=8082 -Dalpha.cluster.address=10.120.115.88:8080 -jar car-0.3.1-SNAPSHOT-exec.jar  >>car.log &

nohup java -Dserver.port=8083 -Dalpha.cluster.address=10.120.115.88:8080 -Dcar.service.address=http://10.120.115.88:8082 -Dhotel.service.address=http://10.120.115.88:8081  -jar booking-0.3.1-SNAPSHOT-exec.jar  >>book.log &

Eventuate

官网:http://eventuate.io/

简介:http://eventuate.io/whyeventdriven.html

examples: http://eventuate.io/exampleapps.html

Eventuate Tram

  • a platform for traditional JPA/JDBC-based microservices. You can easily add Eventuate Tram to your Spring framework-based microservices without having to rewrite your business logic.

Eventuate Local

  • an event sourcing platform. Event sourcing is a different programming model that has some advantages including automatic publishing of events when data changes, reliable auditing of all updates, and built-in support for temporal queries Eventuate Local consists of a scalable, distributed event store and client libraries for various languages and frameworks including Java, Scala, and the Spring framework. Eventuate Local as an open-source project that you can run locally.

演说:https://plainoldobjects.com/presentations/building-and-deploying-microservices-with-event-sourcing-cqrs-and-docker/

项目:https://github.com/cer/event-sourcing-examples



扫描关注:Andy风雨无阻

(转载本站文章请注明作者和出处 风雨无阻

Show Disqus Comments

Post Directory