Seata1.4.2集成nacos疯狂打印日志bug解决

  |   0 评论   |   0 浏览

日志内容

2021-07-19 16:14:57 INFO  Ming-Server-System com.alibaba.nacos.client.Worker.longPolling.fixed-192.168.1.33_8848-public com.alibaba.nacos.client.config.impl.ClientWorker parseUpdateDataIdResponse 491 [fixed-192.168.1.33_8848-public] [polling-resp] config changed. dataId=seataServer.properties, group=SEATA_GROUP, tenant=public
2021-07-19 16:14:57 INFO  Ming-Server-System com.alibaba.nacos.client.Worker.longPolling.fixed-192.168.1.33_8848-public com.alibaba.nacos.client.config.impl.ClientWorker run 598 get changedGroupKeys:[seataServer.properties+SEATA_GROUP+public]
2021-07-19 16:14:58 INFO  Ming-Server-System com.alibaba.nacos.client.Worker.longPolling.fixed-192.168.1.33_8848-public com.alibaba.nacos.client.config.impl.ClientWorker run 616 [fixed-192.168.1.33_8848-public] [data-received] dataId=seataServer.properties, group=SEATA_GROUP, tenant=public, md5=b90112e4f764526b8b3cf6d4d47aaa10, content=transport.type=TCP
transport.server=NIO
transport.heartbeat=true
transport.enableClientBatchSendRequ..., type=properties
2021-07-19 16:14:58 INFO  Ming-Server-System com.alibaba.nacos.client.Worker.longPolling.fixed-192.168.1.33_8848-public com.alibaba.nacos.client.config.impl.ClientWorker parseUpdateDataIdResponse 491 [fixed-192.168.1.33_8848-public] [polling-resp] config changed. dataId=seataServer.properties, group=SEATA_GROUP, tenant=public
2021-07-19 16:14:58 INFO  Ming-Server-System com.alibaba.nacos.client.Worker.longPolling.fixed-192.168.1.33_8848-public com.alibaba.nacos.client.config.impl.ClientWorker run 598 get changedGroupKeys:[seataServer.properties+SEATA_GROUP+public]
2021-07-19 16:14:58 INFO  Ming-Server-System com.alibaba.nacos.client.Worker.longPolling.fixed-192.168.1.33_8848-public com.alibaba.nacos.client.config.impl.ClientWorker run 616 [fixed-192.168.1.33_8848-public] [data-received] dataId=seataServer.properties, group=SEATA_GROUP, tenant=public, md5=b90112e4f764526b8b3cf6d4d47aaa10, content=transport.type=TCP
transport.server=NIO
transport.heartbeat=true
transport.enableClientBatchSendRequ..., type=properties
2021-07-19 16:14:58 INFO  Ming-Server-System com.alibaba.nacos.client.Worker.longPolling.fixed-192.168.1.33_8848-public com.alibaba.nacos.client.config.impl.ClientWorker parseUpdateDataIdResponse 491 [fixed-192.168.1.33_8848-public] [polling-resp] config changed. dataId=seataServer.properties, group=SEATA_GROUP, tenant=public
2021-07-19 16:14:58 INFO  Ming-Server-System com.alibaba.nacos.client.Worker.longPolling.fixed-192.168.1.33_8848-public com.alibaba.nacos.client.config.impl.ClientWorker run 598 get changedGroupKeys:[seataServer.properties+SEATA_GROUP+public]
2021-07-19 16:14:58 INFO  Ming-Server-System com.alibaba.nacos.client.Worker.longPolling.fixed-192.168.1.33_8848-public com.alibaba.nacos.client.config.impl.ClientWorker run 616 [fixed-192.168.1.33_8848-public] [data-received] dataId=seataServer.properties, group=SEATA_GROUP, tenant=public, md5=b90112e4f764526b8b3cf6d4d47aaa10, content=transport.type=TCP
transport.server=NIO
transport.heartbeat=true
transport.enableClientBatchSendRequ..., type=properties
2021-07-19 16:14:58 INFO  Ming-Server-System com.alibaba.nacos.client.Worker.longPolling.fixed-192.168.1.33_8848-public com.alibaba.nacos.client.config.impl.ClientWorker parseUpdateDataIdResponse 491 [fixed-192.168.1.33_8848-public] [polling-resp] config changed. dataId=seataServer.properties, group=SEATA_GROUP, tenant=public
2021-07-19 16:14:58 INFO  Ming-Server-System com.alibaba.nacos.client.Worker.longPolling.fixed-192.168.1.33_8848-public com.alibaba.nacos.client.config.impl.ClientWorker run 598 get changedGroupKeys:[seataServer.properties+SEATA_GROUP+public]
2021-07-19 16:14:58 INFO  Ming-Server-System com.alibaba.nacos.client.Worker.longPolling.fixed-192.168.1.33_8848-public com.alibaba.nacos.client.config.impl.ClientWorker run 616 [fixed-192.168.1.33_8848-public] [data-received] dataId=seataServer.properties, group=SEATA_GROUP, tenant=public, md5=b90112e4f764526b8b3cf6d4d47aaa10, content=transport.type=TCP

seata 的配置文件中配置 namespace: public,而 public 是命名是命名空间名称,导致疯狂拉去配置。

实际上 nacos 默认的命名空间 public 的 ID 是空,所以不用配置。

问题配置如下:

### 分布式事务服务Seata
seata:
  enabled: true
  application-id: seata-server
  tx-service-group: system_seata_server
  service:
    vgroup-mapping:
      system_seata_server: default
    grouplist:
      - 192.168.1.11:8091
  config:
    type: nacos
    nacos:
      namespace: public
      serverAddr: 192.168.1.33:8848
      group: SEATA_GROUP
      data-id: seataServer.properties
      username: nacos
      password: 123456
  registry:
    type: nacos
    nacos:
      # 这里是名字空间ID,由于nacos默认的名字空间(public)ID为空
      namespace: public
      application: seata-server
      serverAddr: 192.168.1.33:8848
      group: SEATA_GROUP
      username: nacos
      password: 123456

正确配置如下:

### 分布式事务服务Seata
seata:
  enabled: true
  application-id: seata-server
  tx-service-group: system_seata_server
  service:
    vgroup-mapping:
      system_seata_server: default
    grouplist:
      - 192.168.1.11:8091
  config:
    type: nacos
    nacos:
      namespace:
      serverAddr: 192.168.1.33:8848
      group: SEATA_GROUP
      data-id: seataServer.properties
      username: nacos
      password: 123456
  registry:
    type: nacos
    nacos:
      # 这里是名字空间ID,由于nacos默认的名字空间(public)ID为空
      namespace:
      application: seata-server
      serverAddr: 192.168.1.33:8848
      group: SEATA_GROUP
      username: nacos
      password: 123456

问题原因:使用了命名空间的名称做为配置。

解决办法:使用命名空间的 ID 作为配置。

PS:低版本的 nacos 客户端存在 MD5 的 bug, 也会导致配置校验不一致,客户端重复拉取配置。升级到较高版本的 nacos 客户端可以解决 MD5 的 bug。

本问题使用的 sdk 版本:

  • nacos-client: 1.4.2
  • seata: 1.4.2

标题:Seata1.4.2集成nacos疯狂打印日志bug解决
作者:jockming112
地址:http://www.itwetouch.com/articles/2021/07/19/1626683253680.html