Seata integrates nacos (windows/linux environment)

insert image description here

1. Download and install nacos-server

https://gblfy.blog.csdn.net/article/details/123621122

Two, seata-server download configuration
2.1. Download seata-server-1.4.2.zip
https://github.91chi.fun//https://github.com//seata/seata/releases/download/v1.4.2/seata-server-1.4.2.zip
2.2. Modify the configuration
cd seata-nacos/seata-server-1.4.2/conf

Edit the file.conf file Change
insert image description here
the file mode to db mode
insert image description here
Modify the database connection
insert image description here

2.3. Creating a namespace

insert image description here

insert image description here

2.4. Configuring registry.conf
  • Revise
cd seata-nacos/seata-server-1.4.2/conf

Edit registry.conf file
type mode adjustment and nacos configuration information
insert image description here

insert image description here

2.5. Creating the database

Create a database named seata, character set utf8mb4, collation utf8mb4_general_ci
insert image description here

2.6. Initialize the sql script

Download the sql script: https://github.com/seata/seata/blob/develop/script/server/db/mysql.sql
initialize the sql script to the seata database
insert image description here

2.7. Configure config.txt

Create a config.txt file in the seata root directory
insert image description here

The content is as follows:

service.vgroupMapping.default_tx_group=default
store.mode=db
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.cj.jdbc.Driver
store.db.url=jdbc:mysql://127.0.0.1/:3306/nacos-mysql?useUnicode=true
store.db.user=root
store.db.password=123456
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

Content description: order-service is the service name, this is custom; store.mode=db mode is selected as db

2.8. Create nacos-config.sh

Create nacos-config.sh content in conf and copy and paste
insert image description here
from this link nacos-config.sh

2.9. Initialize script data to nacos

In the conf directory of seata, execute the following command

 sh nacos-config.sh -h localhost -p 8848 -g SEATA_GROUP -t 64f4ff79-60a1-4c83-b804-cb0cffab2d9f -u nacos -w nacos

insert image description here

2.10. Data Validation

insert image description here

2.11. seata-server start

insert image description here

2.12. Script download instructions

insert image description here

insert image description here

2.13. ed
spring:
  application:
    ###服务的名称
    name: mayikt-order
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/order?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT
    username: root
    password: 123456
    driver-class-name: com.mysql.jdbc.Driver
  cloud:
    nacos:
      discovery:
        ###nacos注册地址
        server-addr: 127.0.0.1:8848
    refresh:
      refreshable: none
    sentinel:
      transport:
        dashboard: 127.0.0.1:8718

server:
  port: 8090
  tomcat:
    max-threads: 20

seata:
  enabled: true
  enable-auto-data-source-proxy: true
  tx-service-group: default_tx_group
  registry:
    type: nacos
    nacos:
      application: seata-server
      server-addr: 127.0.0.1:8848
      username: nacos
      password: nacos
  config:
    type: nacos
    nacos:
      server-addr: 127.0.0.1:8848
      group: SEATA_GROUP
      username: nacos
      password: nacos
      namespace: 32fb05ad-8626-4598-9ba2-11554db7c159
  service:
    vgroup-mapping:
      default_tx_group: default
    disable-global-transaction: false
  client:
    rm:
      report-success-enable: false

Linux environment

In the same way, the steps are the same (only the decompression method and the startup suffix name are different)

Guess you like

Origin blog.csdn.net/weixin_40816738/article/details/123626970