Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List members of cluster #77

Closed
plunkettscott opened this issue Jan 6, 2021 · 3 comments
Closed

List members of cluster #77

plunkettscott opened this issue Jan 6, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request release:v0.3.x Issues related with v0.3.x

Comments

@plunkettscott
Copy link

This is more of a general question because I can't seem to find an obvious answer.

Is it possible to list the members of an olric cluster from an Olric embedded member instance? I'm trying to use olric not only for caching but also as a cluster implementation while running an embedded member in each instance of the app. I can't seem to find a way to get the members of the cluster (or even access the memberlist implementation's list of nodes.)

I expected Stats() to offer this information but it seems to not offer a list of members, but instead returns important members in the cluster, such as the coordinator or owners and previous owners of particular partitions.

If it's not possible to do this currently would it be feasible to export this information for use when running as an embedded member? I'm not needing to subscribe to member join/leave, only list the members at any given time. For reference, my use case is to return the list of members via the application's API so that a glance at the web app can show the names of all members.

@buraksezer buraksezer self-assigned this Jan 7, 2021
@buraksezer buraksezer added enhancement New feature or request release:v0.3.x Issues related with v0.3.x labels Jan 7, 2021
@buraksezer
Copy link
Owner

Hi @plunkettscott

I'm sorry for my delayed response. The feature you requested is quite easy to implement. internal/discovery package already provides a list of known alive members. See this: https://github.com/buraksezer/olric/blob/master/internal/discovery/discovery.go#L286

We can easily expose this info in stats: https://github.com/buraksezer/olric/blob/master/stats.go#L32

You should know that internal/discovery provides low-level functionalities. So a member in the members slice may not be an effective cluster member. If you need a list of properly bootstrapped members, we may extract this data from the routing table.

@plunkettscott
Copy link
Author

Thanks, @buraksezer!

I definitely think listing bootstrapped cluster members is the answer, not necessarily listing members that may not be bootstrapped. Ideally, if it's easier to list all members of a cluster (even those not yet bootstrapped), I think it would be beneficial to also include the ability to see the state of those members (bootstrapped, not bootstrapped, unresponsive, etc.)

@buraksezer
Copy link
Owner

Hi @plunkettscott

I have just implemented the feature and released v0.3.4.

Stats now exposes bootstrapped members of the cluster.

type Stats struct {
	Cmdline            []string
	ReleaseVersion     string
	Runtime            Runtime
	ClusterCoordinator discovery.Member
	Partitions         map[uint64]Partition
	Backups            map[uint64]Partition
	ClusterMembers     map[uint64]discovery.Member
}

Please don't hesitate to open issues for further issues or feature requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request release:v0.3.x Issues related with v0.3.x
Projects
None yet
Development

No branches or pull requests

2 participants