Seata服务高可用+负载均衡搭建

Seata服务高可用+负载均衡搭建,第1张

参考官方文档:

http://seata.io/zh-cn/docs/ops/deploy-guide-beginner.html

目前三台服务器,分别在 192.168.128.36、192.168.128.37、192.168.128.32 上,通过三台服务器达到高可用,使用spring cloud ribbon达到负载均衡。

1.高可用部署参照:

http://seata.io/zh-cn/docs/ops/deploy-ha.html

seata github项目地址

https://github.com/seata/seata

2.安装目录

3.registry.conf配置如下:(file.conf不用管,因为用的nacos)

4.在mysql( 官方db地址 )分别创建 global_table, branch_table, lock_table 表。

5.在nacos添加 namespace=seata

6.导入seata配置文件,

6.1修改 nacos-config.sh 脚本,以适用自己的nacos配置, 官方配置

6.2修改 config.txt 文件,以适用自己的nacos配置, 官方配置

7.执行 nacos-config.sh 脚本

执行完成以后即可看到nacos配置

1.进入 bin 目录下所示

2.三台机器分别执行如下命令:

1.windows启动命令(本机)

.\seata-server.bat -p 28091 -m db -n 4

客户端要注册到nacos

store {

mode = "db"

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

}

db {

## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp)/HikariDataSource(hikari) etc.

datasource = "druid"

## mysql/oracle/postgresql/h2/oceanbase etc.

dbType = "mysql"

driverClassName = "com.mysql.jdbc.Driver"

url = "jdbc: mysql://192.168.200.161:3307/seata1.3 "

user = "root"

password = "123456"

minConn = 5

maxConn = 30

globalTable = "global_table"

branchTable = "branch_table"

lockTable = "lock_table"

queryLimit = 100

maxWait = 5000

}

redis {

host = "127.0.0.1"

port = "6379"

password = ""

database = "0"

minConn = 1

maxConn = 10

queryLimit = 100

}

}

registry.conf 采用nacos注册

registry {

type = "nacos"

nacos {

application = "seata-server"

serverAddr = "192.168.200.161:8848"

group = "SEATA_GROUP"

namespace = "062d258a-f77b-4375-b874-8045bd17523d"

cluster = "default"

username = "nacos"

password = "nacos"

}

eureka {

serviceUrl = " http://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 = " 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 {

type = "file"

nacos {

serverAddr = "127.0.0.1:8848"

namespace = ""

group = "SEATA_GROUP"

username = ""

password = ""

}

consul {

serverAddr = "127.0.0.1:8500"

}

apollo {

appId = "seata-server"

apolloMeta = "http://192.168.1.204:8801"

namespace = "application"

}

zk {

serverAddr = "127.0.0.1:2181"

sessionTimeout = 6000

connectTimeout = 2000

username = ""

password = ""

}

etcd3 {

serverAddr = " http://localhost:2379 "

}

file {

name = "file.conf"

}

}

nohup sh bin/seat-server.sh -p 8091 -n 1&

nohup sh bin/seat-server.sh -p 8092 -n 2&


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/8608936.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-18
下一篇2023-04-18

发表评论

登录后才能评论

评论列表(0条)

    保存