0.1.110 ā€¢ Published 4 years ago

clusterduck v0.1.110

Weekly downloads
-
License
GPL-3.0-only
Repository
github
Last release
4 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

4 years ago

0.1.96

4 years ago

0.1.97

4 years ago

0.1.98

4 years ago

0.1.99

4 years ago

0.1.93

4 years ago

0.1.94

4 years ago

0.1.95

4 years ago

0.1.107

4 years ago

0.1.106

4 years ago

0.1.109

4 years ago

0.1.108

4 years ago

0.1.103

4 years ago

0.1.102

4 years ago

0.1.105

4 years ago

0.1.104

4 years ago

0.1.101

4 years ago

0.1.100

4 years ago

0.1.90

4 years ago

0.1.91

4 years ago

0.1.92

4 years ago

0.1.89

4 years ago

0.1.85

4 years ago

0.1.86

4 years ago

0.1.87

4 years ago

0.1.88

4 years ago

0.1.80

4 years ago

0.1.81

4 years ago

0.1.82

4 years ago

0.1.83

4 years ago

0.1.84

4 years ago

0.1.74

4 years ago

0.1.75

4 years ago

0.1.76

4 years ago

0.1.77

4 years ago

0.1.78

4 years ago

0.1.70

4 years ago

0.1.71

4 years ago

0.1.72

4 years ago

0.1.73

4 years ago

0.1.67

4 years ago

0.1.68

4 years ago

0.1.69

4 years ago

0.1.65

4 years ago

0.1.66

4 years ago

0.1.63

4 years ago

0.1.62

4 years ago

0.1.56

4 years ago

0.1.57

4 years ago

0.1.58

4 years ago

0.1.59

4 years ago

0.1.60

4 years ago

0.1.61

4 years ago

0.1.52

4 years ago

0.1.53

4 years ago

0.1.54

4 years ago

0.1.55

4 years ago

0.1.50

4 years ago

0.1.51

4 years ago

0.1.49

4 years ago

0.1.46

4 years ago

0.1.47

4 years ago

0.1.48

4 years ago

0.1.45

4 years ago

0.1.44

4 years ago

0.1.41

4 years ago

0.1.42

4 years ago

0.1.43

4 years ago

0.1.40

4 years ago

0.1.30

4 years ago

0.1.31

4 years ago

0.1.32

4 years ago

0.1.33

4 years ago

0.1.34

4 years ago

0.1.35

4 years ago

0.1.36

4 years ago

0.1.37

4 years ago

0.1.27

4 years ago

0.1.28

4 years ago

0.1.29

4 years ago

0.1.23

4 years ago

0.1.24

4 years ago

0.1.25

4 years ago

0.1.26

4 years ago

0.1.38

4 years ago

0.1.39

4 years ago

0.1.22

4 years ago

0.1.20

4 years ago

0.1.21

4 years ago

0.1.13

4 years ago

0.1.14

4 years ago

0.1.15

4 years ago

0.1.16

4 years ago

0.1.17

4 years ago

0.1.18

4 years ago

0.1.19

4 years ago

0.1.10

4 years ago

0.1.11

4 years ago

0.1.12

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago