apache / incubator-seata

:fire: Seata is an easy-to-use, high-performance, open source distributed transaction solution.
https://seata.apache.org/
Apache License 2.0
25.38k stars 8.79k forks source link

Raft模式 no available service found in cluster. #7020

Closed EdaZhang closed 1 week ago

EdaZhang commented 1 week ago

Ⅰ. Issue Description

使用Raft模式部署 seata,客户端启动的时候报错 no available service found in cluster. 我想知道为何对于 HttpClientUtil.doGet("http://" + tcAddress + "/metadata/v1/cluster", param, header, 1000) 这个请求服务端无法做出响应,我的 tcAddress=myIp:9091

Ⅱ. Describe what happened

客户端代码截图

image

Caused by: org.apache.seata.common.exception.FrameworkException: no available service found in cluster.
    at org.apache.seata.core.rpc.netty.NettyClientChannelManager.throwFailFastException(NettyClientChannelManager.java:336)
    at org.apache.seata.core.rpc.netty.NettyClientChannelManager.doReconnect(NettyClientChannelManager.java:208)
    at org.apache.seata.core.rpc.netty.NettyClientChannelManager.initReconnect(NettyClientChannelManager.java:176)
    at org.apache.seata.core.rpc.netty.TmNettyRemotingClient.initConnection(TmNettyRemotingClient.java:291)
    at org.apache.seata.core.rpc.netty.TmNettyRemotingClient.init(TmNettyRemotingClient.java:191)
    at org.apache.seata.tm.TMClient.init(TMClient.java:47)
    at org.apache.seata.spring.annotation.GlobalTransactionScanner.initClient(GlobalTransactionScanner.java:247)
    at org.apache.seata.spring.annotation.GlobalTransactionScanner.afterPropertiesSet(GlobalTransactionScanner.java:495)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1802)
    ... 16 common frames omitted

server端日志

16:11:06.744  INFO --- [vent-executor-10-thread-1] [.jraft.rpc.RpcRequestProcessor] [            onClosed]  [] : Connection disconnected:  myIp:51265
16:11:06.759  INFO --- [vent-executor-10-thread-1] [.jraft.rpc.RpcRequestProcessor] [            onClosed]  [] : Connection disconnected: myIp:51266

Ⅲ. Describe what you expected to happen

Seata 客户端可以正常链接

Ⅳ. How to reproduce it (as minimally and precisely as possible)

客户端配置如下

seata:
  enabled: true
  data-source-proxy-mode: XA
  application-id: ${spring.application.name}
  registry:
    type: raft
    raft:
      server-addr: myIp:9091
  tx-service-group: default_tx_group
  service:
    vgroup-mapping:
      default_tx_group: test

服务端配置如下


server:
  port: 7091

spring:
  application:
    name: seata-server

logging:
  config: classpath:logback-spring.xml
  file:
    path: /data/java/logs
console:
  user:
    username: seata
    password: seata
seata:
  config:
    type: file
  registry:
    type: file
  server:
    raft:
      group: test
      server-addr: myIp:9091
      snapshot-interval: 600
      apply-batch: 32
      max-append-bufferSize: 262144
      max-replicator-inflight-msgs: 256
      disruptor-buffer-size: 16384
      election-timeout-ms: 1000
      reporter-enabled: false
      reporter-initial-delay: 60
      serialization: jackson
      compressor: none
      sync: true
    service-port: 8091
    max-commit-retry-timeout: -1
    max-rollback-retry-timeout: -1
    rollback-retry-timeout-unlock-enable: false
    enable-check-auth: true
    enable-parallel-request-handle: true
    enable-parallel-handle-branch: false
    retry-dead-threshold: 130000
    xaer-nota-retry-timeout: 60000
    enableParallelRequestHandle: true
    applicationDataLimitCheck: true
    applicationDataLimit: 64000
    recovery:
      committing-retry-period: 1000
      async-committing-retry-period: 1000
      rollbacking-retry-period: 1000
      timeout-retry-period: 1000
    undo:
      log-save-days: 7
      log-delete-period: 86400000
    session:
      branch-async-queue-size: 5000 #branch async remove queue size
      enable-branch-async-remove: false #enable to asynchronous remove branchSession
  store:
    mode: file
    file:
      dir: sessionStore
      max-branch-session-size: 16384
      max-global-session-size: 512
      file-write-buffer-cache-size: 16384
      session-reload-read-size: 100
      flush-disk-mode: async
  metrics:
    enabled: false
    registry-type: compact
    exporter-list: prometheus
    exporter-prometheus-port: 9898
  transport:
    rpc-tc-request-timeout: 15000
    enable-tc-server-batch-send-response: false
    shutdown:
      wait: 3
    thread-factory:
      boss-thread-prefix: NettyBoss
      worker-thread-prefix: NettyServerNIOWorker
      boss-thread-size: 1
  security:
    secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
    tokenValidityInMilliseconds: 1800000
    csrf-ignore-urls: /metadata/v1/**
    ignore:
      urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.jpeg,/**/*.ico,/api/v1/auth/login,/version.json,/health,/error,/metadata/v1/**

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

Client

funky-eyes commented 1 week ago

seata-server有几个节点? How many nodes does the seata-server have?

funky-eyes commented 1 week ago

客户端是7091端口,而不是9091 The client side is port 7091, not 9091.