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

..15-Jul-2021-

.gitignoreH A D15-Jul-2021270 2619

LICENSEH A D15-Jul-202115.6 KiB355256

MakefileH A D15-Jul-2021670 3424

README.mdH A D15-Jul-20213.1 KiB7454

alive_delegate.goH A D15-Jul-2021591 154

awareness.goH A D15-Jul-20211.7 KiB7044

broadcast.goH A D15-Jul-20213.2 KiB10661

config.goH A D15-Jul-202114.7 KiB367153

conflict_delegate.goH A D15-Jul-2021376 114

delegate.goH A D15-Jul-20211.8 KiB388

event_delegate.goH A D15-Jul-20211.9 KiB6531

go.modH A D15-Jul-2021666 1916

go.sumH A D15-Jul-20214.6 KiB4948

keyring.goH A D15-Jul-20214.4 KiB16199

logging.goH A D15-Jul-2021454 3123

memberlist.goH A D15-Jul-202121.9 KiB762520

merge_delegate.goH A D15-Jul-2021570 154

mock_transport.goH A D15-Jul-20214.3 KiB196141

net.goH A D15-Jul-202134.4 KiB1,263920

net_transport.goH A D15-Jul-20219.8 KiB367240

ping_delegate.goH A D15-Jul-2021645 156

queue.goH A D15-Jul-202111.1 KiB423257

security.goH A D15-Jul-20215 KiB202128

state.goH A D15-Jul-202137.1 KiB1,315872

suspicion.goH A D15-Jul-20214.2 KiB13164

tag.shH A D15-Jul-2021399 179

todo.mdH A D15-Jul-2021211 76

transport.goH A D15-Jul-20214 KiB11448

util.goH A D15-Jul-20218 KiB310193

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