0.1.110 ā€¢ Published 3 years ago

clusterduck v0.1.110

Weekly downloads
-
License
GPL-3.0-only
Repository
github
Last release
3 years ago

clusterduck

total downloads of clusterduck clusterduck's License latest version of clusterduck

A better way to supervise your clusters and services. The project is recently hatched and in the stage of active development.

Clusterduck is a robust solution for real-time distributed monitoring and self-healing clustering.

  • Raft consensus algorithm. Ducks love them rafts šŸ˜‰ liferaft is running over a robust TLS transport with peer discovery and HMAC-based authentication.
  • Health checks, real-time and voting-based.
  • Self-healing clusters. When the number of active nodes in a cluster falls below a given threshold, new nodes will be started automatically on the least loaded server(s) in a split second. Spare pools are supported.
  • Events and triggers Just about everything is an event that you can hook up your trigger to.
  • KISS. Hacking up your own plugin is definitely not a rocket science.

Featured extensions

šŸš€ clusterduck-dashboard ā€” A full-fledged dashboard built with React and Websocket.

clusterduck-redis ā€” Redis health checks and envoy-based balancing

šŸš€ clusterduck-http ā€” HTTP/Websocket health checks and haproxy/nginx support.

Table Of Contents

Installation

Node 15.x is recommended.

npm i -g clusterduck

Alternatively, you can clone the repo and link the dependencies which is useful for development purposes:

git clone git@github.com:kakserpom/clusterduck.git
cd clusterduck
node link

TLS

If you want to enable TLS for Raft, run this to generate certificates:

clusterduck gen-tls

Command-line interface

Run the clusterduck command to see if it all works for you.

If you want to daemonize it, run clusterduck -d

If you want to stop a running daemon, run clusterduck stop

For debugging purposes use DEBUG environmental variable: DEBUG=* clusterduck

Configuration

The default config file path is /etc/clusterduck/clusterduck.yaml

Clusters

Let's define a Redis cluster named my_redis_cluster:

clusters:
  
  my_redis_cluster:
    type: clusterduck-redis

Nodes

Then let's define some nodes:

    # List of nodes
    nodes:
      - addr: 127.0.0.1:6379
      - addr: 127.0.0.1:6380

Note that you can omit this altogether if you want to only add nodes dynamically.

Health checks

Now let's set up a simple health check.

    health_checks:
      - type: basic
        timeout: 1s
        interval: 10s
        interval_after_fail: 1s
        commands:
          - [ 'SET', 'x', 'y' ]

Now every 10 secs each node in the cluster will get checked on. If the check fails, a retry happens after 1 sec.

Triggers

Now let's live export the list of active nodes:

    triggers:
      - on: [ active ]
        do:
          - type: shell
            cwd: /tmp
            commands:
              - "echo $nodes_active_addrs > active_nodes.json"

This will make sure that /tmp/nodes_list always contains a current list of alive nodes.

Events

Cluster events

EventDescription
changedSet of nodes has changed

Node events

EventDescription
stateNode state has changed

Transports

transports:

Raft

  - type: raft
    address: tls://127.0.0.1:9911
    bootstrap: [ tls://127.0.0.1:9910 ]
ParameterDescription
address *Address to listen
tlsPath pattern to key/cert files. Default is clusterduck.%s (relative to the config file directory)
bootstrapList of node addresses to connect with.

Clusterduck instances will exchange peers and update bootstrap accordingly, but initial address is necessary.

HTTP

  - type: http
    listen: 8880
ParameterDescription
listenPort to listen

Roadmap

  • CLI
  • Live config updates (i.e. more Commands)
  • REST API

Transports

0.1.110

3 years ago

0.1.96

3 years ago

0.1.97

3 years ago

0.1.98

3 years ago

0.1.99

3 years ago

0.1.93

3 years ago

0.1.94

3 years ago

0.1.95

3 years ago

0.1.107

3 years ago

0.1.106

3 years ago

0.1.109

3 years ago

0.1.108

3 years ago

0.1.103

3 years ago

0.1.102

3 years ago

0.1.105

3 years ago

0.1.104

3 years ago

0.1.101

3 years ago

0.1.100

3 years ago

0.1.90

3 years ago

0.1.91

3 years ago

0.1.92

3 years ago

0.1.89

3 years ago

0.1.85

3 years ago

0.1.86

3 years ago

0.1.87

3 years ago

0.1.88

3 years ago

0.1.80

3 years ago

0.1.81

3 years ago

0.1.82

3 years ago

0.1.83

3 years ago

0.1.84

3 years ago

0.1.74

3 years ago

0.1.75

3 years ago

0.1.76

3 years ago

0.1.77

3 years ago

0.1.78

3 years ago

0.1.70

3 years ago

0.1.71

3 years ago

0.1.72

3 years ago

0.1.73

3 years ago

0.1.67

3 years ago

0.1.68

3 years ago

0.1.69

3 years ago

0.1.65

3 years ago

0.1.66

3 years ago

0.1.63

3 years ago

0.1.62

3 years ago

0.1.56

3 years ago

0.1.57

3 years ago

0.1.58

3 years ago

0.1.59

3 years ago

0.1.60

3 years ago

0.1.61

3 years ago

0.1.52

3 years ago

0.1.53

3 years ago

0.1.54

3 years ago

0.1.55

3 years ago

0.1.50

3 years ago

0.1.51

3 years ago

0.1.49

3 years ago

0.1.46

3 years ago

0.1.47

3 years ago

0.1.48

3 years ago

0.1.45

3 years ago

0.1.44

3 years ago

0.1.41

3 years ago

0.1.42

3 years ago

0.1.43

3 years ago

0.1.40

3 years ago

0.1.30

3 years ago

0.1.31

3 years ago

0.1.32

3 years ago

0.1.33

3 years ago

0.1.34

3 years ago

0.1.35

3 years ago

0.1.36

3 years ago

0.1.37

3 years ago

0.1.27

3 years ago

0.1.28

3 years ago

0.1.29

3 years ago

0.1.23

3 years ago

0.1.24

3 years ago

0.1.25

3 years ago

0.1.26

3 years ago

0.1.38

3 years ago

0.1.39

3 years ago

0.1.22

3 years ago

0.1.20

3 years ago

0.1.21

3 years ago

0.1.13

3 years ago

0.1.14

3 years ago

0.1.15

3 years ago

0.1.16

3 years ago

0.1.17

3 years ago

0.1.18

3 years ago

0.1.19

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago