Etcd3 Registry Center
Etcd3 is an important implementation of the registry center in the Seata component.
Prerequisites
Before integrating Etcd3
into your Seata project, make sure that the Etcd3 Server service has been started in the background. If you are not familiar with the basic usage of Etcd3, you can refer to the Etcd3 Quickstart for a preliminary understanding. It is recommended to use Etcd3 version 3.5.0
or above.
Quick Start
The steps to integrate Etcd3 registry center into Seata are very simple, and can be roughly divided into "Adding Maven Dependencies" and "Configuring the Registry Center".
Adding Maven Dependencies
First, you need to add the Maven dependency of jetcd-core
to your project's pom.xml
file. It is recommended to use jetcd-core version 0.3.0+
. The version relationship between spring-cloud-starter-alibaba-seata
and the corresponding microservice version can be found in the Version Description.
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
<version>latest version</version>
</dependency>
<!-- Etcd3 Client Dependency -->
<dependency>
<groupId>io.etcd</groupId>
<artifactId>jetcd-core</artifactId>
<version>0.3.0 or above</version>
</dependency>
Configuring the Registry Center on the Client Side
Add the corresponding configuration to application.yml, and refer to the Configuration Reference for other configurations.
seata:
tx-service-group: default_tx_group
service:
vgroup-mapping:
my_test_tx_group: seata-server # Configure the value corresponding to registry.eureka.application in the server-side configuration here
registry:
type: etcd3
etcd3:
server-addr: http://localhost:2379
Configuring the Registry Center on the Server Side
Add the corresponding configuration to registry.conf, and refer to the Configuration Reference for other configurations.
registry {
type = "etcd3"
etcd3 {
serverAddr = "http://localhost:2379"
}
}
After the configuration is completed, start the application to experience the Seata service.