亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Springcloud seata nacos環(huán)境搭建過程圖解

 更新時間:2020年03月21日 09:15:03   作者:學(xué)無終  
這篇文章主要介紹了Springcloud seata nacos環(huán)境搭建過程圖解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下

最近學(xué)習(xí)了一下seata,由于nacos現(xiàn)在也挺火,于是學(xué)習(xí)了seata注冊到nacos,然后集成springcloud

1.nacos配置(自行上官網(wǎng)下載)

將nacos/conf/nacos-mysql.sql導(dǎo)入自己的數(shù)據(jù)庫

2.配置修改nacos/conf/application.properties

spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true
db.user=root
db.password=123456

3.啟動nacos

windows直接雙擊startup.cmd

linux不要直接sh startup.sh 加入?yún)?shù) -m standalone或者改startup.sh -m參數(shù),linux腳本默認(rèn)集群啟動,不改參數(shù)也不加啟動參數(shù)會報錯

啟動成功

4.下載seata,建議直接下載源碼編譯

mvn -Prelease-all -DskipTests clean install -U

5.使用db模式導(dǎo)入配置

上面是源碼目錄,mysql.sql為seata庫必須的表,執(zhí)行sql即可

將上面的config.txt文件復(fù)制到seata目錄,nacos中的nacos-config.shnacos-config.py復(fù)制到seata的conf目錄

git 命令框執(zhí)行 sh nacos-config.sh hostip 即可,位置為什么這樣自己看下腳本就知道了

配置都進(jìn)來了,注意上面的紅框,如果你網(wǎng)上搜的腳本導(dǎo)入的,seata是1.0及之前的版本上面是對的,如果1.1及最新的源碼改成vgroupMapping了,報錯參考另一篇博客

5.修改seata配置

修改file.conf

service {
  #transaction service group mapping
  vgroupMapping.my_tx_group="default" #此處根據(jù)自己的情況修改
  default.grouplist="127.0.0.1:8091"
  disableGlobalTransaction=false
}
## 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/h2/oceanbase etc.
  dbType = "mysql"
  driverClassName = "com.mysql.jdbc.Driver" #不要用mysql8的驅(qū)動,否則報錯
  url = "jdbc:mysql://127.0.0.1:3306/seata"
  user = "root"
  password = "123456"
  minConn = 1
  maxConn = 10
  globalTable = "global_table"
  branchTable = "branch_table"
  lockTable = "lock_table"
  queryLimit = 100
 }
}

registry.conf

registry {
 # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
 type = "nacos"

 nacos {
  serverAddr = "localhost:8848"
  namespace = ""
  cluster = "default"
 }


}

config {
 # file、nacos 、apollo、zk、consul、etcd3
 type = "nacos"

 nacos {
  serverAddr = "localhost"
  namespace = ""
  group = "SEATA_GROUP"
 }
}

然后將上面兩個配置文件復(fù)制到你的springcloud模塊中

6.啟動seata

如果之前在其他ip啟動過,將file_store/data下的文件清掉,不然會報錯

7.springcloud代碼

https://gitee.com/code_fun/example.git 把demo.zip下載跑就可以了,前提是建好數(shù)據(jù)庫哦

demo.sql有表結(jié)構(gòu),undo_log表每個庫都要有

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論