hashicorp / memberlist

Golang package for gossip based membership and failure detection
Mozilla Public License 2.0
3.65k stars 439 forks source link

Question: Roles of nodes in memberlist #46

Open diptanu opened 9 years ago

diptanu commented 9 years ago

Hi @armon and @mitchellh ,

Do you think it would be possible to designate role or additional metadata regarding a node when it joins a cluster? I understand that it's currently not possible but would be interested in a PR which would allow a user to configure the role of a node and query memberlist for nodes with specific metadata?

We are currently using the name field and adding more information to the name and parse the names to decipher the roles of various nodes in a cluster.

armon commented 9 years ago

@diptanu You can! You want to use the NodeMeta to associate metadata with the node (https://github.com/hashicorp/memberlist/blob/master/delegate.go#L10). We use this in Serf to support Key/Value tags. The queries can be done locally since the nodes have the full member list with all the meta data. In most cases, you are better off using the Serf library instead of Memberlist directly as it implements a ton of both nice and necessary (partition recovery) features.

armon commented 9 years ago

Serf is confusingly both a CLI based agent, but also just a drop in library. Consul embeds the Serf library for example for all gossip related features.

diptanu commented 9 years ago

@armon Thanks a ton! This library is awesome :) Also, are you suggesting to use serf as a library instead of memberlist?

Also, I need to put raft on top of serf like you guys do in Consul, however I need to do multiple smaller concensus groups within a cluster instead of a single concensus group.

armon commented 9 years ago

@diptanu Yeah the Serf library is both easier to use and has a ton more features. This library was meant to be almost purely an implementation of the SWIM algorithm, but many of the bells and whistles needed for the real world are in Serf. Sounds like you are working on something interesting, I'd love to learn more :)

kyleterry commented 8 years ago

Given you recommend using Serf as a library, are there any docs on doing that? I've been looking at the Consul code to see how this is done, and that gets me pretty far, but it's a lot of context switching.

Thanks for both of these things!

JensRantil commented 5 years ago

@kyleterry How about opening an issue with the Serf project/repo instead?

@kyleterry @armon I suggest this issue can be closed.

longquanzheng commented 9 months ago

@diptanu You can! You want to use the NodeMeta to associate metadata with the node (https://github.com/hashicorp/memberlist/blob/master/delegate.go#L10). We use this in Serf to support Key/Value tags. The queries can be done locally since the nodes have the full member list with all the meta data. In most cases, you are better off using the Serf library instead of Memberlist directly as it implements a ton of both nice and necessary (partition recovery) features.

Just curious, why does serf depend on memberlist?