Sentinel icon indicating copy to clipboard operation
Sentinel copied to clipboard

集群流控下,如何保障TokenServer高可用性

Open bobo612 opened this issue 7 years ago • 12 comments

Issue Description

无论是采用alone还是embedded,当一台TokenServer挂了,是否有机制自动选择其他可用的Server。例如embedded时,如果机器A作为TokenServer挂了,必须要手动调用http://:/setClusterMode?mode=指定一台新的TokenServer吗,是否有自动选举功能?如果没有,是否有告警通知 Type: bug report or feature request

Describe what happened (or what feature you want)

Describe what you expected to happen

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

Tell us your environment

Anything else we need to know?

bobo612 avatar Dec 27 '18 10:12 bobo612

如果2台机器都设置成了TokenServer会怎样

bobo612 avatar Dec 27 '18 10:12 bobo612

如果2台机器都设置成了TokenServer会怎样

如果2台机器都设置成了Token Server会自动走本机

jialianglinjl avatar Jan 07 '19 03:01 jialianglinjl

能否把TokenServer的功能移到redis,将统计数据保存到redis上面,这样可以避免TokenServer高可用性的问题,

kangyl avatar Jan 11 '19 01:01 kangyl

I'm developing the ha solution for token server in cluster mode using zookeeper

wchswchs avatar May 09 '19 02:05 wchswchs

这个肯定要借助于中间件了,无论是redis,zk或者也要考虑中间件的小概率故障事件,最好有本地缓存或者数据同步机制结合心跳来保证最大程度的可用性

ccc7574 avatar May 09 '19 08:05 ccc7574

这个肯定要借助于中间件了,无论是redis,zk或者也要考虑中间件的小概率故障事件,最好有本地缓存或者数据同步机制结合心跳来保证最大程度的可用性

zookeeper use zab to solve ha,redis use raft, they all have own ha solutions, don't worry

wchswchs avatar May 10 '19 07:05 wchswchs

这个肯定要借助于中间件了,无论是redis,zk或者也要考虑中间件的小概率故障事件,最好有本地缓存或者数据同步机制结合心跳来保证最大程度的可用性

zookeeper use zab to solve ha,redis use raft, they all have own ha solutions, don't worry

But some times the redis and zk are also unstable, we met this couple times in production env.

It is unusual, but that is very terrible when it happens. The A of CAP is not real "A", even it use zab or raft for the middleware.

So it's better to monitor or check the middleware status and have a simple plan B to support the "A" when the middleware is not stable.

ccc7574 avatar May 13 '19 13:05 ccc7574

这个肯定要借助于中间件了,无论是redis,zk或者也要考虑中间件的小概率故障事件,最好有本地缓存或者数据同步机制结合心跳来保证最大程度的可用性

zookeeper use zab to solve ha,redis use raft, they all have own ha solutions, don't worry

But some times the redis and zk are also unstable, we met this couple times in production env.

It is unusual, but that is very terrible when it happens. The A of CAP is not real "A", even it use zab or raft for the middleware.

So it's better to monitor or check the middleware status and have a simple plan B to support the "A" when the middleware is not stable.

Zookeeper can push the available token server nodes to client, and then client cache the available nodes in local.

wchswchs avatar May 16 '19 08:05 wchswchs

The following is my solution:

  1. When token server starting, connect zookeeper and add node listener, register itself to zookeeper
  2. Token client subscribe the directory of token server zk nodes
  3. Zookeeper listen the change of token server nodes, when a server unavailable, notify the last updated available nodes to token client, then client cache the available nodes in local
  4. After token client accept the flow request, get the available token server nodes from local cache ,and then load balance to select one node

wchswchs avatar May 18 '19 04:05 wchswchs

@wchswchs How about things are going?

jasonjoo2010 avatar Jul 10 '19 07:07 jasonjoo2010

  1. zookeeper

i think token client should only connect to one tokenServer,if token client do load balance to connect to one tokenServer ,how to solve the problem of qps data sharing between different token server

hosaos avatar Aug 14 '19 02:08 hosaos

@wchswchs 这个方案进展的怎么样? 有PR提出来吗?

lawrencewu avatar Nov 07 '19 09:11 lawrencewu