You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ratis.apache.org by Riguz Lee <dr...@riguz.com> on 2022/03/01 03:33:26 UTC

回复: How to check whether raft cluster is ready?

Hi&nbsp;Tsz-Wo,


Thanks very much for your reply, that's exactlly what I'm looking for!


Riguz




------------------&nbsp;原始邮件&nbsp;------------------
发件人:                                                                                                                        "user"                                                                                    <szetszwo@gmail.com&gt;;
发送时间:&nbsp;2022年3月1日(星期二) 上午10:50
收件人:&nbsp;"user"<user@ratis.apache.org&gt;;

主题:&nbsp;Re: How to check whether raft cluster is ready?



Hi Raiguz,

Thanks for your questions.


&gt; check the status of the raft cluster, ie. has the leader election already completed? ...


We may use the&nbsp;GroupManagementApi.info(group) to get the group information from any of the&nbsp;servers.&nbsp; The API will return the information for each peer at the viewpoint of that server.&nbsp; Note that, due to the distributed nature of a raft cluster, the viewpoints from different servers could possibly be different.


&gt; apply additional operation when the status of raft cluster changed, ...


This is an EventApi in StateMachine such that&nbsp;each state machine in any of the servers can get notification of leader&nbsp;change; see StateMachine.EventApi.notifyLeaderChanged(..).


Hope&nbsp;this helps.
Tsz-Wo




On Tue, Mar 1, 2022 at 9:50 AM Riguz Lee <dr@riguz.com&gt; wrote:

Hi there,


I'm using ratis together with springboot, what I'm trying to implement is:


* check the status of the raft cluster, ie. has the leader election already completed? This could be useful for checking the status of the server, more specificlly, in k8s liveness probe
* apply additional operation when the status of raft cluster changed, for example, subscribe to a message queue when current node become the leader


I couldn't found features like that, do someone has similar scenarios?


Thanks,


Riguz Lee