Springcloud統合nacos、seata 1.0.0ピットの道


このブログでは、業務上の問題については触れず、DEBUGによる自己処理を行い、ここでは構成上の問題のみを発表します.
//末尾undoを含むlog.sql
1、io.seata.common.exception.FrameworkException: register error,role:RMROLE,err:cost 30008 ms
ファイル.config.DataSourceConfigurationクラスをチェックすることをお勧めします.ここでは2つのファイルの参照を提供します.
# file.conf
transport {
  # tcp udt unix-domain-socket
  type = "TCP"
  #NIO NATIVE
  server = "NIO"
  #enable heartbeat
  heartbeat = true
  #thread factory for netty
  thread-factory {
    boss-thread-prefix = "NettyBoss"
    worker-thread-prefix = "NettyServerNIOWorker"
    server-executor-thread-prefix = "NettyServerBizHandler"
    share-boss-worker = false
    client-selector-thread-prefix = "NettyClientSelector"
    client-selector-thread-size = 1
    client-worker-thread-prefix = "NettyClientWorkerThread"
    # netty boss thread size,will not be used for UDT
    boss-thread-size = 1
    #auto default pin or 8
    worker-thread-size = 8
  }
  shutdown {
    # when destroy server, wait seconds
    wait = 3
  }
  serialization = "seata"
  compressor = "none"
}
service {
  #vgroup->rgroup
  ##    my_tx_group       application.yml  tx-service-group  
  # spring:
  #  cloud:
  #    alibaba:
  #      seata:
   #        tx-service-group: my_tx_group
  vgroup_mapping.my_tx_group= "default"
  #only support single node
  default.grouplist = "127.0.0.1:8091"
  #degrade current not support
  enableDegrade = false
  #disable
  disable = false

  disableGlobalTransaction = 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"
}

client {
  async.commit.buffer.limit = 10000
  lock {
    retry.internal = 10
    retry.times = 30
  }
  report.retry.count = 5
}

## transaction log store
store {
  ## store mode: file、db
  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.
    datasource = "dbcp"
    ## mysql/oracle/h2/oceanbase etc.
    db-type = "mysql"
    url = "jdbc:mysql://localhost:3306/seata"
    user = "root"
    password = "password"
    min-conn = 1
    max-conn = 300
    global.table = "global_table"
    branch.table = "branch_table"
    lock-table = "lock_table"
    query-limit = 100
  }
}
lock {
  ## the lock store mode: local、remote
  mode = "remote"

  local {
    ## store locks in user's database
  }

  remote {
    ## store locks in the seata's server
  }
}
recovery {
  committing-retry-delay = 30
  asyn-committing-retry-delay = 30
  rollbacking-retry-delay = 30
  timeout-retry-delay = 30
}

transaction {
  undo.data.validation = true
  undo.log.serialization = "jackson"
}

## metrics settings
metrics {
  enabled = false
  registry-type = "compact"
  # multi exporters use comma divided
  exporter-list = "prometheus"
  exporter-prometheus-port = 9898
}


config {
  nacos.group = "default"
}
@Configuration
public class DataSourceConfiguration {
    @Bean
    @Primary
    public DataSourceProxy dataSourceProxy(DataSourceProperties properties){
        HikariDataSource dataSource = properties.initializeDataSourceBuilder().type(HikariDataSource.class).build();
        return new DataSourceProxy(dataSource);
    }
}

2、timed-out and no fallback available,failed and no fallback available
このエラーは基本的にHystrixヒューズでfeignのhystrixを無効にすることができます
#   hystrix        
feign.hystrix.enabled: false

しかし、根本的な問題を解決することはできません.Feignがリモート・サービスを呼び出すと、デフォルトでは8秒のタイムアウト時間で、タイムアウトもヒューズにジャンプして処理されます.リクエストタイムアウト時間から
ribbon.ReadTimeout=60000
ribbon.ConnectTimeout=60000

以上は博文を参考にして,文末に列挙する
ローカルテストの場合は、複数回のリクエスト後も正常にリクエストできます.
3、undo_log.sql
-- ----------------------------
-- Table structure for undo_log
-- ----------------------------
DROP TABLE IF EXISTS `undo_log`;
CREATE TABLE `undo_log` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) NOT NULL,
  `xid` varchar(100) NOT NULL,
  `context` varchar(128) NOT NULL,
  `rollback_info` longblob NOT NULL,
  `log_status` int(11) NOT NULL,
  `log_created` datetime NOT NULL,
  `log_modified` datetime NOT NULL,
  `ext` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

4、参考文献
彼らの提供に感謝[1]:https://seata.io/zh-cn/docs/ops/deploy-guide-beginner.html [2]: https://gitee.com/zengdw/springcloud-seata/blob/master/order/src/main/java/com/zengdw/order/configure/DataSoucreConfigure.java [3]: https://www.cnblogs.com/EasonJim/p/7722372.html [4]: https://segmentfault.com/a/1190000022032144?utm_source=tag-newest
他の問題があれば、コメントエリアに問題を残して、喜んで共同で検討してください.