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

Raft-based cluster support #2472

Closed
wants to merge 26 commits into from
Closed

Conversation

svagner
Copy link
Contributor

@svagner svagner commented Apr 23, 2020

Description

Cluster implementation for bosun.
The goal of this change is to add high availability for bosun service. Currently, it’s possible to have only one active bosun node running checks and sending an alert. If this node goes down or becomes unavailable there’s a high chance that checks won’t run for some time, alerts are not fired, incidents aren’t created and notifications — delivered. It then takes some time for a sysadmin to switch all the checks to another node. So, in the end, we’re minimizing human intervention needed in failure scenarios and reducing possible downtime of service.

Changes overview
We've implemented the cluster for bosun.
Cluster would only have one ‘leader’ at a time, all other nodes are followers (so this is an implementation of a model with 1 master and multiple standby nodes).
‘Leader’ node executes the checks and sends notifications, ‘Follower’ nodes can response to web UI queries and API queries. 'Follower' node can send notifications but only generated from API/UI queries.

As replacement for #2345 and #2441

Fixes #2443

Type of change

From the following, please check the options that are relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

  • TestAlertRunner_ClusterLeader
  • TestAlertRunner_ClusterFollower
  • TestCheckNotify_Cluster_FollowerState
  • TestCheckNotify_Cluster_LeaderState
  • TestClusterEnabledFollover_AlertRun

Checklist:

  • This contribution follows the project's code of conduct
  • This contribution follows the project's contributing guidelines
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Cluster would only have one ‘leader’ at a time, all other nodes are followers (so this is an implementation of a model with with 1 master and multiple standby nodes).
‘Master’ node executes the checks and sends notifications, ‘follower’ nodes don’t do neither (they run with ‘no-checks’ and ‘quiet-mode’ options enabled). This also adds a new (optional) dependency raftdb to store state and perform leader election.
For now, we are looking to global variable that was initialized once we've started. If we want to have flexibility to restart scheduler (config api reload/clustering etc.) we should have it as time of scheduler's start
- check raft state within scheduler to prevent lose events
- sync rules configuration between nodes within cluster
- add snapshots/logs management within raft cluster
- redis latency/count/errors
- notifications latency/count/errors
- incident state change
@stale
Copy link

stale bot commented Apr 18, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 18, 2021
@stale stale bot closed this May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Clustering support
1 participant