Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis作为注册中心,seata server非正常下线,TM、Redis缓存不更新问题 #4100

Closed
dyingstraw opened this issue Oct 28, 2021 · 5 comments · Fixed by #4176
Closed
Assignees

Comments

@dyingstraw
Copy link

https://github.com/seata/seata/blob/0c2ae3209a000ed3b5445d0b1e25c52f35949f41/discovery/seata-discovery-redis/src/main/java/io/seata/discovery/registry/redis/RedisRegistryServiceImpl.java#L201
redis作为注册中心时

  1. 当seata server 被异常终止进程后,无法触发unregistry,导致redis依旧存在改server的地址,且seata TM依旧缓存了该Server,导致链接失败。请问这个如何解决
@xyz327
Copy link
Contributor

xyz327 commented Nov 1, 2021

换个注册中心组件.

@funky-eyes
Copy link
Contributor

问题存在,后续会进行我们自己的探活,而注册中心仅是获取相对存活的地址

@Pinocchio2018
Copy link
Contributor

@a364176773 我想问问目前develop分支有做 “探活” 的定时任务吗?我上次没找到。。我想试试

@Pinocchio2018
Copy link
Contributor

现在seata server使用redis作注册中心时,使用了hash,redis中是这样存储的:

key field value
registry.redis.default 192.168.61.1:8091 24728@SHN2110917J3F3
192.168.61.1:8092 22944@SHN2110917J3F3

在月会中提出的改造方案是:

  1. 改用 redis 中的k-v来存值,给key加上一个expire time。
  2. 在每个tc中建一个定时任务,去给这个key续命(每个tc续命自己的key)。

但是我现在遇到一个问题:

如果这样改造,当seata客户端去做subscribe的时候,该如何从redis订阅到所有的tc呢?

求助,求思路

@dyingstraw
Copy link
Author

我们是这么做的:
不设置过期,但是每个TC会定时2T时间刷新自己在Redis的注册时间。并且每隔T时间,会拿出来所有注册到Redis 的TC间,判断当前时间与注册时间是否大于2T,如果大于,调Redis 的unregistry方法,同时客户端也会移除TC列表缓存。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants