linux系统安装seata-server步骤记录服务端安装seata-server
下载seata-server
cd /home/install
wget github/seata/seata/releases/download/v1.2.0/seata-server-1.2.
tar -zxvf seata-server-1.2.
修改seata-server的配置⽂件
cd home/install/seata/conf
修改f
f
## transaction log store, only used in seata-server
store {
## store mode: file、db
mode = "db"
## file store property
file {
## store location dir
dir = "sessionStore"
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
maxBranchSessionSize = 16384
# globe session size , if exceeded throws exceptions
maxGlobalSessionSize = 512
# file buffer size , if exceeded allocate new buffer
fileWriteBufferCacheSize = 16384
# when recover batch read size
sessionReloadReadSize = 100
# async, sync
flushDiskMode = async
}
## database store property
db {
## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc.
datasource = "druid"
## mysql/oracle/postgresql/h2/oceanbase etc.
dbType = "mysql"
driverClassName = "sql.jdbc.Driver"
url = "jdbc:mysql://192.168.4.28:3306/seata"
user = "root"
password = "123456"
minConn = 5
maxConn = 30
globalTable = "global_table"
branchTable = "branch_table"
lockTable = "lock_table"
queryLimit = 100
maxWait = 5000
}
}
修改f
f
registry {
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa  type = "nacos"
nacos {
application = "seata-server"
serverAddr = "192.168.4.200"
namespace = "2aa0ad47-8db1-44ed-8d58-176742e867ec"    cluster = "default"
username = "nacos"
password = "nacos"
}
eureka {
serviceUrl = "localhost:8761/eureka"
application = "default"
weight = "1"
}
redis {
serverAddr = "localhost:6379"
db = 0
password = ""
cluster = "default"
timeout = 0
}
zk {
cluster = "default"
serverAddr = "127.0.0.1:2181"
sessionTimeout = 6000
connectTimeout = 2000
username = ""
password = ""
}
consul {
cluster = "default"
serverAddr = "127.0.0.1:8500"
}
etcd3 {
cluster = "default"
serverAddr = "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 = "f"
}
}
config {
# file、nacos 、apollo、zk、consul、etcd3
type = "nacos"
nacos {
serverAddr = "192.168.4.200"
serverAddr = "192.168.4.200"
namespace = "2aa0ad47-8db1-44ed-8d58-176742e867ec"
group = "SEATA_GROUP"
username = "nacos"
password = "nacos"
}
consul {
serverAddr = "127.0.0.1:8500"
}
linux安装redis服务apollo {
appId = "seata-server"
apolloMeta = "192.168.1.204:8801"
namespace = "application"
}
zk {
serverAddr = "127.0.0.1:2181"
sessionTimeout = 6000
connectTimeout = 2000
username = ""
password = ""
}
etcd3 {
serverAddr = "localhost:2379"
}
file {
name = "f"
}
}
初始化表和配置信息
注意:初始化表和配置信息只需要在⼀台服务器上执⾏⼀次即可。
初始化表
在192.168.4.28服务器的数据库上创建名为seata的新数据库,并创建global_table,branch_table和lock_table三张表,ddl语句如下
-- -------------------------------- The script used when storeMode is 'db' ---------------------------------- the table to store GlobalSession data
CREATE TABLE IF NOT EXISTS`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`)
)ENGINE=InnoDB
DEFAULT CHARSET= utf8;
-- the table to store BranchSession data
CREATE TABLE IF NOT EXISTS`branch_table`
(
`branch_id`BIGINT NOT NULL,
`xid`VARCHAR(128)NOT NULL,
`transaction_id`BIGINT,
`resource_group_id`VARCHAR(32),
`resource_id`VARCHAR(256),
`branch_type`VARCHAR(8),
`status`TINYINT,
`client_id`VARCHAR(64),
`application_data`VARCHAR(2000),
`gmt_create`DATETIME(6),
`gmt_modified`DATETIME(6),
PRIMARY KEY(`branch_id`),
KEY`idx_xid`(`xid`)
)ENGINE=InnoDB
DEFAULT CHARSET= utf8;
-
- the table to store lock data
CREATE TABLE IF NOT EXISTS`lock_table`
(
`row_key`VARCHAR(128)NOT NULL,
`xid`VARCHAR(96),
`transaction_id`BIGINT,
`branch_id`BIGINT NOT NULL,
`resource_id`VARCHAR(256),
`table_name`VARCHAR(32),
`pk`VARCHAR(36),
`gmt_create`DATETIME,
`gmt_modified`DATETIME,
PRIMARY KEY(`row_key`),
KEY`idx_branch_id`(`branch_id`)
)ENGINE=InnoDB
DEFAULT CHARSET= utf8;
初始化配置信息
创建⽂件
touch /home/install/
<的内容为:
transport.server=NIO
transport.heartbeat=true
transport.threadFactory.bossThreadPrefix=NettyBoss
transport.threadFactory.workerThreadPrefix=NettyServerNIOWorker transport.threadFactory.serverExecutorThreadPrefix=NettyServerBizHandler transport.threadFactory.shareBossWorker=false
transport.threadFactory.clientSelectorThreadPrefix=NettyClientSelector transport.threadFactory.clientSelectorThreadSize=1
transport.threadFactory.clientWorkerThreadPrefix=NettyClientWorkerThread transport.threadFactory.bossThreadSize=1
transport.threadFactory.workerThreadSize=default
transport.shutdown.wait=3
# 修改成对应的服务组,如der_tx_group=default # 且应⽤端的事务组名称必须为order_tx_group,否则分布式事务⽆法⽣效_test_tx_group=default
service.disableGlobalTransaction=false
store.file.dir=file_store/data
store.file.maxBranchSessionSize=16384
store.file.maxGlobalSessionSize=512
store.file.fileWriteBufferCacheSize=16384
store.file.flushDiskMode=async
store.file.sessionReloadReadSize=100
store.db.datasource=druid
store.db.dbType=mysql
store.db.sql.jdbc.Driver
store.db.url=jdbc:mysql://192.168.4.28:3306/seata?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
server.maxCommitRetryTimeout=-1
server.maxRollbackRetryTimeout=-1
client.undo.dataValidation=true
client.undo.logSerialization=jackson
server.undo.logSaveDays=7
server.undo.logDeletePeriod=86400000
client.undo.logTable=undo_log
ptionRate=100
transport.serialization=seata
transportpressor=none

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。