Seata serve installation package
Download the Seata Server package, all I have is version 0.9.0
https://github.com/seata/seata/releases
wget https://github.com/seata/seata/releases/download/v0.9.0/seata-server-0.9.0.tar.gz
Link: https://pan.baidu.com/s/1jlBwCEYM3hn7zQiSpwRijg password: 56vm
After 0.9.0 of the official website, there is no SQL file in the conf file
Execute SQL script
Database name: seata
-- the table to store GlobalSession data drop table if exists `global_table`; create table `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_gmt_modified_status` (`gmt_modified`, `status`), key `idx_transaction_id` (`transaction_id`) ); -- the table to store BranchSession data drop table if exists `branch_table`; create table `branch_table` ( `branch_id` bigint not null, `xid` varchar(128) not null, `transaction_id` bigint , `resource_group_id` varchar(32), `resource_id` varchar(256) , `lock_key` varchar(128) , `branch_type` varchar(8) , `status` tinyint, `client_id` varchar(64), `application_data` varchar(2000), `gmt_create` datetime, `gmt_modified` datetime, primary key (`branch_id`), key `idx_xid` (`xid`) ); -- the table to store lock data drop table if exists `lock_table`; create table `lock_table` ( `row_key` varchar(128) not null, `xid` varchar(96), `transaction_id` long , `branch_id` long, `resource_id` varchar(256) , `table_name` varchar(32) , `pk` varchar(36) , `gmt_create` datetime , `gmt_modified` datetime, primary key(`row_key`) );
Start installation
Unzip the installation package:
tar -zxvf seata-server-0.9.0.tar.gz
Enter the conf Directory:
cd seata/conf/
Modify vim file.conf file
service node:
service { #service modification point 2 others don't move #vgroup->rgroup #Modify global transaction group modify point 1 vgroup_mapping.my_test_tx_group = "default" #only support single node #seata ‐ server's connection address this is my server's address modification form 2 default.grouplist = "47.112.217.177:8091" #degrade current not support enableDegrade = false #disable disable = false #unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent max.commit.retry.timeout = "-1" max.rollback.retry.timeout = "-1" }
store node:
store { #Modify 5 points in the store and don't move them ## store mode: file,db #db save modification 1 mode = "db" ## file store file { dir = "sessionStore" # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions max-branch-session-size = 16384 # globe session size , if exceeded throws exceptions max-global-session-size = 512 # file buffer size , if exceeded allocate new buffer file-write-buffer-cache-size = 16384 # when recover batch read size session.reload.read_size = 100 # async, sync flush-disk-mode = async } ## database store db { ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc. #Modify point 2 datasource = "druid" ## mysql/oracle/h2/oceanbase etc. db-type = "mysql" driver-class-name = "com.mysql.jdbc.Driver" #Modify the path address of the database created above point 3 url = "jdbc:mysql://127.0.0.1:3306/seata" #Amendment 4 user = "root" #Modify point 5 password = "123456" min-conn = 1 max-conn = 3 global.table = "global_table" branch.table = "branch_table" lock-table = "lock_table" query-limit = 100 } }
Modify vim register.conf file
registry node:
registry { #Register: modify 4 points and don't move others # file ,nacos ,eureka,redis,zk,consul,etcd3,sofa #Modify point 1 type = "nacos" nacos { #Modify point 2 Nacos address serverAddr = "47.112.217.177:8847" #Modify point 3 namespace = "public" #Modify point 4 cluster = "default" } eureka { serviceUrl = "http://localhost:8761/eureka" application = "default" weight = "1" } redis { serverAddr = "localhost:6379" db = "0" } zk { cluster = "default" serverAddr = "127.0.0.1:2181" session.timeout = 6000 connect.timeout = 2000 } consul { cluster = "default" serverAddr = "127.0.0.1:8500" } etcd3 { cluster = "default" serverAddr = "http://localhost:2379" } sofa { serverAddr = "127.0.0.1:9603" application = "default" region = "DEFAULT_ZONE" datacenter = "DefaultDataCenter" cluster = "default" group = "SEATA_GROUP" addressWaitTime = "3000" } file { name = "file.conf" } }
config node:
config { #config modify point 3 others don't move # file,nacos ,apollo,zk,consul,etcd3 #Modify point 1 type = "nacos" nacos { #Modify point 2 serverAddr = "47.112.217.177:8847" #Modify point 3 namespace = "public" } consul { serverAddr = "127.0.0.1:8500" } apollo { app.id = "seata-server" apollo.meta = "http://192.168.1.204:8801" } zk { serverAddr = "127.0.0.1:2181" session.timeout = 6000 connect.timeout = 2000 } etcd3 { serverAddr = "http://localhost:2379" } file { name = "file.conf" } }
Modify the vim nacos-config.txt file
transport.type=TCP transport.server=NIO transport.heartbeat=true transport.thread-factory.boss-thread-prefix=NettyBoss transport.thread-factory.worker-thread-prefix=NettyServerNIOWorker transport.thread-factory.server-executor-thread-prefix=NettyServerBizHandler transport.thread-factory.share-boss-worker=false transport.thread-factory.client-selector-thread-prefix=NettyClientSelector transport.thread-factory.client-selector-thread-size=1 transport.thread-factory.client-worker-thread-prefix=NettyClientWorkerThread transport.thread-factory.boss-thread-size=1 transport.thread-factory.worker-thread-size=8 transport.shutdown.wait=3 #Modify point 1 service.vgroup_mapping.prex_tx_group=default service.enableDegrade=false service.disable=false service.max.commit.retry.timeout=-1 service.max.rollback.retry.timeout=-1 client.async.commit.buffer.limit=10000 client.lock.retry.internal=10 client.lock.retry.times=30 client.lock.retry.policy.branch-rollback-on-conflict=true client.table.meta.check.enable=true client.report.retry.count=5 client.tm.commit.retry.count=1 client.tm.rollback.retry.count=1 #Modify point 2 store.mode=db store.file.dir=file_store/data store.file.max-branch-session-size=16384 store.file.max-global-session-size=512 store.file.file-write-buffer-cache-size=16384 store.file.flush-disk-mode=async store.file.session.reload.read_size=100 #Modify point 3 store.db.datasource=druid store.db.db-type=mysql store.db.driver-class-name=com.mysql.jdbc.Driver #Modify point 4 store.db.url=jdbc:mysql://127.0.0.1:3306/seata?useUnicode=true #Modify point 5 store.db.user=root #Modify point 6 store.db.password=123456 store.db.min-conn=1 store.db.max-conn=3 store.db.global.table=global_table store.db.branch.table=branch_table store.db.query-limit=100 store.db.lock-table=lock_table recovery.committing-retry-period=1000 recovery.asyn-committing-retry-period=1000 recovery.rollbacking-retry-period=1000 recovery.timeout-retry-period=1000 transaction.undo.data.validation=true transaction.undo.log.serialization=jackson transaction.undo.log.save.days=7 transaction.undo.log.delete.period=86400000 transaction.undo.log.table=undo_log transport.serialization=seata transport.compressor=none metrics.enabled=false metrics.registry-type=compact metrics.exporter-list=prometheus metrics.exporter-prometheus-port=9898 support.spring.datasource.autoproxy=false
Initialize nacos configuration of seata
conf directory execution:
sh nacos-config.sh 47.112.217.177
Note: if your Nacos port is not the default 8848 port, you need to change nacos-config.sh
My nacos is a cluster, so I changed the default port. nacos cluster construction: https://my.oschina.net/u/1046143/blog/3217779
result=`curl -X POST "http://$nacosIp:8847/nacos/v1/cs/configs?dataId=$key&group=SEATA_GROUP&content=$value"`
Log in to nacos background after execution:
Start the sea TA server service
[root@iZwz9e2l6djknfngtgxfbnZ conf]# cd ../bin/ [root@iZwz9e2l6djknfngtgxfbnZ bin]# ls seata-server.bat seata-server.sh
Execute:. / seata-server.sh