• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.circleci/H04-May-2020-

internal/retry/H04-May-2020-

test/H04-May-2020-

.gitignoreH A D04-May-2020270

LICENSEH A D04-May-202015.6 KiB

MakefileH A D04-May-2020670

README.mdH A D04-May-20203.1 KiB

alive_delegate.goH A D04-May-2020591

awareness.goH A D04-May-20201.7 KiB

awareness_test.goH A D04-May-2020932

broadcast.goH A D04-May-20203.2 KiB

broadcast_test.goH A D04-May-2020578

config.goH A D04-May-202014.7 KiB

config_test.goH A D04-May-20202.2 KiB

conflict_delegate.goH A D04-May-2020376

delegate.goH A D04-May-20201.8 KiB

event_delegate.goH A D04-May-20201.8 KiB

go.modH A D04-May-2020666

go.sumH A D04-May-20204.6 KiB

integ_test.goH A D04-May-20202 KiB

keyring.goH A D04-May-20204.4 KiB

keyring_test.goH A D04-May-20203.6 KiB

logging.goH A D04-May-2020454

logging_test.goH A D04-May-2020801

memberlist.goH A D04-May-202021.9 KiB

memberlist_test.goH A D04-May-202046.8 KiB

merge_delegate.goH A D04-May-2020570

mock_transport.goH A D04-May-20204.3 KiB

net.goH A D04-May-202034.3 KiB

net_test.goH A D04-May-202018.8 KiB

net_transport.goH A D04-May-20209.8 KiB

ping_delegate.goH A D04-May-2020645

queue.goH A D04-May-202011.1 KiB

queue_test.goH A D04-May-20206.8 KiB

security.goH A D04-May-20205 KiB

security_test.goH A D04-May-20201.5 KiB

state.goH A D04-May-202037 KiB

state_test.goH A D04-May-202060.4 KiB

suspicion.goH A D04-May-20204.2 KiB

suspicion_test.goH A D04-May-20204.4 KiB

tag.shH A D04-May-2020399

todo.mdH A D04-May-2020211

transport.goH A D04-May-20204.5 KiB

transport_test.goH A D04-May-20205.3 KiB

util.goH A D04-May-20208 KiB

util_test.goH A D04-May-20207.6 KiB

z_test.goH A D04-May-2020478

README.md

1# memberlist [![GoDoc](https://godoc.org/github.com/hashicorp/memberlist?status.png)](https://godoc.org/github.com/hashicorp/memberlist) [![CircleCI](https://circleci.com/gh/hashicorp/memberlist.svg?style=svg)](https://circleci.com/gh/hashicorp/memberlist)
2
3memberlist is a [Go](http://www.golang.org) library that manages cluster
4membership and member failure detection using a gossip based protocol.
5
6The use cases for such a library are far-reaching: all distributed systems
7require membership, and memberlist is a re-usable solution to managing
8cluster membership and node failure detection.
9
10memberlist is eventually consistent but converges quickly on average.
11The speed at which it converges can be heavily tuned via various knobs
12on the protocol. Node failures are detected and network partitions are partially
13tolerated by attempting to communicate to potentially dead nodes through
14multiple routes.
15
16## Building
17
18If you wish to build memberlist you'll need Go version 1.2+ installed.
19
20Please check your installation with:
21
22```
23go version
24```
25
26## Usage
27
28Memberlist is surprisingly simple to use. An example is shown below:
29
30```go
31/* Create the initial memberlist from a safe configuration.
32   Please reference the godoc for other default config types.
33   http://godoc.org/github.com/hashicorp/memberlist#Config
34*/
35list, err := memberlist.Create(memberlist.DefaultLocalConfig())
36if err != nil {
37	panic("Failed to create memberlist: " + err.Error())
38}
39
40// Join an existing cluster by specifying at least one known member.
41n, err := list.Join([]string{"1.2.3.4"})
42if err != nil {
43	panic("Failed to join cluster: " + err.Error())
44}
45
46// Ask for members of the cluster
47for _, member := range list.Members() {
48	fmt.Printf("Member: %s %s\n", member.Name, member.Addr)
49}
50
51// Continue doing whatever you need, memberlist will maintain membership
52// information in the background. Delegates can be used for receiving
53// events when members join or leave.
54```
55
56The most difficult part of memberlist is configuring it since it has many
57available knobs in order to tune state propagation delay and convergence times.
58Memberlist provides a default configuration that offers a good starting point,
59but errs on the side of caution, choosing values that are optimized for
60higher convergence at the cost of higher bandwidth usage.
61
62For complete documentation, see the associated [Godoc](http://godoc.org/github.com/hashicorp/memberlist).
63
64## Protocol
65
66memberlist is based on ["SWIM: Scalable Weakly-consistent Infection-style Process Group Membership Protocol"](http://ieeexplore.ieee.org/document/1028914/). However, we extend the protocol in a number of ways:
67
68* Several extensions are made to increase propagation speed and
69convergence rate.
70* Another set of extensions, that we call Lifeguard, are made to make memberlist more robust in the presence of slow message processing (due to factors such as CPU starvation, and network delay or loss).
71
72For details on all of these extensions, please read our paper "[Lifeguard : SWIM-ing with Situational Awareness](https://arxiv.org/abs/1707.00788)", along with the memberlist source.  We welcome any questions related
73to the protocol on our issue tracker.
74